1 $(document).ready(function()
6 $('pre:not(.debug) code').each(function()
8 $(this).addClass('brush: php, class-name: highlighted');
11 SyntaxHighlighter.config.tagName = 'code';
12 // Don't show the toolbar or line-numbers.
13 SyntaxHighlighter.defaults.gutter = false;
14 SyntaxHighlighter.all();
16 // Any link that has the current page as its href should be class="current"
17 $('a[href="'+ window.location.pathname +'"]').addClass('current');
21 last = $('#kodoc-nav .breadcrumb-last');
24 $('#kodoc-menu li').has('a.current').each(function()
26 // Only add if we aren't already on that page
27 if ($(this).find(':first-child').first().attr('href') != window.location.pathname)
29 // Clone the empty li, set it's html as the link or span, then prepend it to the last breadcrumb item
30 last.before(li.clone().html($(this).find(':first-child').first().clone()));
34 // Now kill the duplicate link for the current page
35 //last.prev().remove();
39 $('#topics li:has(li)').each(function()
42 var toggle = $('<span class="toggle"></span>');
43 var menu = $this.find('>ul,>ol');
45 toggle.click(function()
47 if (menu.is(':visible'))
49 menu.stop(true, true).slideUp('fast');
54 menu.stop(true, true).slideDown('fast');
55 toggle.html('–');
59 $this.find('>span').click(function()
61 // Menu without a link
65 if ( ! $this.is(':has(a.current)'))
70 toggle.html(menu.is(':visible') ? '–' : '+').prependTo($this);
75 $('#kodoc-main .method-source').each(function()
78 var togg = $(' <a class="sourcecode-toggle">[show]</a>').appendTo($('h4', self));
79 var code = self.find('pre').hide();
81 togg.toggle(function()
84 code.stop(true, true).slideDown();
89 code.stop(true, true).slideUp();
93 // "Link to this" link that appears when you hover over a header
96 .find('h1[id],h2[id],h3[id],h4[id],h5[id],h6[id]')
97 .append(function(index, html){
98 return '<a href="#' + $(this).attr('id') + '" class="permalink">link to this</a>';
101 // Table of contents for userguide pages
103 // When the show/hide link for the page toc is clicked, toggle visibility
104 $('#kodoc-toc-toggle').click(function()
106 if ($('#kodoc-page-toc-content').is(':visible'))
109 $(this).html('show');
110 $('#kodoc-page-toc').addClass('closed').removeClass('open')
111 $('#kodoc-page-toc-content').hide();
112 $.cookie('kodoc-toc-show',"false");
117 $(this).html('hide');
118 $('#kodoc-page-toc').addClass('open').removeClass('closed')
119 $('#kodoc-page-toc-content').show();
120 $.cookie('kodoc-toc-show',"true");
124 // If the cookie says to hide the toc, hide it by clicking the toggle
125 if ($.cookie('kodoc-toc-show') == "false")
127 $('#kodoc-toc-toggle').click();