MediaWiki:Common.js

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

/* These scripts must always be the very first executed */

/* Spoiler Alert */ importScriptPage('MediaWiki:SpoilerAlert.js');

/* Next chapter release countdown clock */ importScriptPage('MediaWiki:ChapterCountdown.js');

/* Scripts executed after the HTML document is loaded */

$(function {

/* General */

/* Inserts link to blogs in navigation bar */ $('.subnav-2').first.append('Blogs');

/* Homepage */

if (mw.config.get('wgIsMainPage') === true) {

/* Random Episode */ $.ajax({			dataType: 'text',			data: {				action: 'parse',				format: 'xml',				disablepp: '1',				prop: 'text',				text: ''				},			url: '/api.php',			success: function(data) {				$('div#RandomEpisode').html($('text', $(data)[1]).text );			}		}); /* Calendar */ $.ajax({			dataType: 'text',			data: {				action: 'parse',				format: 'xml',				disablepp: '1',				prop: 'text',				text: ''				},			url: '/api.php',			success: function(data) {				$('div#Calendar').html($('text', $(data)[1]).text );			}		});

}

});

/* Scripts executed after the whole page is loaded (including images and other objects) */

$(window).load(function{

'use strict';

/* Moves Community, Trending Fandom Articles, Insights and HotSpots modules to the bottom of the sidebar */ $('#WikiaRail').append($('.community-page-entry-point-module, #RECIRCULATION_RAIL, .insights-module, .HotSpotsModule'));

/* Adds option to refresh page to edit dropdown */ var url = '//' + location.host + location.pathname + '?action=purge'; $('.WikiaMenuElement').append('Refresh');

/* Adds option to hide spoilers to the row of buttons */ if ($.inArray('Spoilers', mw.config.get('wgCategories')) > -1) { $('#WikiaPageHeader').append('Rehide spoilers'); $('#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: -7 },       sysop: { link: 'Project:Administrators', order: -6 },       threadmoderator: { link:'Project:Discussions Moderators', order: -5 },       'content-moderator': { u:'Content Moderator', link:'Project:Content Moderators', order: -4 },       chatmoderator: { link:'Project:Chat Moderators', order: -3 },       rollback: { u: 'Rollbacker', link: 'Project:Rollbackers', order: -2 },       reporter: { u:'Reporter', link:'Project:Reporters', order: -1 },       bot: { u:'Bot', link: 'Project:Bots' }

} };

// Adds users' MediaWiki groups to the internal group list UserTagsJS.modules.mwGroups = [ 'bureaucrat', 'sysop', 'threadmoderator', 'content-moderator', 'chatmoderator', 'rollback', 'bot' ];

// Custom ranks UserTagsJS.modules.custom = { 'Sim0n2170': ['reporter'], 'Manuel de la Fuente': ['reporter'] };

// Removes certain groups UserTagsJS.modules.metafilter = { 'sysop': ['bot'] // Removes admin tag from all bots };

// Marks users as inactive if they haven't edited in a month or more UserTagsJS.modules.inactive = 30;

/* 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: [        // Local        'MediaWiki:NeedHelp.js', // Module 'Need Help?'        'MediaWiki:SocialModule.js', // Social Module        'MediaWiki:SocialModule2.js', // Homepage's Social Module        'MediaWiki:ShowHide.js', // Show/Hide        // External        'w:c:dev:Countdown/code.js', // Countdown        '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:BackToTopButton/code.js', // Adds 'Back to top' button in pages        '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 ] });