MediaWiki:Common.js

/* */

/* Include Global Anime-Common.js Information */ importScriptURI('http://anime.wikia.com/index.php?title=MediaWiki:Anime-Common.js&action=raw&ctype=text/javascript&dontcountme=s&templates=expand');

/* if (skin == 'slate' || skin == 'smoke'){ document.write(' '); }

document.write(' ');

/* Allows toggle of game navigation */ var displayStates = new Array('none', ''); var displayText = new Array('show', 'hide');

function gamenav_init { var idnum = 0; // Find all tables with class gamenav var tables = getElementsByClassName(document, "table", "game_nav"); for (var ti = 0; ti < tables.length ; ti++) { var tab = tables[ti];

tab.setAttribute('state', 1); // 1 is the show state var gameNavTog = document.createElement("a"); gameNavTog.setAttribute('href', 'javascript:toggleGameNav("' + tab.id + '");'); gameNavTog.setAttribute('id', 'tog_' + tab.id);

var gameNavTogText = document.createTextNode('hide'); gameNavTog.appendChild(gameNavTogText);

var spans = getElementsByClassName(tab, "span", "game nav tog"); for( var sj=0; sj < spans.length; sj++ ){ spans[sj].appendChild(gameNavTog); }	} } function toggleGameNav(tableID) { var nothing; var tab = document.getElementById(tableID); var newState = 1- tab.getAttribute('state'); tab.setAttribute('state', newState); for (var ti=0; ti < tab.rows.length; ti++){ var myRow = tab.rows[ti]; if (myRow.className != "nohide"){ myRow.style.display = displayStates[newState]; }	}	var togA = document.getElementById('tog_' + tableID); var togTxt = togA.firstChild; togTxt.data = displayText[newState]; }

addOnloadHook(gamenav_init);

/*

Open in new window code
*/ /* Function based on externalLinks as described at http://www.mediawiki.org/wiki/Manual:Opening_external_links_in_a_new_window

newWindowLinks = function { if (!document.getElementsByTagName) { return; }       var wrappers = getElementsByClassName(document, "*", "OpenNewWindow"); for (var j=0; j < wrappers.length; j++) { var anchors = wrappers[j].getElementsByTagName("a"); for (var i = 0; i < anchors.length; i++) { var anchor = anchors[i]; anchor.target = "_blank"; }       } } if (window.addEventListener) { window.addEventListener("load", newWindowLinks, false); } else if (window.attachEvent) { window.attachEvent("onload", newWindowLinks ); }

/* */