From ba72dce1b47b01a626df51666b84593d8cbc1050 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sun, 21 Aug 2011 14:33:07 +0200 Subject: fixed TOC-Bug and moved TOC behaviour to page.js FS#2314 --- lib/scripts/behaviour.js | 31 ------------------------------- lib/scripts/page.js | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 31 deletions(-) (limited to 'lib/scripts') diff --git a/lib/scripts/behaviour.js b/lib/scripts/behaviour.js index 1580ae86f..d7c3d2975 100644 --- a/lib/scripts/behaviour.js +++ b/lib/scripts/behaviour.js @@ -16,7 +16,6 @@ var dw_behaviour = { dw_behaviour.removeHighlightOnClick(); dw_behaviour.quickSelect(); dw_behaviour.checkWindowsShares(); - dw_behaviour.initTocToggle(); dw_behaviour.subscription(); dw_behaviour.revisionBoxHandler(); @@ -86,36 +85,6 @@ var dw_behaviour = { }); }, - /** - * Adds the toggle switch to the TOC - */ - initTocToggle: function() { - var $header = jQuery('#toc__header'); - if(!$header.length) return; - var $toc = jQuery('#toc__inside'); - - var $clicky = jQuery(document.createElement('span')) - .attr('id','toc__toggle') - .css('cursor','pointer') - .click(function(){ - $toc.slideToggle(200); - setClicky(); - }); - $header.prepend($clicky); - - var setClicky = function(){ - if($toc.css('display') == 'none'){ - $clicky.html('+'); - $clicky[0].className = 'toc_open'; - }else{ - $clicky.html(''); - $clicky[0].className = 'toc_close'; - } - }; - - setClicky(); - }, - /** * Hide list subscription style if target is a page * diff --git a/lib/scripts/page.js b/lib/scripts/page.js index 05c5ece20..f3d35609d 100644 --- a/lib/scripts/page.js +++ b/lib/scripts/page.js @@ -10,6 +10,7 @@ dw_page = { init: function(){ dw_page.sectionHighlight(); jQuery('a.fn_top').mouseover(dw_page.footnoteDisplay); + dw_page.initTocToggle(); }, /** @@ -93,7 +94,38 @@ dw_page = { // now put the content into the wrapper $fndiv.html(content); $fndiv.show(); + }, + + /** + * Adds the toggle switch to the TOC + */ + initTocToggle: function() { + var $header = jQuery('#toc__header'); + if(!$header.length) return; + var $toc = jQuery('#toc__inside'); + + var setClicky = function(){ + if($toc.css('display') == 'none'){ + $clicky.html('+'); + $clicky[0].className = 'toc_open'; + }else{ + $clicky.html(''); + $clicky[0].className = 'toc_close'; + } + }; + + var $clicky = jQuery(document.createElement('span')) + .attr('id','toc__toggle') + $header.css('cursor','pointer') + .click(function(){ + $toc.slideToggle(200,setClicky); + }) + .prepend($clicky); + + setClicky(); } + + }; jQuery(dw_page.init); -- cgit v1.2.3