User:Thundercraft5/global.js

"use strict"; /* jshint esversion: 5, forin: true, immed: true, indent: 4, latedef: false, newcap: true, noarg: true, undef: true, undef: true, unused: true, browser: true, jquery: true, onevar: true, eqeqeq: true, multistr: true, moz: true /* global mw, loadModules, importArticles */ /** * JS subpage loader */ window.ignoreModules = [];

var start = new Date;

var wgAction = mw.config.get('wgAction'), wgPageName = mw.config.get('wgPageName'), wgCodeEditorCurrentLanguage = mw.config.get('wgCodeEditorCurrentLanguage');

var isWikiEditor = ['edit', 'submit'].includes(wgAction) && !wgCodeEditorCurrentLanguage, isView = !['edit', 'submit'].includes(wgAction), isCodeEditor = ['edit', 'submit'].includes(wgAction) && wgCodeEditorCurrentLanguage;

jQuery.Deferred.exceptionHook = function(error, stack) { if (error instanceof Error) { window.console.warn('jQuery.Deferred exception: ' + error.message, error, stack); } };

window.loadModules = function(modules) { var origModules = Array.from(modules || []); modules = modules || []; modules.forEach(function(v, i, arr) {		arr[i] = 'User:Thundercraft5/global.js/' + v.replace('.js', '') + '.js';	});

var loadModules = { init: function { this.def = new $.Deferred; for (var key in localStorage) { if (					key.indexOf('loadModules-cache-module-') === 0 					&& (!!origModules.length ? origModules.includes(						'User:Thundercraft5/global.js/' + key.replace('loadModules-cache-module-', '')					) : true)				) { var script = JSON.parse(localStorage.getItem(key)), mName = key.replace('loadModules-cache-module-', ''); this.log('Script "' + mName + '" was found in module cache, executing from cache...'); this.executeScript(script.content, mName, script.id); modules.splice(modules.indexOf('User:Thundercraft5/global.js/' + mName), 1); }			}			if (!modules.join('|')) return this.def.resolve, this.def;

$.ajax({				data: {					action: 'query',					cb: Date.now,					format: 'json',					indexpageids: true,					prop: 'revisions',					rvprop: 'content',					titles: modules.join('|'),				},				dataType: 'jsonp',				error: this.onError.bind(this),				success: this.onSuccess.bind(this),				type: 'GET',				url: 'https://community.fandom.com/api.php'			}).done(this.def.resolve); },		executeScript: function(js, module, id, fullName) { var script = document.createElement('script'); var blob = new Blob(['/*** ' + fullName + " ***/\n\n(async => {\n" + js.replaceAll(/\n?\/\*\s*(jshint|global)([^\0]+?)\*\/\n?|\s*(?<!["'`])\/\/\s*jshint([^\n\/]*?)$/gmi, '') + "\n});"], { type: "text/javascript" });			var blobUrl = URL.createObjectURL(blob);			script.setAttribute('data-module-name', module);			script.src = blobUrl;			script.async = true;			script.class = 'loadModules-Module';			window.loadModules.blobList[module] = {				blobUrl: blobUrl,				blob: blob,				element: script,				name: module,				id: id,				content: js,			};			this.log('Executing script "' + module + '" (module id #' + id + ')');			try {				document.head.append(script);			} catch(e) {				this.warn('Failed to execute module "' + module + '":', e);			}		},		runScripts: function(scripts) {			Object.keys(scripts).forEach(function(k, i, arr) {				this.executeScript(scripts[k].content, k, scripts[k].id, scripts[k].fullName); if (i === arr.length) this.def.resolve; }.bind(this));		},		prepareExecution: function(data) {			var ids = data.query.pageids,				pages = data.query.pages,				o = {};			ids.forEach(function(id) { var currentData = pages[id], title = currentData.title.replace('User:Thundercraft5/global.js/', ''); if (!currentData.revisions) return this.warn('The requested module "' + title + '" does not exist, skipping.'); var content = currentData.revisions[0]["*"]; var obj = o[title] = { content: content, id: id, fullName: title, };				localStorage.setItem('loadModules-cache-module-' + title, JSON.stringify(obj)); }.bind(this));			return o;		},		onError: function(e) {			this.warn('API error in fetching modules:', e);		},		onSuccess: function(data) {			var scripts = this.prepareExecution(data);			this.log('Executing scripts...');			this.runScripts(scripts);		},		logBuilder: function(name, args) {			window.console[name.toLowerCase].apply(null, ["[" + name.toUpperCase + "] loadModules:"].concat(Array.from(args)));		},		warn: function {			this.logBuilder('warn', arguments);		},		log: function {			this.logBuilder('log', arguments);			},	};	loadModules.init;	return loadModules.def; };

window.loadModules.listModulesCache = function { for (var key in localStorage) { if (key.indexOf('loadModules-cache-module-') === 0) { console.log(key, JSON.parse(localStorage.getItem(key))); }	} }; window.loadModules.blobList = {};

window.loadModules.listModules = function { var self = { logBuilder: function(name, args) { window.console[name.toLowerCase].apply(null, ["[" + name.toUpperCase + "] loadModules:"].concat(Array.from(args))); return Array.from(args).join(' '); },		warn: function { return this.logBuilder('warn', arguments); },		log: function { return this.logBuilder('log', arguments); },		init: function { this.def = new $.Deferred; $.ajax({				data: {					action: 'query',					list: 'allpages',					format: 'json',					aplimit: 500,					apnamespace: 2,					apprefix: 'Thundercraft5/global.js/',				},				dataType: 'jsonp',				type: 'GET',				url: 'https://community.fandom.com/api.php'			}).done(function(res) {				if (typeof(res) !== "object") return this.def.reject(this.warn('Failed to get modules:', res));

var arr = []; res.query.allpages.forEach(function(o, i) {					arr[i] = o.title;					});

return this.getData(arr); }.bind(this));

return this.def; },		getData: function(d) { return $.ajax({				data: {					action: 'query',					cb: Date.now,					format: 'json',					indexpageids: true,					prop: 'revisions',					rvprop: 'content',					titles: d.join('|'),				},				dataType: 'jsonp',				error: this.onError.bind(this),				type: 'GET',				url: 'https://community.fandom.com/api.php'			}).always(this.prepareData.bind(this)); },		prepareData: function(data) { if (typeof(data) !== "object") return this.def.reject(this.warn('Failed to get page content:', data)); var ids = data.query.pageids, pages = data.query.pages, o = {}; ids.forEach(function(id) {				var currentData = pages[id],					title = currentData.title.replace('User:Thundercraft5/global.js/', '');				if (!currentData.revisions) return this.warn('The requested module "' + title + '" does not exist, skipping.');				var content = currentData.revisions[0]["*"];				o[title] = {					content: content,					id: id,				};			}.bind(this)); console.log(o); this.def.resolve(o); return o;		}, onError: function(e) { this.def.reject(this.warn(e)); },	};	return self.init; };

// Batch Delete Script Config window.batchDeleteDelay = 5; window.batchUnDeleteDelay = 5;

// Mass Edit Config window.MassEditConfig = { interval: 10, placement: { element: "toolbar", type: "append" } };

// MassCategorization window.MassCategorization = { delay: 1, };

// STD summaries window.dev = window.dev || {}; window.dev.editSummaries = { css: '#stdSummaries { ... }',	select: [ '(click to browse)', 'Quick', [ 'Formatting', 'Removing vandalism', 'Fixing error(s)', 'Corrected spelling/grammar', 'Corrected formatting/layout' ],		'General', [ 'Added/removed/corrected link(s)', 'Cleanup', 'HTML/Source mode cleanup', 'Expanded', 'Grammar', 'Punctuation', 'Redlink removal', 'Refactoring', 'Re-ordering/re-organizing', 'Revised', 'Spelling correction', 'Style/layout', 'Netural point of view (NPOV)', 'Tidying', 'Updating', 'Wikifying', 'Added/removed/corrected template(s)', 'Adding new features', 'Testing new features', 'Making source code look better', ],		'Templates', [ 'Parser function modification', 'Fixing template bugs', 'Creating documentation subpage', 'Magic word correction/modification', ],		'Advanced code', [ 'Logic cleanup/Optimiziation', 'Function cleanup', 'Adding comments', 'Fixing errors/bugs', 'Removing deprecated features', 'Minor changes', ],		'Removal/Reversion', [ 'Reverted Spam/Vandalism', 'Reverted test edit', 'Reverted Copy vio\'' ],		'Categories', [ 'Added category(ies)', 'Alphabetised category(ies)', 'Creating Category page', 'Modified category(ies)', ],	], };

// AjaxRC window.ajaxRefresh = 30000; window.ajaxPages = [ "RecentChanges", "WikiActivity", "Watchlist", "Log", "Contributions", "AbuseLog", "SocialActivity", "NewFiles", "BlockList", ].concat([		"abusefilter",		"block",		"contentmodel",		"delete",		"import",		"merge",		"move",		"create",		"patrol",		"protect",		"tag",		"managetags",		"templateclassification",		"timedmediahandler",		"upload",		"newusers",		"rights"	].map(function(v) { return "Log/" + v; })) .map(function(v) { return "Special:" + v; }); $.extend(true, window, {dev: {i18n: {overrides: {AjaxRC: {	'ajaxrc-refresh-text': 'Auto Refresh',	'ajaxrc-refresh-hover': 'Enable automatically refreshing of this page', }}}}});

//MassBlock delay window.massBlockDelay = 5; // AjaxBlock Config window.AjaxBlock = { blockReasons: { 'General': { 'Vandalism': 'Vandalism', 'Removing Content From Pages': 'Removing Content form Pages', 'Disruptive Editing': 'Disruptive Editing', 'Inserting False Information': 'Inserting False Information', 'Creating Nonsense/Vandalism Articles': 'Creating Spam Articles', 'Inserting nonsense/gibberish into pages': 'Inserting nonsense/gibberish into pages', },		'Accounts': { 'Open Proxy/VPN': "Open Proxy/VPN", 'Vandalism-Only Account': 'VoA Account', 'Unacceptable Username': 'Unacceptable Username', 'Clearly not here to build an Encyclopedia': 'Clearly not here to build an Encyclopedia', 'Abusing Multiple Accounts (Sockpuppetry)': "Sockpuppety", 'Long-Term Abuse': 'Long-Term Abuse', },		'Spam': { 'Spam/Advertising Only account': 'Spam/Advertising Only account', 'Spam/Advertising': 'Spam/Advertising', 'Spamming Links to External Sites': 'External Link Spam', 'Posting Spam on Userpage': 'Posting Spam on Userpage', },		'Comments/Posts': { 'Spamming Nonsense Comments/Posts': 'Spamming Nonsense Comments/Posts', 'Intimidating/Harrasing Comments/Posts': 'Intimidating/Harrasing Comments/Posts', 'Swearing In Comments/Discussions': 'Swearing In Comments/Discussions', 'Discussing Controversial Topics': 'Discussing Controversial Topics', 'Innapropriate Behavior/Comments': 'Innapropriate Behavior/Comments', },		'Other': { 'Edit Warring': 'Edit Warring', 'Personal Attacks': 'Personal Attacks', 'Intimidating Behavior/Harassment': 'Intimidating Behavior/Harassment', 'Deragetory language': 'Deragetory language', 'Spreading False Rumors/Information': 'Spreading False Rumors/Information', 'Shouting': 'Shouting', 'Immature Behavior/Conduct': 'Immature Behavior/Conduct', 'Violation of SkyBlock Rules': 'Violation of SkyBlock Rules', 'Violation of FANDOM Terms of Use': 'Violation of FANDOM Terms of Use', },	},	expiryTimes: { '24 hours': '1 day', '3 days': '3 days', '1 week': '1 week', '2 weeks': '2 weeks', '3 weeks': '3 weeks', '1 month': '1 month', '6 weeks': '6 weeks', '2 months': '2 months', '3 months': '3 months', '4 months': '4 months', '6 months': '6 months', '9 months': '9 months', '1 year': '1 year', '18 months': '18 months', '3 years': '3 years', 'infinite': 'all of eternity', },	check: { talk: true, autoBlock: true, override: true, noCreate: true, rangeBlock: false, refAbuseLog: false, },	extras: { rangeBlock: true, refAbuseLog: true, }, }; // AjaxDelete Config window.AjaxDelete = { deleteReasons: { 'Spam/Vandalism': 'Spam/Vandalism', 'Marked for Devarion': 'Marked for Devarion', 'Empty Article': 'Empty', 'Author request': 'Author request', 'Irrelevant to The Wiki': 'Irrelevant', 'Housekeeping': 'Housekeeping', 'Spam/Vandalism Article': 'Spam/Vandalism Article', 'Deprecated/Unused': 'Deprecated/Unused', 'Personal Attack article': 'Personal Attack article]', 'Disinformation/Hoax': 'Disinformation/Hoax', 'Broken Redirect': 'Broken Redirect', 'Unused Redirect': 'Unused redirect', 'Redirect left from pagemove': 'Page Move redirect', },	imageDeleteReasons: { 'Offensive Image': 'Offensive', 'Inappropriate Image': 'Inappropriate', 'Harassment-Only image': 'Harassment', 'Housekeeping': 'Housekeeping', 'Copyright infringement': 'Copyright', 'Author request': 'Author request', 'Duplicate/Superseded File': 'Duplicate/Superseded', 'Improper Image format': 'Improper Format', 'Spam/Vandalism': 'Spam/Vandalism', },	autoCheckWatch: true, noUndelete: false, reload: false, };

//Nuke Config window.nukeDelay = 5; //WHAM tool config window.WHAMBlockReason = "vandalism"; window.WHAMDelay = 5; window.WHAMBlockDuration = '3 months'; window.WHAMDeleteReason = "devaring spam/vandalism";

//AutoRenamePages Config window.PRAoptions = { editSummary: 'Updating page links (automatic)' }; // Mass Rename Pages Config window.massRenameDelay = 25; //ThreadDelete config window.AjaxThreadDeleteConfig = { fastDelete: false, reason: 'Thread/Comment Deleted: The Thread/Comment Has Containted the Following: Spam / Vandalism / #|Roasting/Heated Arguments' }; //MassProtect Delay window.massProtectDelay = 5; //MassUndelete delay window.batchUndeleteDelay = 5;

window.LIRoptions = { bottomMessage: '', editSummary: 'Updating file links (automatic)', singleButtonText: 'Rename and update', queueButtonText: 'Add to queue', delay: 10 }; // Global userpage window.AutoCreateUserPagesConfig = { content:{ 2:,		3:,		1202:''	},	summary: 'Creating userpage(es)', };

// Edit Conflict alert check window.EditConflictAlertInterval = 15000;

// Mass Null Edit Delay window.nullEditDelay = 25;

// DeleteUserpage config window.delUserpage = { doProtect: true, };

// AnchoredRollback window.anchoredRollbackBot = true;

//================================ // GlobalNavButtons //================================= window.globalNavButtons = [ //=================================== // Community Centeral //=================================== // Main Button {	text: 'Community', url: 'https://community.fandom.com', isMain: true, whoIsMain: false, shortName: 'C' }, // New users Log (Anti-spam) {	text: 'New users log', url: 'https://community.fandom.com/wiki/Special:Log/newusers', isMain: false, whoIsMain: 'C', shortName: 'NU' }, // User avatar Log (Anti-spam) {	text: 'User Avatar Log log', url: 'https://community.fandom.com/wiki/Special:Log/useravatar', isMain: false, whoIsMain: 'C', shortName: 'AVL' }, // Recent Changes {	text: 'Recent Activity log', url: 'https://community.fandom.com/wiki/Special:RecentChanges?hidelogs=1&namespace=2&days=1', isMain: false, whoIsMain: 'C', shortName: 'RA' }, // Abuse Log (Anti-spam) {	text: 'Abuse Log', url: 'https://community.fandom.com/wiki/Special:AbuseLog?limit=500', isMain: false, whoIsMain: 'C', shortName: 'AL' }, // Wikis Log {	text: 'Wikis log', url: 'https://community.fandom.com/wiki/Special:Newwikis', isMain: false, whoIsMain: 'C', shortName: 'WL' }, //===================================  // SOAP (for Reports) //================================== // Main Button {	text: 'SOAP', url: 'https://soap.fandom.com', isMain: true, whoIsMain: false, shortName: 'S' }, // Profiles {	text: 'Profiles', url: 'https://soap.fandom.com/wiki/Report:User_profile_headers', isMain: false, whoIsMain: 'S', shortName: 'R:P' }, // Spam {	text: 'Spam', url: 'https://soap.fandom.com/wiki/Report:Spam', isMain: false, whoIsMain: 'S', shortName: 'R:S' }, {	text: 'Vandalism', url: 'https://soap.fandom.com/wiki/Report:Vandalism', isMain: false, whoIsMain: 'S', shortName: 'R:V' }, {	text: 'Wiki', url: 'https://soap.fandom.com/wiki/Report:Wiki', isMain: false, whoIsMain: 'S', shortName: 'R:W' }, {	text: 'Biglist', url: 'https://soap.fandom.com/wiki/Report:Spam/Biglist', isMain: false, whoIsMain: 'S', shortName: 'R:BL' }, //=========================================  // Wikis (Personal) //======================================== // Main Button {	text: 'Wikis', url: '#', isMain: true, whoIsMain: false, shortName: 'W' }, // Hypixel SkyBlock Wiki {	text: 'Hypixel SkyBlock Wiki', url: 'https://hypixel-skyblock.fandom.com/wiki/Special:RecentChanges', isMain: false, whoIsMain: 'W', shortName: 'HSW' }, // Minecraft Wiki {	text: 'Minecraft', url: 'https://minecraft.fandom.com/wiki/Special:RecentChanges', isMain: false, whoIsMain: 'W', shortName: 'MCW' }, // Hypixel SkyBlock Korean Wiki {	text: 'Hypixel SkyBlock Korean Wiki', url: 'https://hypixel-skyblock.fandom.com/ko/wiki/Special:RecentChanges', isMain: false, whoIsMain: 'W', shortName: 'HSKW' }, // Community Centeral {	text: 'Community Centeral', url: 'https://community.fandom.com/wiki/Special:RecentChanges', isMain: false, whoIsMain: 'W', shortName: 'CC' }, //=========================================  // Hypixel SkyBlock wiki Stuff //======================================== // Main Button {	text: 'HSW', url: 'https://hypixel-skyblock.fandom.com/wiki/', isMain: true, whoIsMain: false, shortName: 'HSWDR' }, // Recent Changes {	text: 'Recent Changes', url: 'https://hypixel-skyblock.fandom.com/wiki/Special:RecentChanges', isMain: false, whoIsMain: 'HSWDR', shortName: 'HSWRC' }, // Logs {	text: 'All Logs', url: 'https://hypixel-skyblock.fandom.com/wiki/Special:Log', isMain: false, whoIsMain: 'HSWDR', shortName: 'HSWL' }, // Block List {	text: 'Block List', url: 'https://hypixel-skyblock.fandom.com/wiki/Special:BlockList', isMain: false, whoIsMain: 'HSWDR', shortName: 'HSWBL' }, // Abuse Log {	text: 'Abuse Log', url: 'https://hypixel-skyblock.fandom.com/wiki/Special:AbuseLog', isMain: false, whoIsMain: 'HSWDR', shortName: 'HSWAL' }, ];

//Ignore all announcements window.announcementsIgnore = { option: 'opt-out-all', exceptWikiIds: [ 177,		2011605,	], };

/*=============================================== *Imports *===============================================

/* mw.loader.using('mediawiki.api', function {	new mw.Api.post({ action: 'query', meta: "siteinfo", siprop: "interwikimap", }).then(function(d) { var interwikimap = d.query.interwikimap; var loadedModules = {}; window.importArticles = function { var doneGroups = []; $.when(Array.from(arguments).map(function(arg) { var articles = arg.articles || (arg.article && [arg.article]); var ext = arg.type === "style" ? "css" : "js"; var cType = arg.type === "style" ? "css" : "javascript"; var oldPages = articles.map(function(v) {					if (!v.match(/^(u|url):([^:]+?):([^:]+?):([^:]+?)$/)) {						return v.replace(/^(u|url):([^:]+?:)([^:]+?)$/, '$1:$2MediaWiki:$3');					} else return v;				}); if (articles) articles = articles.map(function(article) {					var ret = article.replace(/^(?:u|url):(.+)$/, function(_, wiki) { return wiki.replace(new RegExp('^(' + interwikimap.map(function(v) { return v.prefix }).join('|') + '):(.+)$'), function(_, prefix, rest) {							var prefixData = interwikimap.find(function(v) { return v.prefix === prefix; });							return prefix.replace(prefixData.prefix, prefixData.url.replace(/\$1/, rest));						}).replace(/^([\.\w\-]+):(.+?)$/, function(_, prefix, rest) {							return prefix.replace(/^(?:(\w{1,3})\.)?([\w\-]+)$/, function(_, lang, wiki) { return 'https://' + wiki + '.fandom.com' + (lang ? '/' + lang : "") + '/wiki/'; }) + (!rest.includes(':') ? 'MediaWiki:' + rest : rest);						}); }).replaceAll(/\/:/g, '/')					if (!ret.match(/\.([a-z]{1,10})$/)) {						ret = '.' + ext;					}					return ret += '?action=raw&ctype=text/' + cType;				}); articles.forEach(function(url, i) {					var oldPage = oldPages[i];					console.log(url, oldPage);					if (loadedModules[oldPage]) return;					loadedModules[oldPage] = true;					if (arg.type === "style") {						$.get("/load.php?mode=articles&articles=" + oldPage + "&only=styles").then(function(styles) { mw.util.addCSS(styles); console.log(oldPage + ': Ready'); }, function(e) { console.warn(oldPage + ': Failed to load: ' + e); });					} else {						$.ajax({ url: url, cache: true, dataType: "script", }).then(function { console.log(oldPage + ': Ready'); }, function(e) { console.warn(oldPage + ': Failed to load: ' + e); });					}				});			}));		};	}); }).catch(console.warn); */

// Filter which scripts to load $.getScript('https://dev.fandom.com/wiki/MediaWiki:Discussions_Delete_All/code.js?action=raw&ctype=text/javascript');

var scripts = { editor: { 'AjaxEditPreview.js': 1, 'Standard_Edit_Summary/code.js': 1, },	wikiEditor: {}, codeEditor: {}, view: { // Ajax Scripts 'AjaxRC.js': 1, // 'AjaxRedirect/code.js', 'AjaxUndo/code.js': 1, 'AjaxUserRights.js': 1, 'AjaxAbuseLog.js': 1, // Mass Scripts 'MassRollback.js': wgPageName.startsWith('Special:Contributions'),

// Other Scripts 'FastOldImageDelete/code.js': 1, 'MultipleFileDelete/code.js': 1, 'FileUsageAuto-update/code.js': 1, 'RevealAnonIP/usercode.js': 1, 'AllPagesHideRedirect/code.js': wgPageName.startsWith('Special:AllPages'), 'RedirectManagement/code.js': wgPageName === 'Special:DoubleRedirects' || wgPageName === 'Special:BrokenRedirects', 'WHAM/code.2.js': wgPageName.startsWith('Special:Contributions'), 'MoreDropdown/code.js': 1, 'Nuke/code.js': 1, 'PowerDelete.js': 1, 'UserAndIPTools.js': mw.config.get('profileUserName'), 'DeleteTalkpage.js': wgAction === 'delete', 'BlockLookup.js': 1, // 'Discussions Restore All.js': wgPageName.startsWith('Special:Contributions'), },	any: { // Link click scripts 'Rollback/code.js': 1, 'QuickDiff/code.js': 1, 'AnchoredRollback/code.js': 1, 'AutoCreateUserPages.js': 1, 'AjaxRename/ucp.js': 1, 'AjaxDelete/code.js': 1, 'QuickPurge.js': 1, 'AjaxPatrol/code.js': 1, // Toolbar scripts 'MassProtect/code.js': 1, 'MassRename/code.js': 1, 'MassRedirect/code.1.js': 1, 'MassBlock/code.js': 1, 'AjaxBatchUndelete.js': 1, 'AjaxBatchDelete.js': 1, 'MassNullEdit/code.js': 1, 'MassCategorization/code.js': 1, 'MassEdit/code.js': 1, 'MassUserRights/code.js': 1, // Other 'GlobalNavButtons.js': 1, 'CodeLinksDropdown.js': 1, }, }; var temp = []; var groups = { any: true, view: isView, editor: !isView, codeEditor: isCodeEditor, wikiEditor: isWikiEditor, };

Object.entries(scripts).forEach(function(d) {	var group = d[0];	var items = d[1];	Object.entries(items).forEach(function(d) { if (groups[group] && d[1]) temp.push(d[0]); }); }); temp = temp.map(function(v) {	return 'u:dev:MediaWiki:' + v; });

importArticles({	type: 'script',	articles: temp, }).then(function {	console.log('Loading ImportArticles took ' + (new Date - start) + 'ms'); });

$.when(	loadModules([ "utils.js", ]) ).then(function {

// Clear cache $(document.body).on('keydown', function(e) {	if (e.key.toLowerCase === 'f5' && e.ctrlKey) {		console.log('Clearing cache...');		localStorage.clear;	} });

// Contribs link $('.wds-global-navigation__user-menu .wds-list.wds-is-linked > li:nth-child(1)').after($('', { html: $('', {		href: mw.util.getUrl('Special:Contributions/' + window.wgUserName),		html: "Contributions"	}) }));

$('*').attr('data-tracking', null);

// Editor toolbar posistioning $('#wpMinoreditWidget, #wpWatchthisWidget').each(function {	$(this).prop('outerHTML', $(this).children('input').prop('outerHTML')); }); // CodeMirror Customization if (['submit', 'edit'].includes(mw.config.get('wgAction')) && !mw.config.get('wgIsProbablyEditable')) { mw.loader.using([ 'ext.wikiEditor', 'ext.fandom.wikiEditor.codeMirrorTheming.css' ]).then(function {		$('.CodeMirror').css({ 'font-size': "14px", });	}); } else if (!window.wgCodeEditorCurrentLanguage && ['submit', 'edit'].includes(mw.config.get('wgAction'))) mw.loader.using([ 'ext.wikiEditor', 'ext.fandom.wikiEditor.codeMirrorTheming.css' ]).then(function {	// Quick Submit 	$('#wpSave').click(function(e) { if (e.shiftKey || e.ctrlKey) return; else if (e.altKey) { e.preventDefault; e.stopImmediatePropagation; $(this).click; }		e.preventDefault; e.stopImmediatePropagation; window.navigator.clipboard.writeText($('.editor').length ? window.ace.editor.session.getValue : $('#wpTextbox1').val); new mw.Api.postWithEditToken({			action: 'edit',			text: $('.editor').length ? window.ace.editor.session.getValue : $('#wpTextbox1').val,			title: mw.config.get('wgPageName'),			summary: mw.util.getParamValue('section') === 'new' ? undefined : $('#wpSummary').val,			minor: $('#wpMinoredit').prop('checked'),			watchlist: $('#wpWatchthis').prop('checked') ? 'watch' : 'nochange',			undoafter: mw.util.getParamValue('undoafter'),			undo: mw.util.getParamValue('undo'),			section: mw.util.getParamValue('section') || undefined,			sectiontitle: mw.util.getParamValue('section') === 'new' ? $('#wpSummary').val : undefined,		}).then(function(res) {			$(window).off('beforeunload');			console.log('Edit:', res);			window.location.replace(mw.util.getUrl(mw.config.get('wgPageName')));		}).catch(function(_, e) {			console.warn('Failed to edit "' + mw.config.get('wgPageName') + '": ' + e.error.info); alert('Failed to edit "' + mw.config.get('wgPageName') + '", check console.'); });	}); });

}).catch(console.warn);

// Personal Imports loadModules(Object.entries({ 'AjaxBlock.js': isView, 'AjaxRedirect.js': isView, 'Ace.js': isCodeEditor, 'JSConsole.js': isCodeEditor && wgCodeEditorCurrentLanguage === 'javascript', 'Wikimarks.js': isView, 'CodeMirror.js': isWikiEditor, 'LuaConsole.js': isCodeEditor && wgCodeEditorCurrentLanguage === 'lua', }).filter(function(d) { return d[1]; }).map(function(d) { return d[0]; })).then(function {	console.log('Loading Custom Global JS modules took ' + (new Date - start) + 'ms'); });