MediaWiki:Common.js

/*jshint smarttabs:true laxcomma:true laxbreak:true jquery:true browser:true*/ /*global mediaWiki, wgPageName*/

/* Include Global Anime-Common.js Information */ importScriptURI('http://animanga.wikia.com/index.php?title=MediaWiki:Anime-Common.js&action=raw&ctype=text/javascript&dontcountme=s&smaxage=86400&templates=expand');

(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 = [];

/* Scripts to be loaded everywhere */ // Make WantedFiles File:xxx entries become links to Special:Upload (bug fix) scriptList.push('MediaWiki:Common.js/FixWantedFiles.js'); // Configure AjaxRC (window.ajaxPages = (window.ajaxPages || [])).push(		"Special:RecentChanges",		"Special:Watchlist",		"Special:Log",		"Special:Contributions",		"Special:NewFiles",		"Special:NewPages",		"Special:ListFiles",		"Special:WikiActivity"	); window.AjaxRCRefreshText = 'Automatically refresh every 60secs'; window.ajaxCallAgain = ($.isArray(window.ajaxCallAgain) && window.ajaxCallAgain) || []; scriptList.push('u:dev:AjaxRC/code.js');

// Refresh button scriptList.push('u:dev:PurgeButton/code.js'); // List Duplicate images scriptList.push('u:dev:DupImageList/code.js');

// List Files. See Narutopedia:ListFiles scriptList.push('u:dev:ListFiles/code.js'); // Disable Archive Edit scriptList.push('MediaWiki:Common.js/ArchiveEdit.js');

// Sig Reminder scriptList.push('MediaWiki:Common.js/SigReminder.js');

// Custom Edit Buttons scriptList.push('MediaWiki:Common.js/CEB.js');

// Warnings scriptList.push('MediaWiki:Common.js/Warnings.js');

/* Page specific scripts */

// Reference Popups, like on Wikipedia if (mw.config.get('wgNamespaceNumber') === 0) { pageScriptList.push('u:dev:ReferencePopups/code.js'); }

// Custom Special:[Multiple]Upload UI	$(function($) {		// Detach the AJAX upload feature from the Recent Image Uploads "Add Image" button		// because the pop-up form does not obey the preloads and such.		$('a.wikia-button.upphotos').off('click');	}); if (({Upload:1, MultipleUpload:1})[mediaWiki.config.get('wgCanonicalSpecialPageName')] === 1) { pageScriptList.push(			'MediaWiki:Common.js/FairUseUpload.js',			'MediaWiki:Common.js/FixMultipleUpload.js' // Fix the Special:MultipleUpload page		); }

/* Small scripts which donot deserve a seperate page */

// 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); }

// Automatically uncheck "Leave a redirect behind" on files if (wgPageName.indexOf("Special:MovePage/File:") !== -1) { $('input[name=wpLeaveRedirect]').attr('checked', false); }

// HOOK: Verbatim imports embedded on particular pages. if ($.isArray(window.pageNeededScripts)) { pageScriptList.push.apply(pageScriptList, window.pageNeededScripts); try { delete window.pageNeededScripts; } catch(e) { window.pageNeededScripts = null; } // IE8 sucks. }

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