Jump to content

User:Ajraddatz/global.js

From Meta, a Wikimedia project coordination 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.load('//meta.wikimedia.org/w/index.php?title=User:Glaisher/calcCIDR.js&oldid=15247853&action=raw&ctype=text/javascript');
mw.loader.load('//en.wikipedia.org/w/load.php?modules=ext.gadget.Navigation_popups');
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Ladsgroup/CheckUserHelper.js&action=raw&ctype=text/javascript');
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Hoo_man/smart_rollback.js&action=raw&ctype=text/javascript');

if (mw.config.get('wgCanonicalSpecialPageName') === 'CentralAuth' && mw.config.get('wgDBname') !== 'metawiki')
	location.href = '//meta.wikimedia.org/wiki/Special:CentralAuth' + ((mw.config.get('wgRelevantUserName')) ? '?target=' + encodeURIComponent(mw.config.get('wgRelevantUserName')) : '');

$(document).ready(function() {
	if ( mw.config.get('wgCanonicalSpecialPageName') !== 'Contributions' ) return;
	var targ = mw.config.get('wgRelevantUserName') || $( 'input[name="target"]' ).val().trim();
	if ( !targ || !document.getElementById('contentSub') ) return;
	var isIP = !(document.getElementById('t-userrights') || document.querySelector('.mw-userpage-userdoesnotexist'));
	
	if (!(isIP === true && targ.lastIndexOf('/') !== -1)) {
		try {
			var blk = $('.mw-logline-block bdi')[1].innerText == targ;
		} catch (e) {
			var blk = false;
		}
		$('#contentSub .mw-changeslist-links:first span')[4 + (document.querySelector('#contentSub a[href*="Special:ListFiles"]') ? 1 : 0) + +blk].insertAdjacentHTML('beforeend', '<sup><a href="/wiki/Special:Log?type=spamblacklist&user=' + encodeURIComponent(targ) + '" title="Spam blacklist">(sBL)</a></sup>');
	}
	
	var links = new Array();
	if (isIP === false) {
		if (mw.config.get('wgDBname') !== 'metawiki') {
			links.push('<a href="//meta.wikimedia.org/wiki/Special:Userrights/' + encodeURIComponent(targ + '@' + mw.config.get('wgDBname')) + '">meta rights management</a>');
		links.push('<a href="//meta.wikimedia.org/wiki/Special:CentralAuth?target=' + encodeURIComponent(targ) + '">CentralAuth</a>');
        links.push('<a href="//meta.wikimedia.org/wiki/Special:GlobalBlock/'+targ+'">globally block</a>');
	}
    }
	links.push('<a href="//meta.wikimedia.org/wiki/Special:CheckUser/' + encodeURIComponent(targ) + '">CheckUser</a>');
	if (!(isIP === true && targ.lastIndexOf('/') !== -1))
		links.push('<a href="//tools.wmflabs.org/guc/?user=' + encodeURIComponent(targ) + '">lookup contribs</a> <a href="//tools.wmflabs.org/guc/?by=date&user=' + encodeURIComponent(targ) + '">(by date)</a><sup><a href="//tools.wmflabs.org/guc/?src=rc&by=date&user=' + encodeURIComponent(targ) + '">(recent)</a></sup>)');
	links.push('<a href="//tools.wmflabs.org/meta/stalktoy/' + encodeURIComponent(targ) + '">stalktoy</a>');
	var tag = document.getElementById('contentSub').getElementsByTagName('a');
	tag[tag.length-1].insertAdjacentHTML('afterend', ' | ' + links.join(' | '));
	$('#contentSub .mw-changeslist-links:first').css('display', 'contents');
});



mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Erwin/stewardlinks.js&action=raw&ctype=text/javascript');