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.
// see http://en.wikipedia.org/wiki/User:Interiot/Tool2 for instructions on adding this to your monobook.js// To run this tool on other servers:// 1. copy this script to the target server (this is required because of javascript cross-site security restrictions)// 2. update the following URL// for example: "User:Interiot/Tool2/code.js"vartool2_url="User:Interiot/Tool2/code.js";// 3. update this namespace list, extracted from something like http://en.wikiquote.org/wiki/Special:Export//varnamespaces=["Talk","User","User talk","Wikiquote","Wikiquote talk","Image","Image talk","MediaWiki","MediaWiki talk","Template","Template talk","Help","Help talk","Category","Category talk"];// TODO:// - the current document.___location method doesn't work when the page is accessed sans-mod_rewrite// - test with non-ASCII characters// - non-ascii usernames// - ??functionaddOnloadFunction(f){if(window.addEventListener)window.addEventListener("load",f,false);elseif(window.attachEvent)window.attachEvent("onload",f);else{varoldOnload='_old_onload_'+addOnloadFunction.uid;addOnloadFunction[oldOnload]=window.onload?window.onload:function(){};window.onload=function(){addOnloadFunction[oldOnload]();f();}++addOnloadFunction.uid;}}varprefix="";varparams=parse_params();addOnloadFunction(function(){varpath_len=document.___location.pathname.length;// trigger once we view the right pageif(document.___location.pathname.substring(path_len-tool2_url.length,path_len)==tool2_url){// get the prefix (needs to be fixed to work sans-mod_rewriteprefix=document.___location.protocol+"//"+document.___location.host+"/"+document.___location.pathname.substring(1,path_len-tool2_url.length);// blank the inner contents of the pagevarbodyContent=document.getElementById("bodyContent");while(bodyContent.childNodes.length>0)bodyContent.removeChild(bodyContent.lastChild);if(document.___location.search.length==0){generate_input_form(bodyContent);}else{generate_main_report(bodyContent);}}});functiongenerate_input_form(bodyContent){bodyContent.innerHTML="<form><table><tr><td>Username <td><input maxlength=128 name=username value='' title='username'>"+" <tr><td> <td><input type=submit value='Submit'>"+"</table></form>";varform=bodyContent.getElementsByTagName("form")[0];form.method="get";form.action=document.___location;}functiongenerate_main_report(){fetch_data(params["username"],"",output_main_report,[]);}functionoutput_main_report(data){}functionfetch_data(username,end_date,handler,output){varurl=prefix+"Special:Contributions/"+username+"?offset=0&limit=5000";alert(url);loadXMLDoc(url,function(request){if(request.readyState==4&&request.status==200)alert("received a page with "+request.responseText.length+" bytes");});}// ===================================== utility functions =========================================functionparse_params(){varpairs=document.___location.search.substring(1).split("&");varret=[];for(vari=0;i<pairs.length;i++){varvalues=pairs[i].split("=");ret[values[0]]=unescape(values[1]);}returnret;}functionloadXMLDoc(url,handler){// branch for native XMLHttpRequest objectif(window.XMLHttpRequest){req=newXMLHttpRequest();req.onreadystatechange=function(){handler(req)};req.open("GET",url,true);req.send(null);// branch for IE/Windows ActiveX version}elseif(window.ActiveXObject){req=newActiveXObject("Microsoft.XMLHTTP");if(req){req.onreadystatechange=function(){handler(req)};req.open("GET",url,true);req.send();}}}