User:Zzuuzz/quickeditcount.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
/* Adds an edit count link to the actions tab of the Special:Contributions page modified from [[User:Ais523/editcount.js]] */ var qecwpajax; qecwpajax = { download:function(bundle) { var x = window.XMLHttpRequest ? new XMLHttpRequest() : window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : false; if (x) { x.onreadystatechange = function() { x.readyState == 4 && qecwpajax.downloadComplete(x, bundle); }; x.open("GET", bundle.url, true); x.send(null); } return x; }, downloadComplete:function(x, bundle) { x.status == 200 && ( bundle.onSuccess && bundle.onSuccess(x, bundle) || true ) || ( bundle.onFailure && bundle.onFailure(x, bundle) || alert(x.statusText) ); } }; function editcount() { qecwpajax.download({url:wgServer + wgScriptPath + '/query.php?what=contribcounter&' + 'titles=User:' + encodeURIComponent(document.forms[0].target.value) + '&format=xml', onSuccess:showeditcount}); } function showeditcount(xmlreq, data) { var ec = xmlreq.responseText.split("<count>")[1].split("</count>")[0]; document.getElementById('ca-editcount').innerHTML = ' edit count: ' + ec + ' '; } addOnloadHook(function() { if(wgNamespaceNumber === -1 && wgTitle == 'Contributions') addPortletLink('p-cactions', 'javascript:editcount()', 'edit count', 'ca-editcount', 'Edit count for ' + document.forms[0].target.value); });

