User:Galil/monobook.js

/**** 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';

/* Change the Quick links-link to the compact list instead  */ hookEvent('load', function {    var e = document.getElementById('n-Quick-links');     if (e)         e.firstChild.href = '/wiki/Quick_access_links/compact'; });

/** *  Makes the "Search" button use google search instead, while maintaining the functionality of the "Go" button. *   *  @author Johan Sköld [ User:Galil ] **/ function setupSearch { var searchButton = document.getElementById('mw-searchButton'); if (searchButton) { 		searchButton.type = 'button'; searchButton.onclick = function { var form = this.parentNode.parentNode; form.action = 'http://www.google.com/search'; form.method = 'get'; var searchInput   = document.getElementById('searchInput'); searchInput.name  = 'q'; searchInput.value += ' site:' + wgServer.replace(/https?:\/\//i, ''); form.submit; }; 	} } addOnloadHook(setupSearch);

/* =========================================================== *\ ** SkillCheck install file. ** ** Copyright (c) Alex Barley  2008. ** ** For help with this script, visit                           ** **          User:Ale_jrb/Scripts/SkillCheck               ** \* =========================================================== */ addScript('User:Ale jrb/Scripts/SkillCheck/skillcheck.js'); /* =========================================================== *\ ** If you are seeing this because you are uninstalling this   ** ** script, I'd love to know why. Let me know how it can be    ** ** improved at User_talk:Ale_jrb. ** \* =========================================================== */

/** *  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 = 'javascript:void(0);'; addEvent(link, 'click', function { wpReason.value = reason; }); link.appendChild(document.createTextNode(reason.replace(/\[\]*\|([^\*)\]\]/, '$1'))); 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', 'G1: Purely vandalism'); addReason('general', 'G2: Test page'); addReason('general', 'G3: Sole editor\'s request'); addReason('general', 'G4: Housekeeping'); addReason('general', 'G5: Attack page'); addReason('general', 'G6: Recreation of deleted page'); addReason('general', 'G7: Decision or conditional enforcement by arbitration committee.'); // articles if (wgCanonicalNamespace == '') { addList('article', 'Article speedy reasons'); addReason('article', 'A1: No appropriate information'); addReason('article', 'A2: Missing of verifiable source for the information'); addReason('article', 'A3: Incontrovertibly unrelated to both GW and GWW'); } 		// images if (wgCanonicalNamespace == 'Image') { addList('image', 'Image speedy reasons'); addReason('image', 'I1: Redundant/outdated image'); addReason('image', 'I2: Corrupt or outdated image'); } 		// categories if (wgCanonicalNamespace == 'Category') { addList('category', 'Category speedy reasons'); addReason('category', 'C1: Empty unused category'); } 		// users if (wgCanonicalNamespace == 'User' || (wgCanonicalNamespace == 'Image' && /^User/i.test(wgTitle))) { addList('user', 'User speedy reasons'); addReason('user', 'U1: User request'); addReason('user', 'U2: Nonexistent user'); addReason('user', 'U3: User image that violates the user space policy in content'); } 		// redirects addList('redirect', 'Redirect speedy reasons'); addReason('redirect', 'R1: Redirect to User/Guild/Talk namespace'); addReason('redirect', 'R2: Redirect for implausible typo or search term'); addReason('redirect', 'R3: Blatantly misleading redirect'); addReason('redirect', 'R4: Broken redirect'); // common reasons addList('common', 'Common deletion reasons'); addReason('common', 'Deletion uncontested after three days'); addReason('common', 'Copyright violation'); if (wgCanonicalNamespace == 'Image') { addReason('common', 'Guild image naming'); addReason('common', 'Orphaned image'); addReason('common', 'User image naming'); } else if (wgCanonicalNamespace == 'Guild') { addReason('common', 'Guild cleanup not performed within 7 days'); addReason('common', 'Inactive guild page'); } 	} }); /** *  End of "all code below this comment"!  **/