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.
///////////////////////////////////////// User watchlist //// by Tra /////////////////////////////////////////functionuwdownload(bundle){// mandatory: bundle.url// optional: bundle.onSuccess (xmlhttprequest, bundle)// optional: bundle.onFailure (xmlhttprequest, bundle)// optional: bundle.otherStuff OK too, passed to onSuccess and onFailurevarx=window.XMLHttpRequest?newXMLHttpRequest():window.ActiveXObject?newActiveXObject("Microsoft.XMLHTTP"):false;if(x){x.onreadystatechange=function(){if(x.readyState==4){uwdownloadComplete(x,bundle);}};x.open("GET",bundle.url,true);x.send(null);}returnx;}functionuwdownloadComplete(x,bundle){if(x.status==200){bundle.onSuccess(x,bundle);}else{bundle.onFailure(x,bundle);alert(x.statusText);}}functionuwgetstartdate(uwdate){vartempvar=''if(navigator.userAgent.indexOf("Firefox")!=-1){tempvar=uwdate.getYear()+1900}else{tempvar=uwdate.getYear()}tempvar+=''if((uwdate.getMonth()+1)<10){tempvar+='0'}tempvar+=(uwdate.getMonth()+1)tempvar+=''if(uwdate.getDate()<10){tempvar+='0'}tempvar+=uwdate.getDate()tempvar+='000000'returntempvar}window.gettingWatchlist=false;uwwatchlist=null;functionuwgetWatchlist(){window.gettingWatchlist=true;uwdownload({url:'http://'+document.___location.hostname+'/wiki/Special:Watchlist?action=raw',onSuccess:uwprocessWatchlist,onFailure:function(){setTimeout(uwgetWatchlist,15000);returntrue;}});}functionuwprocessWatchlist(req,bundle){varwatchlist={};varlines=req.responseText.split('\n');varh1=document.getElementsByTagName('h1')[0]varmyinfo=document.createElement('ul');h1.parentNode.appendChild(myinfo);varuwnspg=''varuwinlist='no'varuwpropline=''varuwdonestart='no'varuwquerystring=''varuwcountusers=0varuwnow=newDate()varh1=document.getElementsByTagName('h1')[0]varuwoutput=document.createElement('div');h1.parentNode.appendChild(uwoutput);uwoutput.innerHTML='';for(vari=0;i<lines.length;++i){//myinfo.innerHTML += 'one'if(lines[i].indexOf('<textarea')>-1){uwinlist='yes';}if(lines[i].indexOf('</textarea')>-1){uwinlist='no';}if(uwinlist=='yes'){uwpropline=lines[i];uwnspg=uwpropline.split(':');// eliminate all but user or user talk pagesif((uwnspg[0]=='User'||uwnspg[0]=='User talk')&&uwpropline.split('/')[0]==uwpropline&&uwcountusers<25){if(uwdonestart=='yes'){uwquerystring+='|'}uwdonestart='yes'uwquerystring+='User:'+uwnspg[1]uwcountusers+=1if(uwcountusers==25){//send and process stuffuwquerystring+='&uclimit=20&ucstart='+uwgetstartdate(uwnow)+'&uccomments&format=json&dummy='+parseInt(Math.random()*99999999)//myinfo.innerHTML += ('http://' + document.___location.hostname + '/w/api.php?action=query&list=usercontribs&titles=' + uwquerystring + '<b>stop</b>');uwdownload({url:'http://'+document.___location.hostname+'/w/api.php?action=query&list=usercontribs&titles='+uwquerystring,onSuccess:function(req,bundle){uwoutput.innerHTML+=uwprocessuserwatchlist(req.responseText);if(typeof(window.setupTooltips)!='undefined'){setupTooltips(uwoutput);}}});uwcountusers=0uwquerystring=''uwdonestart='no'}}}}uwquerystring+='&uclimit=20&ucstart='+uwgetstartdate(uwnow)+'&uccomments&format=json&dummy='+parseInt(Math.random()*99999999)// myinfo.innerHTML += '<li>' + uwquerystring + '</li>'//myinfo.innerHTML += ('http://' + document.___location.hostname + '/w/api.php?action=query&list=usercontribs&titles=' + uwquerystring);//if (uwcountusers == 25) {myinfo.innerHTML += 'For performance reasons, only the first 25 users on your watchlist are shown.';}uwdownload({url:'http://'+document.___location.hostname+'/w/api.php?action=query&list=usercontribs&titles='+uwquerystring,onSuccess:function(req,bundle){uwoutput.innerHTML+=uwprocessuserwatchlist(req.responseText);if(typeof(window.setupTooltips)!='undefined'){setupTooltips(uwoutput);};uwloadingmsg.innerHTML='';}});// at very end// uwoutput.innerHTML = uwtempoutput;// if (typeof(window.setupTooltips)!='undefined') { setupTooltips(uwoutput); }// uwloadingmsg.innerHTML = ''}functionuwmid(str,start,len)/*** IN: str - the string we are LEFTing start - our string's starting position (0 based!!) len - how many characters from start we want to get RETVAL: The substring from start to start+len ***/{// Make sure start and len are within proper boundsif(start<0||len<0)return"";variEnd,iLen=String(str).length;if(start+len>iLen)iEnd=iLen;elseiEnd=start+len;returnString(str).substring(start,iEnd);}functionuwtimefromdate(uwdate){returnuwmid(uwdate,11,5)}// function uwuwprocessuserwatchlistfunctionuwprocessuserwatchlist(uwrsp){// alert(uwrsp);// uwoutput.innerHTML += uwrspvaruwtempoutput=''varuwdata=eval('('+uwrsp+')');varuwusernum=Math.random()*99999999;varuwcontribnum=0;varuwobjcontribvaruwusernameuwtempoutput+='';// uwtempoutput += uwdata.pages.length;// uwtempoutput += uwdata.pages.items[0].title;for(propinuwdata.pages){if(uwdata.pages[prop].contributions.length>0){uwusername=uwdata.pages[prop].title.split(':')[1]uwtempoutput+='<span id="RCM'+uwusernum+'"><a href="javascript:toggleVisibility(\'RCI'+uwusernum+'\',\'RCM'uwtempoutput+=uwusernum+'\',\'RCL'+uwusernum+'\')"><img src="/skins-1.5/common/images/Arr_r.png"'uwtempoutput+=' width="12" height="12" alt="+" /></a></span><span id="RCL'+uwusernum+'" style="display:none">'uwtempoutput+='<a href="javascript:toggleVisibility(\'RCI'+uwusernum+'\',\'RCM'+uwusernumuwtempoutput+='\',\'RCL'+uwusernum+'\')"><img src="/skins-1.5/common/images/Arr_d.png" width="12"'uwtempoutput+=' height="12" alt="-" /></a></span><tt> </tt>'uwtempoutput+='<a href="/wiki/User:'+uwusername+'" title="User:'+uwusername+'">'+uwusernameuwtempoutput+='</a> (<a href="/wiki/User_talk:'+uwusername+'" title="User talk:'+uwusernameuwtempoutput+='">Talk</a> | <a href="/w/index.php?title=Special:Contributions&target='+uwusernameuwtempoutput+='" title="Special:Contributions">contribs</a>)'+'<br />';uwtempoutput+='<div id="RCI'+uwusernum+'" style="display:none">'for(uwcontribnum=0;uwcontribnum<uwdata.pages[prop].contributions.length;++uwcontribnum){uwobjcontrib=uwdata.pages[prop].contributions[uwcontribnum]uwtempoutput+='<img src="/skins-1.5/common/images/Arr_.png" width="12" height="12" alt=" " />'uwtempoutput+='<tt> </tt>'uwtempoutput+='<tt><a href="/w/index.php?title='+uwobjcontrib['*']+'&oldid='+uwobjcontrib.reviduwtempoutput+='" title="'+uwobjcontrib['*']+'">'+uwtimefromdate(uwobjcontrib.timestamp)+'</a></tt> 'uwtempoutput+='(<a href="/w/index.php?title='+uwobjcontrib['*']uwtempoutput+='&action=history" title="'+uwobjcontrib['*']+'">hist</a>) (<a href="/w/index.php?title='uwtempoutput+=uwobjcontrib['*']+'&diff=prev&oldid='+uwobjcontrib.revid+'" title="'+uwobjcontrib['*']uwtempoutput+='">diff</a>) <a href="/wiki/'+uwobjcontrib['*']+'" title="'+uwobjcontrib['*']+'">'uwtempoutput+=uwobjcontrib['*']+'</a> '+(typeofuwobjcontrib['minor']=='undefined'?'':'<b>m </b>')uwtempoutput+='<span class="comment">('+uwobjcontrib.comment+')</span>'uwtempoutput+=(typeofuwobjcontrib['top']=='undefined'?'':' <b>(top)</b>')+'<br />'}uwtempoutput+='</div>'++uwusernum}}uwtempoutput+='';returnuwtempoutput}// **************************************************// Installation// **************************************************functionuwaddlilink(tabs,url,name,id,title,key){varna=document.createElement('a');na.href=url;na.appendChild(document.createTextNode(name));varli=document.createElement('li');if(id)li.id=id;li.appendChild(na);tabs.appendChild(li);if(id){if(key&&title)ta[id]=[key,title];elseif(key)ta[id]=[key,''];elseif(title)ta[id]=['',title];}// re-render the title and accesskeys from existing code in wikibits.jsakeytt();returnli;}functionuwaddToolboxLink(url,name,id){vartb=document.getElementById('p-tb').getElementsByTagName('ul')[0];uwaddlilink(tb,url,name,id);}varuwloadingmsgfunctionuwloadapp(){//var h1=document.getElementsByTagName('h1')[0]// var uwoutput=document.createElement('div');//h1.innerHTML = 'User watchlist';uwaddToolboxLink('http://'+document.___location.hostname+'/wiki/'+'User:Kevin_Forsyth/User watchlist','User watchlist','uw_link');if(wgPageName=='User:Kevin_Forsyth/User_watchlist'){//varh1=document.getElementsByTagName('h1')[0]uwloadingmsg=document.createElement('div');h1.parentNode.appendChild(uwloadingmsg);uwloadingmsg.innerHTML='Loading...'uwgetWatchlist()}//}addOnloadHook(uwloadapp)