User:Oshwah/AbuseFilter-Log-Links.js

//Forked from User:ST47/cu-log-links.js if ((window.location.href.indexOf("Special:AbuseLog") > -1) && !(window.location.href.indexOf("Special:RevisionDelete") > -1)) { mw.loader.using('mediawiki.util', function {		$('a.mw-userlink').each(function(i) { var addr = $(this).text; var enc_addr = encodeURIComponent(addr); var ip_pattern = /^((\d{1,3}\.){3}\d{1,3}|([\da-f]{0,4}:){1,7}[\da-f]{0,4})(\/\d{1,3})?$/i; var cidr_pattern = /\/\d{1,3}$/;

var new_user_tool_links = ""; var user_tool_links = $('span.mw-usertoollinks')[i].innerHTML;

var talk_link = user_tool_links.match("^(.*)>talk<\/a>"); talk_link = ((talk_link == null)?(' talk '):(talk_link[0]));

var contribs_link = user_tool_links.match(" contribs<\/a><\/span>");           contribs_link = ((contribs_link == null)?(' contribs '):(contribs_link[0]));

var block_link = user_tool_links.match(" block<\/a><\/span>");           block_link = ((block_link == null)?(' block '):(block_link[0]));

var publiclog_link = 'logs'; var checkuser_link = 'checkuser'; var checklog_link = 'checks';

if (ip_pattern.test(addr)) { //The current user is an IP address var whois_link = 'WHOIS'; var geolocate_link = '<a href="https://whatismyipaddress.com/ip/'+addr+'">geolocate</a>'; var proxy_check_link = '<a href="https://ipcheck.toolforge.org/index.php?ip='+addr+'">proxy</a>'; var bullseye_check_link = '<a href="https://bullseye.toolforge.org/ip/'+addr+'">bullseye</a>'; if (!cidr_pattern.test(addr)) { //The IP address does not contain a CIDR range at the end new_user_tool_links += talk_link + " | " + contribs_link + " | " + publiclog_link + " | " + whois_link + " | " + geolocate_link + " | " + proxy_check_link + " | " + bullseye_check_link + " | " + checkuser_link + " | " + checklog_link + " | " + block_link; //set the string to be added to the user tool links } else { //The IP address contains a CIDR range at the end new_user_tool_links += contribs_link + " | " + publiclog_link + " | " + whois_link + " | " + geolocate_link + " | " + proxy_check_link + " | " + bullseye_check_link + " | " + checkuser_link + " | " + checklog_link + " " + block_link; //set the string to be added to the user tool links }}			else { //It's not an IP address, so it must be an account $('a.mw-userlink')[i].href = 'https://en.wikipedia.org/wiki/User:'+enc_addr+''; //set the link to the user page new_user_tool_links += talk_link + " | " + contribs_link + " | " + publiclog_link + " | " + checkuser_link + " | " + checklog_link + " | " + block_link; //set the string to be added to the user tool links }           new_user_tool_links += ")"; //Because of the way that the Abuse Log is set up, you have to add the outside s.            $('span.mw-usertoollinks')[i].innerHTML = new_user_tool_links; //After all is done, set the HTML for the user tool links to the value set in "append"		}); }); }