User:Animum/easyblock.js/parseUsers.js

//This tool is to help me see how many admins have EasyBlock installed. //It uses Special:WhatLinksHere/User:Animum/easyblock.js for most of the work.

function parseusers { var node = document.getElementById("bodyContent").getElementsByTagName("li"); var counter = 0; for(i=0;i<node.length;i++) { var nodetext = node[i].getElementsByTagName("a")[0].innerHTML; if(nodetext.search(/monobook\.js/) != -1) { var name = nodetext.split("User:")[1].split("/")[0]; var req = sajax_init_object; req.open("GET", "http://en.wikipedia.org/w/api.php?action=query&list=allusers&auprop=groups&aulimit=1&format=json&aufrom=" + name, false); req.send(null); var data = eval("(" + req.responseText + ")").query.allusers[0]; if(data) { if(data.groups) { if(data.groups.indexOf("sysop") == -1) { node[i].style.display = "none"; counter = counter+1; } else { node[i].innerHTML += " (" + ((i+1)-counter) + ")"; }               } else { node[i].style.display = "none"; counter = counter+1; }           }        } else { node[i].style.display = "none"; counter = counter+1; }   } }

$(function {   if(document.title == 'Pages that link to "User:Animum/easyblock.js" - Wikipedia, the free encyclopedia') {        mw.util.addPortletLink("p-cactions", "javascript:parseusers", "parse", "ca-parse");    } });