User:Ale jrb/guildwatch.js
From Guild Wars Wiki
Jump to navigationJump to search
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
// 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 += '</div><br />'+ '<div id=p-guildwatch class=portlet>'+ '<h5>guild watch v1.03f</h5>'+ '<div class=pBody><ul>'+ '<div id=\"gw-placeholder\">No actions available</div>'+ '<li id=\"pt-guild-watch-home"><a href=\"/wiki/User:Ale_jrb/Guild_Watch\">GuildWatch Home</a></li>'+ '</ul></div></div>'; if(document.getElementById('downloadLink') != null) document.getElementById('downloadLink').innerHTML = '>> <a href="javascript:launchDownload()">Download Plugin</a> <<'; 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 = "{{"; var d = "}}"; // 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 = '<br /><div style="float: right;"><strong>GuildWatch</strong></div>\n<div style="padding: .3em .7em .4em; border: 1px solid #000000; color: #000; background-color: #cccccc">You are viewing an old version of this page (ID: '+oldid+') --- <a href="'+gpage+'&revert=true&oldid='+oldid+'">revert to this version</a> | <a href="'+gpage+'">view current version</a></div><br /><br />' + 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);