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