1 // Sidebar table of contents
4 var click_func = function(e){
5 if( $('#toc').data('opened') ){
6 $('#toc > *').animate({ left: '-=' + $('#toc > ul').width() + 'px' },'fast');
7 $('#toc').removeData('opened');
9 $('#toc > *').animate({ left: '+=' + $('#toc > ul').width() + 'px' },'fast');
10 $('#toc').data('opened',1);
14 var type = document.location.pathname.match(/\/doc\/html\/spec_html\/filter/) ? 'filter' : 'spec';
16 // Get the relevant table of contents
17 $.get( type === 'spec' ? 'index_toc.xml' : 'filter_toc.xml',
20 // Remove the main list from the DOM for performance
21 var $ul = $('#toc > ul').remove();
25 $(xml).find('c').each(function(){
27 var chapter_title = $(this).children('t').text();
28 var chapter_url = $(this).children('u').text();
30 var chapter_li = $('<li/>').append(
34 }).text( chapter_id + '. ' + chapter_title ),
39 $('#toc img').fadeIn('slow',function(){
40 // Add the main list back to the DOM
42 .removeClass( 'hidden' )
43 .css( 'visibility', 'hidden' )
45 .css( 'left', '-' + $ul.width() + 'px' )
46 .css( 'visibility', 'visible' );
47 $('#toc > img').mousedown(click_func);
48 $('#toc > ul').click(click_func);
49 $('#toc a').click(function(e){e.stopPropagation()});