javascript/theme2.js
author Mahlon E. Smith <mahlon@martini.nu>
Wed, 02 Dec 2009 17:00:38 -0800
changeset 4 4fe151fd3b80
parent 1 1ae1a79094fa
permissions -rw-r--r--
Update the sample to reflect 0.6's changes.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     1
$(document).ready(function(){
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     2
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     3
    // slide everything open on new page
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     4
    $(".outline:hidden").slideToggle("slow", function(){
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     5
        $(".percent:hidden").fadeIn("slow");
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     6
    });
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     7
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     8
    // re-activate links (the event is stomped on by the li event)
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     9
    $(".outline a").click(function(){ window.location.href = this });
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    10
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    11
    // highlight clicked items
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    12
    $("li").not("[ul]").click(function(){ $(this).toggleClass("selected") });
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    13
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    14
    // add line numbers
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    15
    var line_counter = 0;
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    16
    $("li").each(function(){
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    17
        var str = '<span class="linenum">' + ++line_counter + ':</span>';
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    18
        $(this).prepend(str);
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    19
    });
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    20
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    21
    // attach folds
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    22
    $(".outline ul li").toggle(
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    23
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    24
        // hide
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    25
        function(){
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    26
            if ( $(this).children("ul").size() == 0 ) return;
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    27
            $(this).children("ul").slideUp("slow");
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    28
            $(this).find(".linenum").addClass("linenum-folded");
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    29
        },
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    30
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    31
        // show
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    32
        function(){
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    33
            $(this).children("ul").slideDown("slow");
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    34
            $(this).find(".linenum").removeClass("linenum-folded");
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    35
        }
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    36
    );
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    37
1ae1a79094fa ModPerl2 update. This code was actually released (before it was in a
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    38
});