User:Paranomia/editcount.js

// scraped from VoA's code function get_editcount_json(user) { document.getElementById('contentSub').innerHTML += ' Grabbing edit count.' + '\n' + 'Please wait... '; gml_xmlhttp = sajax_init_object; if (!gml_xmlhttp) { return; } var pageurl = '/w/api.php?action=query&list=users&ususers=' + escape(user) + '&usprop=editcount&format=json'; gml_xmlhttp.open("GET", pageurl, true); gml_xmlhttp.onreadystatechange = alertcount; gml_xmlhttp.send(null); } function alertcount { if (gml_xmlhttp.readyState !== 4) { return; } json = gml_xmlhttp.responseText; var obj = eval('('+json+')'); var editcount = '(username invalid)'; document.getElementById('contentSub').innerHTML += ' ' + obj.query.users[0].editcount + ' '; }