User:Rapta/guildwatchfuncs.js

// Start functions. These will be in a seperate file. function handleRevert(idto,pageurl) { if (location.href.indexOf("&revert=true&oldid=") > -1) { location.href = pageurl+'&action=edit&&revert=true&oldid='+idto; document.getElementById('wpSummary').value = "reverting: to oldid "+idto+"; using GuildWatch"; document.getElementById('editform').submit; } } function handleUserTalk { var a = ""; var b = "~"; var c = ""; var img = ""; if (location.href.indexOf("&action=edit&dotag=true&acn=notimgdel") > -1) { img = prompt('Enter the image name below. Do not include any Wiki mark-up (such as "Image:").\nLeave blank for a standard message.'," "); //Modify form if (img == " ") { 			document.getElementById('wpTextbox1').value = document.getElementById('wpTextbox1').value+"== Guild Image ==\n\nAn image you recently uploaded does not comply with the Guild Wars Wiki image naming policy and has been tagged for deletion. Please feel free to re-upload the image under a correct name. Thanks, "+a+a; } 		else { 			document.getElementById('wpTextbox1').value = document.getElementById('wpTextbox1').value+"== Guild Image: "+img+" ==\n\nThe image you recently uploaded (Image:"+img+") does not comply with the Guild Wars Wiki image naming policy and has been tagged for deletion. Please feel free to re-upload the image under a correct name. Thanks, "+a+a; } 		document.getElementById('wpSummary').value = "notifying: guild image deletion; using GuildWatch"; document.getElementById('editform').submit; } 	else if(location.href.indexOf("&action=edit&dotag=true&acn=imgdelorph") > -1) { img = prompt('Enter the image name below. Do not include any Wiki mark-up (such as "Image:").\nLeave blank for a standard message.'," "); //Modify form if (img == " ") { 			document.getElementById('wpTextbox1').value = document.getElementById('wpTextbox1').value+"== Orphaned Image ==\n\nAn image you uploaded has been discovered to be orphaned and has been tagged for deletion. If you had an article linking to this image, a different one might now be being used instead - if there is an article that you think it would fit on, feel free to remove the deletion notice and give it a home! Thanks, "+a+a; } 		else { 			document.getElementById('wpTextbox1').value = document.getElementById('wpTextbox1').value+"== Orphaned Image: "+img+" ==\n\nThe image you uploaded (Image:"+img+") has been discovered to be orphaned and has been tagged for deletion. If you had an article linking to this image, a different one might now be being used instead - if there is an article that you think it would fit on, feel free to remove the deletion notice and give it a home! Thanks, "+a+a; } 		document.getElementById('wpSummary').value = "notifying: orphaned image deletion; using GuildWatch"; document.getElementById('editform').submit; } 	else if(location.href.indexOf("&action=edit&dotag=true&acn=notusrimgdel") > -1) { img = prompt('Enter the image name below. Do not include any Wiki mark-up (such as "Image:").\nLeave blank for a standard message.'," "); //Modify form if (img == " ") { 			document.getElementById('wpTextbox1').value = document.getElementById('wpTextbox1').value+"== User Image ==\n\nAn image you recently uploaded does not comply with the Guild Wars Wiki user image naming policy and has been tagged for deletion. Feel free to re-upload the image under a correct name. Thanks, "+a+a; } 		else { 			document.getElementById('wpTextbox1').value = document.getElementById('wpTextbox1').value+"== User Image: "+img+" ==\n\nThe image you recently uploaded (Image:"+img+") does not comply with the Guild Wars Wiki user image naming policy and has been tagged for deletion. Feel free to re-upload the image under a correct name. Thanks, "+a+a; } 		document.getElementById('wpSummary').value = "notifying: user image deletion; using GuildWatch"; document.getElementById('editform').submit; } } function handleImage { var a = ""; var b = "~"; var c = ""; if (location.href.indexOf("&action=edit&dotag=true&acn=gldimgdel") > -1) { //Modify form document.getElementById('wpTextbox1').value = c+"delete|naming, see Guild_Wars_Wiki:Guild_pages"+d+"\n\n"+document.getElementById('wpTextbox1').value; document.getElementById('wpSummary').value = "tagging: delete, guild-image naming; using GuildWatch"; document.getElementById('editform').submit; } 	else if (location.href.indexOf("&action=edit&dotag=true&acn=imgdelorph") > -1) { //Modify form document.getElementById('wpTextbox1').value = c+"delete|orphaned (unused) image"+d+"\n\n"+document.getElementById('wpTextbox1').value; document.getElementById('wpSummary').value = "tagging: delete, orphaned; using GuildWatch"; document.getElementById('editform').submit; } 	else if (location.href.indexOf("&action=edit&dotag=true&acn=usrimgdel") > -1) { //Modify form document.getElementById('wpTextbox1').value = c+"delete|naming, see Guild_Wars_Wiki:User_page"+d+"\n\n"+document.getElementById('wpTextbox1').value; document.getElementById('wpSummary').value = "tagging: delete, user-image naming; using GuildWatch"; document.getElementById('editform').submit; } 	else if (location.href.indexOf("&action=edit&dotag=true&acn=usrimgtag") > -1) { //Modify form document.getElementById('wpTextbox1').value = c+"user image"+d+"\n\n"+document.getElementById('wpTextbox1').value; document.getElementById('wpSummary').value = "tagging: User Image with template; using GuildWatch"; document.getElementById('editform').submit; } 	else if (location.href.indexOf("&action=edit&dotag=true&acn=gldimgtag") > -1) { //Modify form document.getElementById('wpTextbox1').value = c+"guild image"+d+"\n\n"+document.getElementById('wpTextbox1').value; document.getElementById('wpSummary').value = "tagging: Guild Image with template; using GuildWatch"; document.getElementById('editform').submit; } 	else if (location.href.indexOf("&action=edit&dotag=true&acn=anetimgtag") > -1) { //Modify form document.getElementById('wpTextbox1').value = c+"arenanet image"+d+"\n\n"+document.getElementById('wpTextbox1').value; document.getElementById('wpSummary').value = "tagging: ArenaNet Image with template; using GuildWatch"; document.getElementById('editform').submit; } }

