User:Rapta/guildwatch.js

// All functions on this page were written by me (Ale_jrb). If you want to use them, please ask first.

// This function handles adding the extra portlet to the sidebar.

function addBar { document.getElementById('p-navigation').innerHTML += ' '+ ' '+  ' guild watch v1.02a '+ ' '+ 'No actions available '+ 'GuildWatch Home'+ ' '; }

// The guildWatch function handles the calling of the functions that add the links, allowing them // to be stored in seperate files. function guildWatch { // Declare the Wiki-markup var a = ""; var b = "~"; var c = ""; // Declare other, misc variables var gpage = wgServer + "/index.php?title=" + wgPageName; var logout = document.getElementById( 'pt-logout' ); var gwbase = document.getElementById( 'gw-placeholder' ); var img = ""; // First, non-conditional links are added - a page can satify several of these at once if ((location.href.indexOf("User_talk:") == -1) && (location.href.indexOf("Special:") == -1)) { // N-C satisfied - set actions available document.getElementById('gw-placeholder').innerHTML = "---"; // Add links to the portlet addPortletLink("p-guildwatch", gpage + "&action=edit&dotag=true&acn=tagdel", "T: Delete (reason)", "pt-tag-delete", "Tag this page as being a candiate for deletion", "", gwbase); // Run the handler functions handleTagDelete; }	if ((location.href.indexOf("User_talk:") == -1) && (location.href.indexOf("Special:") == -1) && (location.href.indexOf("&oldid=") > -1)) { // N-C satisfied - set actions available document.getElementById('gw-placeholder').innerHTML = "---"; // We need to calculate some variables var url = location.href; var oldid = ""; var oldidstart = 0; oldidstart = url.indexOf("oldid="); oldid = url.substring(oldidstart+6); // Show box document.getElementById('contentSub').innerHTML = ' GuildWatch \n You are viewing an old version of this page (ID: '+oldid+') --- revert to this version | view current version

' + document.getElementById('contentSub').innerHTML; // Run the handler functions handleRevert(oldid,gpage); } 	// Next, conditional links are added - a page can only satisfy one of these at a time if (location.href.indexOf("Guild:") > -1) { 		document.getElementById('gw-placeholder').innerHTML = "---"; // Add the links to the portlet addPortletLink("p-guildwatch", gpage + "&action=edit&dotag=true&acn=gldclnup", "T: Guild Cleanup", "pt-tag-guild", "Tag this Guild Page as requiring cleanup", "", gwbase); // Run the handler functions handleGuild; } 	else if (location.href.indexOf("Image:") > -1) { 		document.getElementById('gw-placeholder').innerHTML = "---"; // Add the links to the portlet addPortletLink("p-guildwatch", gpage + "&action=edit&dotag=true&acn=gldimgdel", "T: Gld Img Nmg", "pt-del-guild-img", "Tag this guild-related image as requiring deletion for naming inconsistencies", "", gwbase); addPortletLink("p-guildwatch", gpage + "&action=edit&dotag=true&acn=imgdelorph", "T: Delete (orphaned)", "pt-del-img-orph", "Tag this image as requiring deletion because it is orphaned", "", gwbase); addPortletLink("p-guildwatch", gpage + "&action=edit&dotag=true&acn=usrimgdel", "T: Usr Img Nmg", "pt-del-user-img", "Tag this user-related image as requiring deletion for naming inconsistencies", "", gwbase); addPortletLink("p-guildwatch", gpage + "&action=edit&dotag=true&acn=usrimgtag", "T: Usr Img Tag", "pt-tag-user-img", "Add the user image template", "", gwbase); addPortletLink("p-guildwatch", gpage + "&action=edit&dotag=true&acn=gldimgtag", "T: Gld Img Tag", "pt-tag-guild-img", "Add the guild image template", "", gwbase); addPortletLink("p-guildwatch", gpage + "&action=edit&dotag=true&acn=anetimgtag", "T: ANet Img Tag", "pt-tag-anet-img", "Add the arenanet image template", "", gwbase); // Run the handler functions handleImage; } 	else if (location.href.indexOf("User_talk:") > -1) { 		document.getElementById('gw-placeholder').innerHTML = "---"; // Add the links to the portlet addPortletLink("p-guildwatch", gpage + "&action=edit&dotag=true&acn=notimgdel", "N: Gld Img Del Tgd ", "pt-del-guild-img-not", "Notify this user that a Guild Image has been tagged for deletion for naming inconsistencies", "", gwbase); addPortletLink("p-guildwatch", gpage + "&action=edit&dotag=true&acn=imgdelorph", "N: Img Del Tgd Orph", "pt-del-img-not-orph", "Notify this user that an image has been tagged for deletion because it has been orphaned", "", gwbase); addPortletLink("p-guildwatch", gpage + "&action=edit&dotag=true&acn=notusrimgdel", "N: Usr Img Del Tgd", "pt-del-user-img-not", "Notify this user that a User image has been tagged for deletion for naming inconsistencies", "", gwbase); // Run the handler functions handleUserTalk; } }

addOnloadHook(addBar); addOnloadHook(guildWatch);