User:ST47/cu-log-links.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
if (window.location.href.indexOf("Special:CheckUserLog") > -1) {
	mw.loader.using('mediawiki.util', function() {
		$('a.mw-anonuserlink').each(function() {
		    var addr = $(this).text();
		    var pattern = /^((\d{1,3}\.){3}\d{1,3}|([\da-f]{0,4}:){1,7}[\da-f]{0,4})(\/\d{1,3})?$/i;
		    if (pattern.test(addr)) {
		        var append = ' (<a href="https://en.wikipedia.org/wiki/Special:Contributions/'+addr+'">contribs</a> | <a href="https://tools.wmflabs.org/whois-referral/gateway.py?lookup=true&ip='+addr+'">WHOIS</a> | <a href="https://ipcheck.toolforge.org/index.php?ip='+addr+'">proxy</a>)';
		        $($.parseHTML(append)).insertAfter($(this));
		    }
		});
	});
}