User:SuperSajuuk/wikia.js

// // Personal JS: SuperSajuuk // Last Modified: 31st December 2014, 20:55 // // This is a personal testing ground for various // JS and jQuery enhancements coded by // SuperSajuuk. You may copy any code below to your // own wikia.js files. // // Any jQuery/JS requests should be posted on // my talkpage. // // Enjoy! //

(function (window, $, mw) {	"use strict";       // Add an "Edit Page" link on archives.        var page = wgTitle;        var pieces = page.search("Archive");        if(pieces > -1) {             $(".WikiaPageHeader h2 a").last.after('  |  Edit This Archive');        }

// Adds a quick "edit" button on talkpages (but not pages which have "Edit This Archive" on them) if(mw.config.get('wgNamespaceNumber') === 1 && pieces === -1) { $(".WikiaPageHeader nav.wikia-menu-button").before(' Edit		'); }

// Adds a "Go to Top" link at the bottom of the thread $("#WallTooltipMeta").before(' Go To Top ');

// For quicker removal of redlinks, hide .svg links from WantedPages if(mw.config.get('wgPageName') === "Special:WantedPages") { $("li:contains('.svg')").remove; }

// Redirect the popup uploader to Special:Upload $(window).load(function {              $("a.wikia-button.upphotos").click(function { setTimeout(function {                           window.location.href = "/wiki/Special:Upload";                      },2500); });       });

// Some forum stuff. // Replace the New Thread block with a notice in specific boards. if(mw.config.get('wgTitle') === "Naruto Discussions") { $(".ForumNewMessage").remove; $(".board-description").after(" "); }       // Are we viewing threads? if(mw.config.get('wgNamespaceNumber') === 1201) { // Reconfigure the threads if they match the below conditions. $("div.BreadCrumbs a").filter(function {                     if((/Naruto Discussions/i).test($(this).text)) {                              $("li.new-reply").remove;                             // Add the notice.                             $("div#Wall").before(" ");

// Only remove the edit functionality for non sysops/forum-ops. if(({sysop: 0, forumadmin: 0})[mw.config.get('wgUserGroups')] === 1) { $("div.buttons a:contains('Edit')").removeClass("edit-message").removeAttr("href").bind("click", function { alert("Sorry, you can't edit posts in closed boards. Please contact an administrator."); }); }                     }               });        } }(window, jQuery, mediaWiki));