User:Devilify65536/global.js

(function($, mw){	mw.loader.using([ 'mediawiki.api', 'mediawiki.user', 'mediawiki.util' ], function{ var data = { pages: {}, users: {} };		$("a").queue(function{			var api = new mw.Api,			regex = new RegExp('^(?:\\/[a-z-]+)?\\/wiki\\/(?=([^\\?#]+))');			if (!$(this).attr("href") || !$(this).attr("href").match(regex)) {				return;			}			var page = decodeURIComponent($(this).attr("href").match(regex)[1]);			if (data.pages[page]) {				data.pages[page].elements.push(this);			} else {				data.pages[page] = {					data: {						pending: ""					},					elements: [this]				};			}			api.post({ "action": "query", "format": "json", "prop": "categories|contributors|info", "titles": page, "cllimit": "500", "pclimit": "500", "inprop": "protection|watched|watchers" }).then(function(e){ var pgdata = data.pages[page].data = Object.values(e.query.pages)[0]; console.log(pgdata,$(data.pages[page].elements)) $(data.pages[page].elements).queue(function{					$(this).addClass("ns-"+pgdata.ns)					for (var i = 0; i<pgdata.contributors;i++)					$(this).attr("data-contributor-uname-" + pgdata.contributors[1].name.replace("","_"),"-").attr("data-contributor-uid-" + pgdata.contributors[1].userid,"-");				}); }).catch(function(e){console.log(e)});		}); }); }(jQuery,mediaWiki));