User:Warwick/monobook.js

// preset summary descriptions for wikEd; must always be before the code that installs wikEd var wikEdComboPresetOptions = []; wikEdComboPresetOptions['summary'] = [ 'reply', 'wall of text', 'cleanup', 'minor cleanup', 'linkfix', 'fixing typos', 'adding del tag', 'adding copyvio tag', 'adding admin review tag', 'reverting vandalism', 'reverting blanking', 'reverting silliness' ];

// installs wikEd, an in-browser text editor // with wiki syntax highlighting document.write(' ');

/**** Guild Wars Wiki Tools * (c) 2007 by Patrick Westerhoff [poke] */ var head = document.getElementsByTagName( 'head' )[0]; head.appendChild( document.createElement( 'script' ) ); head.lastChild.src = '/index.php?title=User:Poke/GuildWarsWikiTools.js&action=raw&ctype=text/javascript'; head.lastChild.type = 'text/javascript'; insertScript('MediaWiki:TemplateTools.js');

// ***** ADDITIONAL LINKS *****

function addBar { document.getElementById('p-navigation').innerHTML += ' '+ ' '+  ' All Wiki Links '+ ' '+ 'Deletion Candidates'+ 'Banning Candidates'+ 'Logs'+ 'Userpage</a></li>'+ '<a href=\"/wiki/special:mytalk">Usertalk</a></li>'+ '<a href=\"/wiki/special:mypage/Mafia">Mafia</a></li>'+ '<a href=\"/wiki/special:mypage/monobook.js">Monobook.js</a></li>'+ '<a href=\"/wiki/special:mypage/monobook.css">Monobook.css</a></li>'+

'</ul> '; } //Close addBar addOnloadHook(addBar); //Call addBar on load

//WikiSwap importScript('User:AT/wikiswap.js');

//

var TOOLSCRIPTPATH = 'User:Warwick/';

function DocWriteJS(partialPage){ insertSubscript(partialPage); }

// Loads up ../DebugTools.js var DEBUGMODE = true;

insertScript('MediaWiki:TemplateTools.js'); insertExternalCSS('http://www.wikia.com/index.php?title=User:Warwick/Sandbox/1.css&action=raw&ctype=text/css&smaxage=18000');

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

//

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

Switchbox tools
*/

var overrideNamespaces; var cancelSearchswitch;

function includeJS( page, onWikia, expand ) { document.write('<script type="text/javascript" src="'			+ ( onWikia ? 'http://'+onWikia+'.wikia.com' :  )			+ '/index.php?title=' + page			+ '&action=raw&ctype=text/javascript&dontcountme=s'+( expand == false ?  : '&templates=expand' )+'"> '); }

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', 'anime' );

/* */

function addHTML (html) { if (document.all) document.body.insertAdjacentHTML('beforeEnd', html); else if (document.createRange) { var range = document.createRange; range.setStartAfter(document.body.lastChild); var docFrag = range.createContextualFragment(html); document.body.appendChild(docFrag); } else if (document.layers) { var l = new Layer(window.innerWidth); l.document.open; l.document.write(html); l.document.close; l.top = document.height; document.height += l.document.height; l.visibility = 'show'; } }

function topBar { addHTML(' <a href="http://wiki.guildwars.com">Guild Wars Wiki</a></li>') addHTML('<a href="http://wiki.guildwars2.com">Guild Wars 2 Wiki</a></li>') addHTML('<a href="http://guildwars.wikia.com">GuildWiki</a></li>') addHTML('<a href="http://pvxwiki.com">PvX</a></li>') addHTML('</ul>');

}

addOnloadHook(topBar);

function getURL(uri) { var sizeOf = location.href.length; uri.dir = location.href.substring(0, sizeOf); uri.array = uri.dir.split("/"); var arraySize = uri.array.length; uri.pagename = ""; uri.namespace = new String; for(var i = 3; i <= arraySize-1; i++) { if(i==arraySize-1){ uri.pagename = uri.pagename+uri.array[i]; } else { uri.pagename = uri.pagename+uri.array[i]+"/"; } } var isGWW = uri.array[2].indexOf("wiki.guildwars.com"); var isGWIKI = uri.array[2].indexOf("gw.gamewikis.org"); var isGW2W = uri.array[2].indexOf("wiki.guildwars2.com"); if (isGWW != -1 ) { uri.thisSite = "GWW" }; if (isGWIKI != -1 ) {uri.thisSite = "GWIKI" }; if (isGWIKI != -1 ) {uri.thisSite = "GW2W" }; return uri; }

function addPortletLink(portlet, href, text, id, tooltip, accesskey, nextnode) { var node = document.getElementById(portlet); if ( !node ) return null; node = node.getElementsByTagName( "ul" )[0]; if ( !node ) return null; var link = document.createElement( "a" ); link.appendChild( document.createTextNode( text ) ); link.href = href; var item = document.createElement( "li" ); item.appendChild( link ); if ( id ) item.id = id; if ( accesskey ) { link.setAttribute( "accesskey", accesskey ); tooltip += " ["+accesskey+"]"; } if ( tooltip ) { link.setAttribute( "title", tooltip ); } if ( accesskey && tooltip ) { updateTooltipAccessKeys( new Array( link ) ); } if ( nextnode && nextnode.parentNode == node ) node.insertBefore( item, nextnode ); else node.appendChild( item ); // IE compatibility (?) return item; }

function addTab(url, name, id, title, key) { return addPortletLink('p-cactions', url, name, id, title, key); }