Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page.
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(mw.config.get("wgPageName")==="Special:AbuseLog"){varabuse_log_entries=document.getElementById("bodyContent").getElementsByTagName("ul")[0].getElementsByTagName("li");// The list of log entries has no class or id, so the only way is to detect its position// Currently, the filter log is the first <ul> element of bodyContent// This may change with updates to the interface or a newer version of MediaWiki// Such changes may cause the script to stop working or even cause unexpcted results// Should anything unexpected happen in the filter log, disable this script (remove it from your common.js/skin.js subpage) and see if this fixes the problemvari;varabuse_log_user_name;varabuse_log_user_tools;varabuse_log_page_name;varabuse_log_page_link;varabuse_log_contribs_link;varuser_editcount_request;varuser_editcount_xml;varuser_editcount;functiontarget_page_link_position(x){vardefault_target_page_link_position=3;if(abuse_log_entries[x].innerHTML.search(/<a href\=\"\/wiki\/Special\:AbuseFilter\/[0-9]+?\"/)!==-1){default_target_page_link_position+=1;};if(abuse_log_entries[x].innerHTML.search(/<a href\=\"\/(wiki\/|w\/index\.php\?title\=)User\:[^#<>\[\]\|\{\}]+?(&action\=edit&redlink\=1)?\" class\=\"(new )?mw-userlink\"/)!==-1){default_target_page_link_position+=1;};returndefault_target_page_link_position;};for(i=0;i<abuse_log_entries.length;i++){// Adds an edit filter log link after the talk and contribs links of each userabuse_log_user_name=abuse_log_entries[i].getElementsByClassName("mw-userlink")[0].getAttribute("href").replace(/.*?(Special\:Contributions\/|User\:)([^#<>\[\]\|\{\}\/]+?)(&action\=edit&redlink\=1)?$/,"$2");// User links are to contribs page (for IP) or to user page (for account)// Usernames cannot contain # < > [ ] | { } / (from [[WP:NCTR]])// For accounts without a user page, &action=edit&redlink=1 appears at the end of the usernameabuse_log_user_tools=abuse_log_entries[i].getElementsByClassName("mw-usertoollinks")[0];abuse_log_user_tools.innerHTML=abuse_log_user_tools.innerHTML.replace(/\)$/," | <a href=\"/w/index.php?title=Special:AbuseLog&wpSearchUser="+abuse_log_user_name+"\">filter log</a>)");// Adds a history link after the page name// The target page name has no class or id on it, so again, it must be found by position// For users who can see private filters, links to all filters are displayed// For others, only links to public filters are displayed, so for private filter hits there is one <a> less from the start of the log entry to the target page// This also depends on whether the user who triggered the filter is an IP or not, is IPs don't have a "contribs" linkabuse_log_page_name=abuse_log_entries[i].getElementsByTagName("a")[target_page_link_position(i)].getAttribute("href").replace(/^\/wiki\/([^#<>\[\]\|\{\}]+?)$/,"$1");// Uses the target_page_link_position() function defined earlier to get the position of the linkabuse_log_page_link=abuse_log_entries[i].getElementsByTagName("a")[target_page_link_position(i)];abuse_log_page_link.outerHTML=abuse_log_page_link.outerHTML+" (<a href=\"/w/index.php?title="+abuse_log_page_name+"&action=history\">history</a>)";// Shows the user's contributions as a red link if there are no edits// This can't be done for IPs as MediaWiki does not record their edit counts (API queries return the invalid=""attribute)// Determine the user contributions linkabuse_log_contribs_link=abuse_log_user_tools.getElementsByTagName("a")[1];// Since user edit counts are not displayed in the log itself, they need to be retrieved using the APIif(window.XMLHttpRequest){// For compatibility with IE 6 and earlieruser_editcount_request=newXMLHttpRequest();}else{user_editcount_request=newActiveXObject("Microsoft.XMLHTTP");};// Get the user's edit count from the APIuser_editcount_request.open("GET","/w/api.php?format=xml&action=query&list=users&usprop=editcount&ususers="+abuse_log_user_name,true);user_editcount_request.send();user_editcount_request.onreadystatechange=function(){if(user_editcount_request.readyState===4&&user_editcount_request.status===200){user_editcount_xml=user_editcount_request.responseXML;user_editcount=user_editcount_xml.getElementsByTagName("user")[0].getAttribute("editcount");user_editcount=newNumber(user_editcount);if(user_editcount===0&&abuse_log_entries[i].innerHTML.search(/<a href\=\"\/(wiki\/|w\/index\.php\?title\=)User\:[^#<>\[\]\|\{\}]+?(&action\=edit&redlink\=1)?\" class\=\"(new )?mw-userlink\"/)!==-1){abuse_log_contribs_link.setAttribute("className","new");};};};};};