X-Git-Url: https://git.exim.org/exim-website.git/blobdiff_plain/73f7cdebc3e20a3cd40d1a955f5a08742a5b8fdf..52b33ebd755ffe58ffa039c47ba2538a9c6af6f3:/templates/web/doc/chapter.js diff --git a/templates/web/doc/chapter.js b/templates/web/doc/chapter.js index 204f924..47c2460 100644 --- a/templates/web/doc/chapter.js +++ b/templates/web/doc/chapter.js @@ -1,54 +1,50 @@ // Sidebar table of contents - (function( $ ){ - - var click_func = function(e){ - if( $('#toc').data('opened') ){ - $('#toc > *').animate({ left: '-=' + $('#toc > ul').width() + 'px' },'fast'); - $('#toc').removeData('opened'); - } else { - $('#toc > *').animate({ left: '+=' + $('#toc > ul').width() + 'px' },'fast'); - $('#toc').data('opened',1); - } - }; +(function ($) { - var type = document.location.pathname.match(/\/doc\/html\/spec_html\/filter/) ? 'filter' : 'spec'; - - // Get the relevant table of contents - $.get( type === 'spec' ? 'index_toc.xml' : 'filter_toc.xml', - function( xml ){ + var click_func = function (e) { + if ($('#toc').data('opened')) { + $('#toc > *').animate({ + left: '-=' + $('#toc > ul').width() + 'px' + }, 'fast'); + $('#toc').removeData('opened'); + } else { + $('#toc > *').animate({ + left: '+=' + $('#toc > ul').width() + 'px' + }, 'fast'); + $('#toc').data('opened', 1); + } + }; - // Remove the main list from the DOM for performance - var $ul = $('#toc > ul').remove(); + var type = document.location.pathname.match(/\/doc\/html\/spec_html\/filter/) ? 'filter' : 'spec'; - // Traverse chapters - var chapter_id = 0; - $(xml).find('c').each(function(){ - ++chapter_id; - var chapter_title = $(this).children('t').text(); - var chapter_url = $(this).children('u').text(); + // Get the relevant table of contents + $.get(type === 'spec' ? 'index_toc.xml' : 'filter_toc.xml', function (xml) { - var chapter_li = $('
  • ').append( - $('').attr({ - href: chapter_url, - title: chapter_title - }).text( chapter_id + '. ' + chapter_title ), - $('