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 = []; // User tags	window.UserTagsJS = {		tags: {			bureaucrat: { u:'Head Council', link: 'Project:Bureaucrats' },			sysop: { u:'Council', link: 'Project:Sysops' },			'content-moderator': { u:'Class Representative', link: 'Project:Content moderator' },			rollback: { u:'Class Representative', link: 'Project:Rollback' },			translator: { u:'Translator', link: 'Project:Translation policy', order: -1/0 },			newuser: { u:'New Student'},			'autoconfirmed-user': { u:'Active Student', link: 'Project:Autoconfirmed users'},			inactive: { u:'Inactive Student', title: 'The user hasn\'t edited for last 30 days'}		},		modules: {			stopblocked: false,			inactive: 30,			mwGroups: ['bureaucrat', 'rollback', 'sysop', 'content-moderator', 'autoconfirmed-user', 'bot', 'bot-global'], autoconfirmed: true, newuser: true, },           metafilter: { 'content-moderator': ['bureaucrat'], rollback: ['bureaucrat'], 'threadmoderator': ['content-moderator'], bot: ['bot-global'] },	};	/* Add custom groups to several users */ UserTagsJS.modules.custom = { 'Lattesmc': ['translator'], };   importScriptPage('MediaWiki:UserTags/code.js', 'dev');

// Configure AjaxRC importScriptPage('AjaxRC/code.js', 'dev'); (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) || []; scriptList.push('u:dev:AjaxRC/code.js');

// ArchiveTool window.archiveListTemplate = 'ArchiveList'; window.archivePageTemplate = 'ArchivePage'; scriptList.push('u:dev:ArchiveTool/code.js');

// Custom edit buttons if (mw.toolbar) { mw.toolbar.addButton(			'https://vignette2.wikia.nocookie.net/youkoso-jitsuryoku-shijou-shugi-no-kyoushitsu-e/images/c/c8/Button_redirect.png',			'Redirect',			'#REDIRECT ',			'',			'Insert text',			'mw-editbutton-redirect'		); mw.toolbar.addButton(			'https://vignette3.wikia.nocookie.net/youkoso-jitsuryoku-shijou-shugi-no-kyoushitsu-e/images/e/e1/O_Accent_Button.png',			'Add the ō character',			'ō',			,			,			'mw-editbutton-macron-o'		); mw.toolbar.addButton(			'https://vignette2.wikia.nocookie.net/youkoso-jitsuryoku-shijou-shugi-no-kyoushitsu-e/images/d/db/U_Accent_Button.png',			'Add the ū character',			'ū',			,			,			'mw-editbutton-macron-u'		); mw.toolbar.addButton(			'https://vignette3.wikia.nocookie.net/youkoso-jitsuryoku-shijou-shugi-no-kyoushitsu-e/images/7/79/Button_reflink.png',			'Add a Reference',			' ',			'\'\'You-Zitsu\'\' Vol. 0, Ch. 0, p. 0',			'mw-editbutton-ref'		); }

// Custom Special:[Multiple]Upload UI	if (({Upload: 1, MultipleUpload: 1})[mw.config.get('wgCanonicalSpecialPageName')] === 1) { pageScriptList.push(			'MediaWiki:Common.js/FairUseUpload.js'		); }	// Remove red-links (deleted pages) from Recent Changes // [They stay red, they just don't link to ?action=edit] if (({ Recentchanges: 1, Log: 1 })[mw.config.get('wgCanonicalSpecialPageName')] === 1) { var deNewRC = function { $('a.new').each(function {				this.href = this.href.replace(/\?[^?]*$/, '');			}); };		$(deNewRC); window.ajaxCallAgain.push(deNewRC); }	// 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') { // Detach the AJAX feature from Page/Image Creation/Upload // because the pop-up form does not obey the preloads and such. $(window).load(function {			$('a.createpage').off('click').attr('href', '/wiki/Special:Forms');		}); // 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;                    }); });       });	}

/* Hide a specific area */ importScriptPage('MediaWiki:SpoilersToggle.js', 'you-zitsu');

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

}(window, jQuery, mediaWiki));