User:PanSola/monobook.js

//

document.write(' ');

var TOOLSCRIPTPATH = 'User:PanSola/';

function DocWriteJS(page){ var str = ' '; //   alert(str); document.write(str); }

// Loads up ../DebugTools.js var DEBUGMODE = true; if (DEBUGMODE) { DocWriteJS('DebuggerInit.js'); DocWriteJS('DebugTools.js'); }

/* * Overwrites the original function in http://gw.gamewikis.org/skins/common/sorttable.js  * with User:PanSola/sortable_mod.js. Commented out function sortableTables { if (getElementsByClassName(document, "table", "sortable").length != 0) { DocWriteJS('sortable_mod.js'); } }

//

/*********************************************************************************************

Switchbox tools
*/

var overrideNamespaces; var cancelSearchswitch;

function includeJS( page, onWikia, expand ) { document.write(' '); }

var mwGroups = new Array(	{ value: '', data: '(all)' },	{ value: 'bot', data: 'Bots' },	{ value: 'sysop', data: 'Sysops' },	{ value: 'bureaucrat', data: 'Bureaucrats' } );

var mwNamespaces = new Array(	{ value: '0', data: '(Main)' },	{ value: '1', data: 'Talk' },	{ value: '2', data: 'User' },	{ value: '3', data: 'User talk' },	{ value: '4', data: 'GuildWiki' },	{ value: '5', data: 'GuildWiki talk' },	{ value: '6', data: 'Image' },	{ value: '7', data: 'Image talk' },	{ value: '8', data: 'MediaWiki' },	{ value: '9', data: 'MediaWiki talk' },	{ value: '10', data: 'Template' },	{ value: '11', data: 'Template talk' },	{ value: '12', data: 'Help' },	{ value: '13', data: 'Help talk' },	{ value: '14', data: 'Category' },	{ value: '15', data: 'Category talk' },	{ value: '100', data: 'Build' },	{ value: '101', data: 'Build talk' } );

if( skin == 'monobook' && !cancelSearchswitch ) includeJS( 'MediaWiki:Searchswitch.js', 'en.anime' );

/* */

/* * Antivandal element remover * JSharp (http://www.wikia.com/wiki/User:JSharp) */

function notifyOnVandalElementFind{ /*No notification set*/ };

function addMatcherToElement(element){ element.matches = function(condition){ switch(condition){ case 'hasStyle': if(element.style){return true}; break; case 'hasOpacitySet': if(element.style.join('').indexOf('opacity') != -1){return true}; break; }; };  return element; };

function isVandalElement(element){ if (element.matches('hasStyle') && element.matches('hasOpacitySet')){ return true; } else /* Not a Vandal Element */ {  return false; }; };

function removeVandalElement(element){ if(element.parentNode) { /* if the node exists in the DOM tree */ element.parentNode.removeChild(element); /* remove the node from the tree */ }; };

function evaluateContentElementsForVandalism{ var contentContainer = document.getElementById('bodyContent'); var elementsToSearch = contentContainer.getElementsByTagName('a'); for(var i=0;i<elementsToSearch.length;i++){ // search all elements inside anchor tags with class external var element = elementsToSearch[i]; if (element.hasChildNodes && element.className == 'external text'){ for(var j=0; j<element.childNodes.length; j++){ var subElement = element.childNodes[j]; if(subElement.hasAttributes ){ removeVandalElement(element); };     };    };  }; };

addOnloadHook(evaluateContentElementsForVandalism);