MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */ mw.loader.using( [ 'mediawiki.util' ] ).done( function {	/* Sidebar menu shortener */	x=document.querySelectorAll("#p-managewiki-sidebar-header .mw-list-item a");	for(i=0; i<x.length; i++) {		x[i].innerHTML = x[i].innerHTML.replace("this wiki's ", "");	}	/* Link images in portable-infobox to their own page */	x=document.querySelectorAll(".pi-image a");	for(i=0; i<x.length; i++) {		if(x[i].href.indexOf('/wiki/') == -1) x[i].href = '/wiki/File:'+x[i].children[0].src.substr(x[i].children[0].src.lastIndexOf("/")+1).replace(/\d+px-/,"");   }	/* Add user edit count */	if(document.getElementById("t-contributions")) {		mw.util.addPortletLink('p-tb', '/wiki/Special:Editcount/'+mw.config.get('wgRelevantUserName').replace(/ /g,'_'), 'User edit count', 't-editcount', 'A list of this user\'s edit count by namespace','','#t-log');   }    /* Add last updated by */	$.ajax({ url: '/w/api.php', data: { action: 'query', prop: 'revisions', titles: 'Allies', format: 'json' }, dataType: 'json' }).then(r => $(".page-info__text")[0].innerHTML = $(".page-info__text")[0].innerHTML.slice(0, -1) + " by " + Object.values(r.query.pages)[0].revisions[0].user + "." ) } );