Jump to content

MediaWiki:Common.js

From Galactic Empire wiki

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
mw.loader.using('mediawiki.util').then(function () {
	'use strict';

	if (mw.config.get('wgUserGroups', []).indexOf('sysop') === -1) {
		return;
	}

	function addAdminLinks() {
		[
			['Special:SpecialPages', 'Special pages', 't-specialpages'],
			['Special:UserRights', 'User rights', 't-userrights'],
			['Special:BotPasswords', 'Bot passwords', 't-botpasswords'],
			['Special:Undelete', 'Deleted pages', 't-undelete'],
			['Special:ProtectedPages', 'Protected pages', 't-protectedpages']
		].forEach(function (item) {
			mw.util.addPortletLink(
				'p-tb',
				mw.util.getUrl(item[0]),
				item[1],
				item[2]
			);
		});
	}

	if (document.readyState === 'loading') {
		document.addEventListener('DOMContentLoaded', addAdminLinks);
	} else {
		addAdminLinks();
	}
});