hc
2024-03-22 a0752693d998599af469473b8dc239ef973a012f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Adds extra CSS classes "even" and "odd" to .memberdecls to allow
// striped backgrounds.
function MemberDeclsStriper () {
    var counter = 0;
    
    this.stripe = function() {
        $(".memberdecls tbody").children().each(function(i) {
            
            // reset counter at every heading -> always start with even
            if ($(this).is(".heading")) {
                counter = 0;
            }
 
            // add extra classes
            if (counter % 2 == 1) {
                $(this).addClass("odd");
            }
            else {
                $(this).addClass("even");
            }
 
            // advance counter at every separator
            // this is the only way to reliably detect which table rows belong together
            if ($(this).is('[class^="separator"]')) {
                counter++;
            }
        });
    }
}
 
// execute the function
$(document).ready(new MemberDeclsStriper().stripe);