From 707d559c4256de1413d979b6aa2d183ca26bfd4e Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 6 Jul 2003 04:37:22 +0000 Subject: [PATCH] Add a simple hide/show goodie for the TOC in JavaScript. TODO: toggle the display of 'hide/show' button, save info in cookie. --- includes/Skin.php | 4 +++- stylesheets/wikibits.js | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/includes/Skin.php b/includes/Skin.php index 927e4b3584..b7c1ed18d5 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1694,7 +1694,9 @@ class Skin { return "
\n" . "
\n". - "".wfMsg("toc")."

\n". + "".wfMsg("toc")."" . + " " . + "

\n". $toc."

\n"; } diff --git a/stylesheets/wikibits.js b/stylesheets/wikibits.js index c2b37a8a18..471153ab59 100644 --- a/stylesheets/wikibits.js +++ b/stylesheets/wikibits.js @@ -34,6 +34,7 @@ function checkTimezone( tz, msg ) { // in [-][H]H format... // won't yet work with non-even tzs function fetchTimezone() { + // FIXME: work around Safari bug var localclock = new Date(); // returns negative offset from GMT in minutes var tzRaw = localclock.getTimezoneOffset(); @@ -45,3 +46,27 @@ function fetchTimezone() { function guessTimezone(box) { document.preferences.wpHourDiff.value = fetchTimezone(); } + +var tocShow, tocHide; +function showTocToggle(show,hide) { + if(document.getElementById) { + document.writeln('[' + + hide + '/' + show + ']'); + tocShow = show; + tocHide = hide; + } +} + +function toggleToc() { + var toc = document.getElementById('tocinside'); + var tog = document.getElementById('toctoggle'); + if(toc.style.display == 'none') { + toc.style.display = tocWas; + // tog.innerHtml = tocHide; + } else { + tocWas = toc.style.display; + toc.style.display = 'none'; + // tog.innerHtml = tocShow; + } +} + -- 2.20.1