MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users browsing through any device */

/* Spoiler Alert */ // This script must always be the very first executed importScriptPage('MediaWiki:SpoilerAlert.js'); /* Scripts executed after the HTML document is loaded */

// Note: some scripts will not work here; e.g. all the sidebar modules // specifically inserted above or below another element (because they would // be executed before the sidebar finishes loading its contents). Only put // here scripts that do not depend of elements slow to load. Also, put only // very very small scripts that necessarily must be fired quickly, because // they could delay the execution of the following scripts.

$(function {   /* Inserts link to blogs in navigation bar */    $('.subnav-2').first.append('Blogs');    /* Moves Must Watch Videos to the bottom of the sidebar */    $('#WikiaRail').append($('#videosModule'));

/* Show/hide button */ var showHide = document.getElementById('showhide'); $('#showhide').click(function {       if (showHide.innerHTML === 'show') {            showHide.innerHTML = 'hide';        } else {            showHide.innerHTML = 'show';        }    });

/* tabindex attribute for .status-row (necessary for the Articles status table) */ var x = document.getElementsByClassName("status-row"); var i;   for (i = 0; i < x.length; i++) { x[i].tabIndex = "0"; } });

/* Scripts executed after the whole page is loaded (including images and other objects) */ $(window).load(function{   /* Inserts module "Need Help?" */    // This script must always be the first executed after the full page loads    var needHelp =    '' +        'Need Help? ' +        ' ' +        '' +            'Releases dates of anime, manga and other AoT related material? Check our Calendar .' +            'Questions, theories, something to discuss? Visit our Forum .</li>' +            'Opinions, news, thoughts to share? Write a Blog Post</a> .</li>' + 'Suggestions, complaints or another doubt? Contact an Administrator</a> .</li>' + '</ul>' + ' ';   // Most pages $('#WikiaRecentActivity').before(needHelp); // Inserts module above Recent Wiki Activity // Special:WikiActivity if(window.wgPageName === 'Special:WikiActivity') { $('.ChatModule').before(needHelp); // Inserts module above Chat }   // Forum and blogs if (wgUserGroups.indexOf('user') === -1) { // If it's an anonymous user $('.ForumActivityModule').first.before(needHelp); // Inserts module above either Forum Activity or Related Threads $('.WikiaBlogListingBox').before(needHelp); // Inserts module above Popular blog posts } else { // If it's a registered user if($('.ForumActivityModule').length) { // Checks if it's the forum $('.ChatModule').before(needHelp); // Inserts module above Chat }   }

/* Inserts Facebook module above Chat */ $('.ChatModule').before('<section class="module" id="facebookmodule"><iframe style="border: 0; height: 231px; margin: 0; overflow: hidden; width: 268px;" src="https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2FShingekiNoKyojinWiki&width=268&heightcolorscheme=light&show_faces=true&header=true&stream=false&show_border=true" scrolling="no" /> '); /* Moves HotSpot and Insights modules below Community Corner */ $('.CommunityCornerModule').after( $('.HotSpotsModule, .insights-module'));

/* Adds option to refresh page to edit dropdown */ var url = '//' + location.host + location.pathname; $('.WikiaMenuElement').append('Refresh</a></li>');

/* Adds option to hide spoilers to the row of buttons */ if ($.inArray("Spoilers", wgCategories) > -1) { $('#WikiaPageHeader').append('Rehide spoilers</a>'); $('#reset-spoilers').click(function {           localStorage.removeItem("spoilerCache");            location.reload;        }); } }); /* Imported scripts */

/* User tags */ //Core configuration window.UserTagsJS = { modules: {}, tags: { bureaucrat: { u:'Bureaucrat', link: 'Project:Administrators', order: -5 },       sysop: { link: 'Project:Administrators', order: -4 },       rollback: { link: 'Project:Rollback users', order: -3 },       threadmoderator: { u:'Forum moderator', link:'Special:Forum', order: -2 },       chatmoderator: { link:'Special:Chat', order: -1 },       bot: { u:'Bot', link: 'Project:Task Board/Bot' }   } }; //  Adds users' MediaWiki groups to the internal group list UserTagsJS.modules.mwGroups = [ 'bureaucrat', 'sysop', 'rollback', 'threadmoderator', 'chatmoderator', 'bot' ]; // Removes certain groups UserTagsJS.modules.metafilter = { 'sysop': ['bot'] // Removes admin tag from all bots }; /* AutoEditDropdown */ window.AutoEditDropdownConfig = { expandedAreaContribute: true, expandedAreaEdit: true }; /* Auto Refresh */ AjaxRCRefreshText = 'Auto-Refresh'; AjaxRCRefreshHoverText = 'Automatically refresh the page'; ajaxPages = [ 'Special:WikiActivity', 'Special:RecentChanges', 'Special:Log' ]; window.ajaxRefresh = 30000; /* AjaxDiff */ AjaxDiff = { expiry: "infinite", reason: "Vandalism" };

/* List of imports */ importArticles({   type: 'script',    articles: [        // ...        'w:c:dev:UserTags/code.js', // User tags        'u:dev:AjaxRC/code.js', // Auto Refresh        'u:dev:AjaxDiff/code.js', // Allows to inspect diffs and stay in WikiActivity        'u:dev:ReferencePopups/code.js', // Displays content of references on hover        'u:dev:Countdown/code.js', // Countdown clock        'u:dev:BackToTopButton/code.js', // Adds "Back to top" button in pages        'u:dev:DupImageList/code.js', // Creates list of duplicate images and videos        'u:dev:View_Source/code.js', // Adds "view source" link to edit dropdown        'u:dev:RevealAnonIP/code.js', // Replaces "a wikia contributor" with IP address        'u:dev:AutoEditDropdown/code.js', // Automatically opens edit menu on hover    ] });