MediaWiki:Wikia.js

importScriptPage('ShowHide/code.js', 'dev');

if ( wgIsArticle || window.location.href.indexOf( 'action=submit' ) > -1 ) { var script  = document.createElement( 'script' ); script.src = '/w/index.php?title=User:Poke/CollapsibleTables.js&action=raw&ctype=text/javascript'; script.type = 'text/javascript'; document.getElementsByTagName( 'head' )[0].appendChild( script ); hookEvent( 'load', function { new CollapsibleTables; } ); }

NavBars
*/ var NavigationBarHide = 'hide ▲'; var NavigationBarShow = 'show ▼'; function NavToggleCategory(navFrame) {   var table = navFrame.getElementsByTagName('table')[0]; if (table && table.className == "translations") return "translations"; var heading = navFrame.previousSibling; while (heading) { if (/[hH][4-6]/.test(heading.nodeName)) { if (heading.getElementsByTagName('span')[1]) { return heading.getElementsByTagName('span')[1].innerHTML.toLowerCase; }           else { return heading.getElementsByTagName('span')[0].innerHTML.toLowerCase; }           }        else if (/[hH][1-3]/.test(heading.nodeName)) break; heading = heading.previousSibling; }   return "other boxes"; }; function createNavToggle(navFrame){ var navHead, navToggle, navContent; for (var j=0; j < navFrame.childNodes.length; j++) { var div = navFrame.childNodes[j]; switch (div.className) { case 'NavHead': navHead = div; break; case 'NavContent': navContent = div; break; }   }    if (!navHead || !navContent) return; // Step 1, don't react when a subitem is clicked. for (var i=0; i<navHead.childNodes.length; i++) { var child = navHead.childNodes[i]; if (child.nodeType == 1) { child.onclick = function (e) {               if (e && e.stopPropagation) e.stopPropagation; else window.event.cancelBubble = true; }       }    }    // Step 2, toggle visibility when bar is clicked. // NOTE This function was chosen due to some funny behaviour in Safari. navToggle = newNode('a', {href: 'javascript:(function{})'}, ''); navHead.insertBefore(newNode('span', {'class': 'NavToggle'}, '[', navToggle, ']'), navHead.firstChild); navHead.style.cursor = "pointer"; navHead.onclick = VisibilityToggles.register(NavToggleCategory(navFrame),       function show {            navToggle.innerHTML = NavigationBarHide;            if (navContent)                navContent.style.display = "block";        },        function hide {            navToggle.innerHTML = NavigationBarShow;            if (navContent)                navContent.style.display = "none";        }); }; addOnloadHook( function {    var divs = $(".NavFrame");    for (var i=0; i<divs.length; i++) {        // NOTE: some templates use a class of NavFrame for the style, but for legacy reasons, are not NavFrames        if (divs[i].className == "NavFrame") {            createNavToggle(divs[i]);        }    } }); /*

Hidden Quotes
*/ function setupHiddenQuotes(li) {  var HQToggle, liComp; var HQShow = 'quotations ▼'; var HQHide = 'quotations ▲'; for (var k = 0; k < li.childNodes.length; k++) { // Look at each component of the definition. liComp = li.childNodes[k]; // If we find a ul or dl, we have quotes or example sentences, and thus need a button. if (/^(ul|UL)$/.test(liComp.nodeName)) { HQToggle = newNode('a', {href: 'javascript:(function{})'}, ''); li.insertBefore(newNode('span', {'class': 'HQToggle', 'style': 'font-size:0.65em'}, ' [', HQToggle, ']'), liComp); HQToggle.onclick = VisibilityToggles.register('quotations',                     function show {               HQToggle.innerHTML = HQHide;               for (var child = li.firstChild; child != null; child = child.nextSibling) {                  if (/^(ul|UL)$/.test(child.nodeName)) {                     child.style.display = 'block';                     }                  }               },            function hide {               HQToggle.innerHTML = HQShow;               for (var child = li.firstChild; child != null; child = child.nextSibling) {                  if (/^(ul|UL)$/.test(child.nodeName)) {                     child.style.display = 'none';                     }                  }               }); break; }     }   }            addOnloadHook( function  {   if (wgNamespaceNumber == 0) {      var ols, lis, li;      // First, find all the ordered lists, i.e. all the series of definitions.      var ols = document.getElementsByTagName('ol');      for(var i = 0; i < ols.length; i++) {         // Then, for every set, find all the individual definitions.         for (var j = 0; j < ols[i].childNodes.length; j++) {            li = ols[i].childNodes[j];            if (li.nodeName.toUpperCase == 'LI') {               setupHiddenQuotes(li);               }            }         }      }   }); /*

Category page fixes
*/ $(document).ready(function($){	var s, c;	if( wgNamespaceNumber === 14 && ( s = document.getElementById("catfix") ) ) {		c = "#" + s.className.split("CATFIX-")[1];		s = s.getElementsByTagName("*")[0] || document.createElement("span");		$("#mw-pages>.mw-content-ltr").find("li>a").each(function{ var li = this.parentNode, clone = s.cloneNode( false ); li.removeChild( this ); this.setAttribute("href", this.getAttribute("href", 2) + c ); clone.appendChild( this ); li.appendChild( clone ); })	} }) /*