function handleGuild { var a = ""; var b = "~"; var c = ""; if (location.href.indexOf("&action=edit&dotag=true&acn=gldclnup") > -1) { //Modify form document.getElementById('wpTextbox1').value = c+"guild cleanup|"+a+a+b+d+"\n\n"+document.getElementById('wpTextbox1').value; document.getElementById('wpSummary').value = "tagging: guild cleanup; using GuildWatch"; document.getElementById('editform').submit; } } function handleTagDelete { // Get the reason from the user var a = ""; var b = "~"; var c = ""; var reason = ""; var msg = ""; if (location.href.indexOf("&action=edit&dotag=true&acn=tagdel") > -1) { reason = prompt("Enter the reason for deletion.\n- You can use any deletion category codes (e.g. A2, G1 - see GWW:DP)\n- You can enter a custom reason\n- You can enter a space to give no reason\n-You can leave blank to cancel",""); // switch the reason variable to see what the user entered switch (reason) { case 'G1': msg = c+"delete|Speedy G1: pure vandalism/patent nonsense"+d; break; case 'G2': msg = c+"delete|Speedy G2: test page"+d; break; case 'G3': msg = c+"delete|Speedy G3: good faith request by sole editor"+d; break; case 'G4': msg = c+"delete|Speedy G4: housekeeping/planned maintenance"+d; break; case 'G5': msg = c+"delete|Speedy G5: attack page"+d; break; case 'G6': msg = c+"delete|Speedy G6: recreation of explicitly deleted material"+d; break; case 'G7': msg = c+"delete|Speedy G7: arbiration committee decision"+d; break; case 'A1': msg = c+"delete|Speedy A1: an article with no appropriate information on its topic"+d; break; case 'A2': msg = c+"delete|Speedy A2: an article comprised solely of upcoming events with no verification"+d; break; case 'R1': msg = c+"delete|Speedy R1: a page that redirects to the User: or Guild: namespace"+d; break; case 'R2': msg = c+"delete|Speedy R2: a redirect for an implausible typo or search term"+d; break; case 'I1': msg = c+"delete|Speedy I1: redundant/superceded image"+d; break; case 'I2': msg = c+"delete|Speedy I2: corrupt or unviewable image"+d; break; case 'I3': msg = c+"copyvio"+d; break; case 'I4': msg = c+"delete|Speedy I4: a user image that violoates user space policy"+d; break; case 'C1': msg = c+"delete|Speedy C1: empty or unused category"+d; break; case 'U1': msg = c+"delete|Speedy U1: a user page that the autor would like deleting"+d; break; case 'U2': msg = c+"delete|Speedy U2: a user page for a non-existant user"+d; break; case null: history.go(-1); break; case '': history.go(-1); break; default: msg = c+"delete|"+reason+d; break; }				if ((reason == null) || (reason == '')) {}				else {					// Modify the form to reflect the user's choice document.getElementById('wpTextbox1').value = msg+"\n\n"+document.getElementById('wpTextbox1').value; // De-linking summary msg = msg.replace(/\[\[:/,""); msg = msg.replace(/\[\[/,""); msg = msg.replace(/\]\]/,""); document.getElementById('wpSummary').value = "tagging: delete, "+msg.substring(0,20)+"... ; using GuildWatch"; document.getElementById('editform').submit; }			} }