MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */

var ArchiveToolConfig = { archiveListTemplate: 'ArchCat', archivePageTemplate: 'ArchPage', archiveSubpage: 'Archive', userLang: true }; importScriptPage('ArchiveTool/code.js', 'dev');

/* =============  MOS box from Brickipedia ==============  This is the little box underneath the search bar and article tally, which has the Seal of Rassilon in it. ===============  Keep at end of common.js, but before any addOnloadHooks. ================ */

importScript('MediaWiki:Common.js/mosbox.js');

/** * SpoilerAlert * documentation at: http://dev.wikia.com/wiki/SpoilerAlert * © Peter Coester, 2012 * * __NOWYSIWYG__ */

SpoilerAlert = { question: 'This page may contain spoilers about unreleased stories. Are you sure you want to read it?', yes: 'Hit me with your best shot', no: 'Get me the hell out of here', isSpoiler: function { return -1 !== wgCategories.indexOf('Contains spoilers'); },   back:true };

// /* Any JavaScript here will be loaded for all users on every page load. */

// onload stuff var firstRun = true;

function loadFunc { if( firstRun ) { firstRun = false; } else { return; }

window.pageName = wgPageName; window.storagePresent = (typeof(globalStorage) != 'undefined');

addHideButtons; substUsername; substUsernameTOC; addAlternatingRowColors;

var body = document.getElementsByTagName('body')[0]; var bodyClass = body.className;

if( !bodyClass || (bodyClass.indexOf('page-') == -1) ) { var page = window.pageName.replace(/\W/g, '_'); body.className += ' page-' + page; }

if( typeof(onPageLoad) != "undefined" ) { onPageLoad; } }

function infoboxToggle { var page = window.pageName.replace(/\W/g, '_'); var nowShown;

if(document.getElementById('infoboxtoggle').innerHTML == '[Hide]') { document.getElementById('infoboxinternal').style.display = 'none'; document.getElementById('infoboxtoggle').innerHTML = '[Show]'; nowShown = false; } else { document.getElementById('infoboxinternal').style.display = 'block'; document.getElementById('infoboxtoggle').innerHTML = '[Hide]'; nowShown = true; }

if(window.storagePresent) { var storage = globalStorage[window.location.hostname]; storage.setItem('infoboxshow-' + page, nowShown); } }

function addAlternatingRowColors { var infoboxes = getElementsByClass('infobox-interior', document.getElementById('content'));

if( infoboxes.length == 0 ) return;

for( var k = 0; k < infoboxes.length; k++ ) { var infobox = infoboxes[k];

var rows = infobox.getElementsByTagName('tr'); var changeColor = false;

for( var i = 0; i < rows.length; i++ ) { if(rows[i].className.indexOf('infoboxstopalt') != -1) break;

var ths = rows[i].getElementsByTagName('th');

if( ths.length > 0 ) { continue; }

if(changeColor) rows[i].style.backgroundColor = '#f9f9f9'; changeColor = !changeColor; }	} }

//