Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * JavaScript to move DokuWiki Table of Contents position from the default
- * location to within the first element with class='wrap_movetoc' and
- * recolors it to match the current ToC of Wikipedia.
- *
- * Creation of a div with class='wrap_movetoc' can be accomplished with the
- * plugin "Wrap" and creating an empty <WRAP movetoc {size}px></WRAP>
- * and placing that where you want the ToC to appear.
- *
- */
- addInitEvent(function moveTOC() {
- 'use strict';
- var moveTOCHere, tocTable, container, tocHeader, tocInside, tocToggle;
- moveTOCHere = document.getElementsByClassName('wrap_movetoc');
- tocTable = document.getElementsByClassName('toc');
- container = moveTOCHere[0];
- tocHeader = document.getElementById('toc__header');
- tocInside = document.getElementById('toc__inside');
- tocToggle = document.getElementById('toc__toggle');
- if(typeof(tocHeader) !== 'undefined' && tocHeader !== null) {
- if (moveTOCHere.length === 1) {
- container.appendChild(tocTable[0]);
- tocHeader.style.textAlign = "center";
- tocTable[0].style.cssFloat = "none";
- tocTable[0].style.margin = "0px";
- tocTable[0].style.fontSize = "100%";
- tocHeader.style.backgroundColor = "transparent";
- tocHeader.style.border = "none";
- tocHeader.style.margin = "0px";
- tocInside.style.backgroundColor = "transparent";
- tocInside.style.border = "none";
- moveTOCHere[0].style.backgroundColor = "#F9F9F9";
- moveTOCHere[0].style.border = "1px solid #AAAAAA";
- } else {
- return;
- }
- } else {
- return;
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement