User:Enar/monobook.js

/**** Guild Wars Wiki Tools 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';
 * (c) 2007 by Patrick Westerhoff [poke]

/** * Links in "user row" **/ function addTopLink(label, url) { var userpage = document.getElementById('pt-userpage'); if (userpage) { var link = document.createElement('a'); link.href = url; link.appendChild(document.createTextNode(label)); var li   = document.createElement('li'); li.appendChild(link);

userpage.parentNode.insertBefore(li, userpage.parentNode.firstChild); } } addOnloadHook(function {	/**	 * Format : addTopLink ('link label', 'link url');	 **/	addTopLink('gw2w:del', '/wiki/Guild Wars 2 Wiki:List of candidates for deletion');	addTopLink('policy', '/wiki/Guild Wars 2 Wiki:Policy');	addTopLink('patrol log', '/index.php?title=Special%3ALog&type=patrol&user=&page=');	addTopLink('All images', '/index.php?title=Special:Prefixindex&&from=User+Plingggggg&namespace=6');	addTopLink('All pages', '/index.php?title=Special:Prefixindex&&from=Plingggggg&namespace=2'); });

/** *  All code below this comment is used for adding relevant, categorized pre-defined reasons * on the deletion page. * *  @author Johan Sköld [ User:Galil ] **/ function addEvent(element, event, listener) { if (element.addEventListener) element.addEventListener(event, listener, false); else if (element.attachEvent) element.attachEvent('on'+event, listener); else element['on'+event] = listener; } function addList(id, label) { var wpReason = document.getElementById('wpReason'); if (wpReason) { var list = document.createElement('ul'); list.id = id; wpReason.parentNode.insertBefore(document.createTextNode(label), wpReason); wpReason.parentNode.insertBefore(list, wpReason); } } function addReason(listId, reason) { var wpReason = document.getElementById('wpReason'); if (wpReason) { var list = document.getElementById(listId); if (!list) throw new Error("List does not exist."); var link = document.createElement('a'); link.href = 'javas' + 'cript:void(0);'; addEvent(link, 'click', function { wpReason.value = reason; }); link.appendChild(document.createTextNode(reason)); var item = document.createElement('li'); item.appendChild(link); list.appendChild(item); } } addEvent(window, 'load', function {	if (/action=delete/i.test(document.location.search)) {                /**		 *  This is where the magic happens. The format is quite easy to understand but if		 *  you want help with it, feel free to ask me or poke as we both would probably be		 *  able to help.		 *		 *  To add a list:		 *      addList('list name', 'list label');		 * 		 *    * list name  = Unique name of the list. Can pretty much only contain letters,		 *                   numbers, underscores and dashes.		 *    * list label = Label of the list. This does not have to be unique.		 *		 *  To add a reason to a list:		 *      addReason('list name', 'reason label');		 *		 *    * list name    = The unique name of the list to add the reason to.		 *    * reason label = The actual reason. This is used both as label for the link 		 *                     and inserted into the reason box.		 **/ addList('general', 'General speedy reasons'); addReason('general', 'Purely vandalism'); addReason('general', 'Test page'); addReason('general', 'Sole editor\'s request'); addReason('general', 'Housekeeping'); addReason('general', 'Attack page'); addReason('general', 'Recreation of deleted page'); // articles if (wgCanonicalNamespace == '') { addList('article', 'Article speedy reasons'); addReason('article', 'No appropriate information'); addReason('article', 'No verifiable source'); addReason('article', 'Unrelated to Guild Wars 2'); }		// images if (wgCanonicalNamespace == 'Image') { addList('image', 'Image speedy reasons'); addReason('image', 'Redundant image'); addReason('image', 'Corrupt or unviewable image'); }		// categories if (wgCanonicalNamespace == 'Category') { addList('category', 'Category speedy reasons'); addReason('category', 'Empty unused category'); }		// users if (wgCanonicalNamespace == 'User' || (wgCanonicalNamespace == 'Image' && /^User/i.test(wgTitle))) { addList('user', 'User speedy reasons'); addReason('user', 'User request'); addReason('user', 'Non-existent user'); }		// common reasons addList('common', 'Common deletion reasons'); addReason('common', 'Deletion uncontested after three days'); addReason('common', 'Associated page deleted'); addReason('common', 'Move remnant'); addReason('common', 'Copyright violation'); } }); /** *  End of "all code below this comment"!  **/