MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */

(function(window, $, mw) {   "use strict";

// Bulk loading scripts. // scriptList are scripts to load everywhere // pageScriptList are scripts which only certain pages need. var scriptList = [], pageScriptList = []; window.UserTagsJS = { tags: { bureaucrat: { u: 'Bureaucrat', /*link: 'Project:Bureaucrats'*/ }, sysop: { u: 'Sysop', /*link: 'Project:Sysops'*/ }, 'content-moderator': { u: 'Class Representative', /*link: 'Project:Content moderator'*/ }, rollback: { u: 'Rollback', /*link: 'Project:Rollback'*/ }, translator: { u: 'Translator', /*link: 'Project:Translation policy',*/ order: -1 / 0 }, newuser: { u: 'New User' }, 'autoconfirmed-user': { u: 'Active User', /*link: 'Project:Autoconfirmed users'*/ }, user: { u: 'User', /*link: 'Project:Autoconfirmed users'*/ }, inactive: { u: 'Inactive User', title: 'The user hasn\'t edited for last 30 days' },           nonuser: { u: 'Non-User', title: 'The user hasn\'t been granted membership on the wiki yet' },           blocked: { u: 'Blocked', link: 'Project:Blocking policy' },       },        modules: { stopblocked: false, inactive: 30, mwGroups: [ 'bureaucrat', 'rollback', 'sysop', 'content-moderator', 'autoconfirmed-user', 'user', 'bot', 'bot-global', 'blocked', 'nonuser' ],           autoconfirmed: true, newuser: true, metafilter: { 'content-moderator': ['bureaucrat'], rollback: ['bureaucrat', 'content-moderator'], threadmoderator: ['content-moderator'], user: [ 'bureaucrat', 'sysop', 'content-moderator', 'rollback', 'translator', 'newuser', 'inactive', 'blocked' ],               bot: ['bot-global'], newuser: ['inactive'], bureaucrat: ['inactive'], sysop: ['inactive'], founder: ['inactive'], blocked: ['inactive'], },       },    };

/* Add custom groups to several users */ UserTagsJS.modules.custom = { 'Bagwis': ['Sysop'], 'Aphrodite_Belleza': ['Sysop'], 'TG_RBB': ['Sysop'], };

// Configure AjaxRC (window.ajaxPages = (window.ajaxPages || [])).push(       "Special:RecentChanges",        "Special:Watchlist",        "Special:Log",        "Special:Contributions",        "Special:NewFiles",        "Special:NewPages",        "Special:ListFiles",        "Special:WikiActivity",        "Special:Images"    ); window.AjaxRCRefreshText = 'Auto-Refresh'; window.AjaxRCRefreshHoverText = 'Automatically refresh every 60secs'; window.ajaxCallAgain = ($.isArray(window.ajaxCallAgain) && window.ajaxCallAgain) || [];

// ArchiveTool window.archiveListTemplate = 'ArchiveList'; window.archivePageTemplate = 'ArchivePage';

// Custom Special:[Multiple]Upload UI   if (({ Upload: 1, MultipleUpload: 1 })[mw.config.get('wgCanonicalSpecialPageName')] === 1) { pageScriptList.push('MediaWiki:Common.js/FairUseUpload.js'); }

// Add custom class for styling long list of refs if ($('.references li').length > 9) $('.references').addClass('compactreferences');

// SMW default popup is broken in wikia // Use custom modal $('.ultisup-image-popup a').click(function(ev) {       ev.preventDefault;        $.showCustomModal(this.title, '', { width: 1000 });       $("#ultisup-load").parent.load(this.href + " #gallery-0");    });

// Oasis-only scripts if (mw.config.get('skin') === 'oasis') { // Template adder on file pages if (mw.config.get('wgCanonicalNamespace') === 'File') $(function {               if ($.inArray("autoconfirmed", mw.config.get("wgUserGroups")) === -1)                    return;

var Options = { '': 'Unlicensed image', '': 'No Fairuse info', '': 'Unused image', '': 'Poor name' },                   tempOptStr = '';

for (var i in Options) { tempOptStr += '' + Options[i] + ' '; }

var html = '' + tempOptStr + ' Add template'; $('.comments').after(html); $('#templateSubmit').click(function {                   $(this).html('');                    new mw.Api.post({ format: 'json', action: 'edit', title: mw.config.get('wgPageName'), token: mw.user.tokens.get('editToken'), summary: 'Adding template: ' + $('#FileTemplateAdder').val, minor: true, prependtext: $('#FileTemplateAdder').val + "\n" })                       .done(function { $('#templateSubmit').text('Add this Template too!'); new BannerNotification('Template: ' + $('#FileTemplateAdder').val + ' Added Successfully', 'confirm').show; })                       .fail(function { new BannerNotification('Template addition failed!', 'error').show; });               });            });    }

// Import all scripts in bulk (and minified) window.importArticles({       type: 'script',        articles: scriptList    }, {        type: 'script',        articles: pageScriptList    }); });

/* Adds icons to page header bottom border */ $(function {   if (skin == "oasis" || skin == "wikia") {        $('.WikiaPageHeader').append($('#icons'));        $('#icons').css({ 'position': 'absolute', 'right': '0', 'bottom': '-1.2em' });   } });

/* Parent Tab */ if ($(".parenttab").length) { $("#contentSub, .header-column.header-title > h2").hide; }

/* On Interlanguage Hover Icon */ $(function{ // Setup language selector $('#langdiv img').each(function{ $(this).css({'height':'auto','width':'150px'}); }); $('#langdiv img').hover(function{ $(this).animate({width:'180px'},'fast'); $('#langdiv span').text($(this).attr('alt')); },function{ $('#langdiv span').text('The Promised Neverland Wiki Interlanguage'); $(this).animate({width:'150px'},'fast'); }); });