User:Ale jrb/guildwatch.js

// The guildWatch function handles the calling of the functions that add the links, allowing them // to be stored in seperate files. // This function handles adding the extra portlet to the sidebar.

function addBar { document.getElementById('p-navigation').innerHTML += ' '+ ' '+  ' guild watch v1.03f '+ ' '+ 'No actions available '+ 'GuildWatch Home'+ ' '; if(document.getElementById('downloadLink') != null) document.getElementById('downloadLink').innerHTML = '&gt;&gt; Download Plugin &lt;&lt;'; if(location.href.indexOf("User:Ale_jrb/GuildWatch/Moving") > -1) document.title = "guildwatch-12872-img-move"+document.title }

// 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 = ""; // Check if we are viewing a protected page var prot = document.getElementById('p-cactions').innerHTML; if (prot.indexOf("ca-viewsource") > -1) {		document.getElementById('gw-placeholder').innerHTML = "Viewing a protected page"; }	else {		// 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=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=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=usrimg", "T: User Image", "pt-usr-img", "Tag this image as a user image", "", gwbase); addPortletLink("p-guildwatch", gpage + "&action=edit&dotag=true&acn=gldimg", "T: Guild Image", "pt-gld-img", "Tag this image as a guild image", "", gwbase); if (enableimgmove == true) addPortletLink("p-guildwatch", "javascript:moveImage", "M: Image", "pt-move-img", "Move this image from one location to another (required GuildWatch PC plugin)", "", 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=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); 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); // Run the handler functions handleUserTalk; }		else if (location.href.substring(7).indexOf(":") == -1) {			document.getElementById('gw-placeholder').innerHTML = "---"; // Add the links to the portlet addPortletLink("p-guildwatch", gpage + "&action=edit&dotag=true&acn=tagredbtr", "T: Red Better", "pt-del-red-better", "Tag this article for deletion because an empty page is better than one with no content", "", gwbase); addPortletLink("p-guildwatch", gpage + "&action=edit&dotag=true&acn=tagcleanup", "T: Cleanup", "pt-article-cleanup", "Tag this article for cleanup", "", gwbase); // Run the handler functions handleArticle; }	} }

addOnloadHook(addBar); addOnloadHook(guildWatch);