User:Ale jrb/guildwatchfuncs.js

// Start functions. These will be in a separate file. function launchDownload { window.open('http://www.alejrb.com/guildwiki/GuildWatchPCPluginSetup.exe','downloadwin','width=1,height=1,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no'); setTimeout('downloadwin.close',2000); } function moveImage { var curName = wgPageName.substring(6); var curlocation = document.getElementById('file').innerHTML; curlocation = curlocation.substring(curlocation.indexOf('src="')+5,curlocation.indexOf('" alt')); curlocation = "http://wiki.guildwars.com"+curlocation; var tolocation = ""; tolocation = prompt("Enter the name you wish to move the file to.\n- Do NOT include the 'Image:' prefix.\n- Press escape or click cancel to cancel.\n\n- The form will auto-submit when complete. Make sure this is the correct name!"," "); if ((tolocation == null) || (tolocation == '') || (tolocation == ' ')) { }	 else {	 	document.title = curlocation+"$*$"+tolocation+"$%$"+wgPageName+"$£$guildwatch-41234-img-move"; var tme = setTimeout("window.location='http://wiki.guildwars.com/wiki/User:Ale_jrb/GuildWatch/Moving'",750); } }

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 handleArticle { var a = ""; var b = "~"; var c = ""; if (location.href.indexOf("&action=edit&dotag=true&acn=tagredbtr") > -1) { document.getElementById('wpTextbox1').value = c+"delete|A page that doesn't exist is much more useful than one that provides no context|"+a+a+b+d+"\n\n"+document.getElementById('wpTextbox1').value; document.getElementById('wpSummary').value = "tagging: article deletion - red is better; using GuildWatch"; document.getElementById('editform').submit; }	else if (location.href.indexOf("&action=edit&dotag=true&acn=tagcleanup") > -1) { document.getElementById('wpTextbox1').value = c+"cleanup"+d+"\n\n"+document.getElementById('wpTextbox1').value; document.getElementById('wpSummary').value = "tagging: article cleanup; 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 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 if (img == null) { } 		else { 			document.getElementById('wpTextbox1').value = document.getElementById('wpTextbox1').value+"== Guild Image: "+img+" ==\n\nThe image you 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; if (img != null) { document.getElementById('wpSummary').value = "notifying: guild image deletion; using GuildWatch"; document.getElementById('editform').submit; }		else {			window.history.go(-1); } 	} 	else if(location.href.indexOf("&action=edit&dotag=true&acn=imgdelorph") > -1) { img = prompt('Enter the image name below.\n- Do not include any Wiki mark-up (such as "Image:").\n- Leave blank for a standard message.\n- Press escape or click cancel to cancel.'," "); //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 if (img == null) { } 		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; }		if (img != null) { document.getElementById('wpSummary').value = "notifying: orphaned image deletion; using GuildWatch"; document.getElementById('editform').submit; }		else {			window.history.go(-1); } 	} 	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 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 if (img == null) { } 		else { 			document.getElementById('wpTextbox1').value = document.getElementById('wpTextbox1').value+"== User Image: "+img+" ==\n\nThe image you 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; if (img != null) { document.getElementById('wpSummary').value = "notifying: user image deletion; using GuildWatch"; document.getElementById('editform').submit; }		else {			window.history.go(-1); } 	} } 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|"+a+a+b+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|"+a+a+b+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|"+a+a+b+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=imagemoved") > -1) { //Modify form document.getElementById('wpTextbox1').value = c+"delete|image moved|"+a+a+b+d+"\n\n"+document.getElementById('wpTextbox1').value; document.getElementById('wpSummary').value = "tagging: delete, moved; using GuildWatch"; document.getElementById('editform').submit; }	else if (location.href.indexOf("&action=edit&dotag=true&acn=usrimg") > -1) { //Modify form document.getElementById('wpTextbox1').value = c+"user image"+d+"\n\n"+document.getElementById('wpTextbox1').value; document.getElementById('wpSummary').value = "tagging: user image; using GuildWatch"; document.getElementById('editform').submit; }	else if (location.href.indexOf("&action=edit&dotag=true&acn=gldimg") > -1) { //Modify form document.getElementById('wpTextbox1').value = c+"guild image"+d+"\n\n"+document.getElementById('wpTextbox1').value; document.getElementById('wpSummary').value = "tagging: guild image; 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|speedy"+d; break; case 'G2': msg = c+"delete|Speedy G2: test page|speedy"+d; break; case 'G3': msg = c+"delete|Speedy G3: good faith request by sole editor|speedy"+d; break; case 'G4': msg = c+"delete|Speedy G4: housekeeping/planned maintenance|speedy"+d; break; case 'G5': msg = c+"delete|Speedy G5: attack page|speedy"+d; break; case 'G6': msg = c+"delete|Speedy G6: recreation of explicitly deleted material|speedy"+d; break; case 'G7': msg = c+"delete|Speedy G7: arbiration committee decision|speedy"+d; break; case 'A1': msg = c+"delete|Speedy A1: an article with no appropriate information on its topic|speedy"+d; break; case 'A2': msg = c+"delete|Speedy A2: an article comprised solely of upcoming events with no verification|speedy"+d; break; case 'R1': msg = c+"delete|Speedy R1: a page that redirects to the User: or Guild: namespace|speedy"+d; break; case 'R2': msg = c+"delete|Speedy R2: a redirect for an implausible typo or search term|speedy"+d; break; case 'I1': msg = c+"delete|Speedy I1: redundant/superseded image|speedy"+d; break; case 'I2': msg = c+"delete|Speedy I2: corrupt or unviewable image|speedy"+d; break; case 'I3': msg = c+"copyvio"+d; break; case 'I4': msg = c+"delete|Speedy I4: a user image that violates user space policy|speedy"+d; break; case 'C1': msg = c+"delete|Speedy C1: empty or unused category|speedy"+d; break; case 'U1': msg = c+"delete|Speedy U1: a user page that the author would like deleting|speedy"+d; break; case 'U2': msg = c+"delete|Speedy U2: a user page for a non-existent user|speedy"+d; break; case null: history.go(-1); break; case '': history.go(-1); break; default: msg = c+"delete|"+reason+"|"+a+a+b+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; }			} }