MediaWiki r1432 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r1431‎ | r1432 (on ViewVC)‎ | r1433 >
Date:04:37, 6 July 2003
Author:vibber
Status:old
Tags:
Comment:
Add a simple hide/show goodie for the TOC in JavaScript.
TODO: toggle the display of 'hide/show' button, save info in cookie.
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/Skin.php
@@ -1694,7 +1694,9 @@
16951695 return
16961696 "<table border=\"0\" bgcolor=\"#8888aa\" cellpadding=\"0\" cellspacing=\"1\"><tr><td>\n" .
16971697 "<table border=\"0\" bgcolor=\"#f3f3ff\" CELLPADDING=5><tr><td>\n".
1698 - "<b>".wfMsg("toc")."</b><p>\n".
 1698+ "<b>".wfMsg("toc")."</b>" .
 1699+ " <script type='text/javascript'>showTocToggle(\"" . wfMsg("showtoc") . "\",\"" . wfMsg("hidetoc") . "\")</script>" .
 1700+ "</td></tr><tr id='tocinside'><td>\n".
16991701 $toc."</td></tr></table></td></tr></table><P>\n";
17001702 }
17011703
Index: trunk/phase3/stylesheets/wikibits.js
@@ -34,6 +34,7 @@
3535 // in [-][H]H format...
3636 // won't yet work with non-even tzs
3737 function fetchTimezone() {
 38+ // FIXME: work around Safari bug
3839 var localclock = new Date();
3940 // returns negative offset from GMT in minutes
4041 var tzRaw = localclock.getTimezoneOffset();
@@ -45,3 +46,27 @@
4647 function guessTimezone(box) {
4748 document.preferences.wpHourDiff.value = fetchTimezone();
4849 }
 50+
 51+var tocShow, tocHide;
 52+function showTocToggle(show,hide) {
 53+ if(document.getElementById) {
 54+ document.writeln('<small>[<a href="javascript:toggleToc()" id="toctoggle">' +
 55+ hide + '/' + show + '</a>]</small>');
 56+ tocShow = show;
 57+ tocHide = hide;
 58+ }
 59+}
 60+
 61+function toggleToc() {
 62+ var toc = document.getElementById('tocinside');
 63+ var tog = document.getElementById('toctoggle');
 64+ if(toc.style.display == 'none') {
 65+ toc.style.display = tocWas;
 66+ // tog.innerHtml = tocHide;
 67+ } else {
 68+ tocWas = toc.style.display;
 69+ toc.style.display = 'none';
 70+ // tog.innerHtml = tocShow;
 71+ }
 72+}
 73+

Status & tagging log

  • 21:41, 11 October 2010 Reedy (Talk | contribs) changed the status of r1432 [removed: new added: old]
Personal tools
Namespaces

Variants
Views
Actions
Navigation
Support
Download
Development
Communication
Toolbox