MediaWiki:Group-sysop.js

From Yugipedia
Jump to: navigation, search

Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: hold down Ctrl and click the Refresh or Reload button. Firefox: hold down ⇧ Shift while clicking Reload (or press Ctrl+⇧ Shift+R). Google Chrome and Safari users can just click the Reload button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.

/* Any JavaScript here will be loaded for sysops only */
/**
 * Add any delete reason from [[Template:Delete]] to the delete link in the page tabs.
 * 
 * Modified from [[wikipedia:MediaWiki:Group-sysop.js]]
 */
(function () {
	var link, reason;
	if (document.getElementById('ca-delete') && document.getElementById('delete-reason')) {
		link = document.getElementById('ca-delete').getElementsByTagName('A')[0];
		reason = document.getElementById('delete-reason').innerHTML;
		link.setAttribute('href', link.getAttribute('href') + '&wpReason=' + reason);
	}
})();
/**
 * Link to the /64 subnet contributions from the contribs pages for IPv6 addresses
 * since many ISPs assign the whole /64 to single users
 * 
 * From [[wikipedia:User:Enterprisey/ipv6-subnet-link.js]]
 */
$(function() {
	if (mw.config.get('wgCanonicalSpecialPageName') === 'Contributions') {
		var a = mw.config.get('wgRelevantUserName');
		if (a && (a.split(':').length === 8) && (a.indexOf('/') < 0)) {
			mw.loader.using(['mediawiki.util'], function() {
				var b = 'Special:Contribs/' + a.split(':').slice(0, 4).join(':') + '::/64';
				$('#contentSub').first().after('<p><a href="' + mw.util.getUrl(b) + '" title="' + b + '">' + b + '</a></p>');
			});
		}
	}
});