User:Pcj/CountWikisPerWM.js

a = new mw.Api; wikis = []; a.get({action:"allsites",do:"getSiteStats"}).done(function(data){	wikis=data.data.wikis;	managers = [];	for (w of wikis.filter(wi => wi.wiki_language == "en")) {		mi = managers.findIndex(m => m.name == w.wiki_managers[0]);		if (mi == -1) {			managers.push({name:w.wiki_managers[0],wikis:1});		}		else managers[mi].wikis++;	}   managers.sort(function(a,b){ if (a.wikis>b.wikis) return -1; if (b.wikis>a.wikis) return 1; if (a.name>b.name) return 1; if (b.name>a.name) return -1; return 0; });	console.log(managers); });