User:AKfax/monobook.js

importScript('User:AzaToth/morebits.js');

importScript('User:AzaToth/twinklefluff.js');

importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');

importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');

importScript('User:AzaToth/twinklewarn.js');

importScript('User:AzaToth/twinklearv.js');

importScript('User:AzaToth/twinklespeedy.js');

importScript('User:AzaToth/twinklediff.js');

importScript('User:AzaToth/twinkleprotect.js');

$(function () {

if (!wgCanonicalSpecialPageName || wgCanonicalSpecialPageName != "Watchlist") return;

if (!document.forms[0] || !document.forms[0].namespace) return;

var link = document.createElement('a');

link.id = 'listSince';

link.href = '#listSince'; // must have a href to show as link!

var then = +(new Date());

var fixLinkHref = function () {

var url = window.location.href.split('#')[0];

var days = ( +(new Date()) - then )/(1000 * 3600 * 24);

if (url.match(/[?&]days=/))

this.href = url.replace(/([?&]days=)[^&]*/, '$1'+days);

else

this.href = url + (url.indexOf('?') < 0 ? '?':'&') + 'days=' + days;

return true;

};

link.onclick = fixLinkHref;

link.onmousedown = fixLinkHref; // react to middle clicks too

var frag = document.createDocumentFragment();

frag.appendChild(document.createTextNode(' | '));

frag.appendChild(link);

link.appendChild(document.createTextNode('Changes'));

frag.appendChild(document.createTextNode(' since last load.'));

// just one little ID attribute would be _so_ nice...

var nsSelectForm = document.getElementsByTagName('form')[0];

nsSelectForm.parentNode.insertBefore(frag, nsSelectForm);

});

//

/* Category watch (User:ais523/catwatch.js); adds entries on the watchlist if a page is added to a category

(and is still in the category when the watchlist is checked). The entry will only appear if there is another

page on the watchlist edited that day (if the addition was the only change on that day, it's neglected). The

recategorisation of a page in a watched category will also trigger the watching, even if it's a different

category that's added or removed (unless the watched category is removed); removals from the watched category

can't be detected. Categories with more than 100 elements won't be watched for server-load reasons. */

//

var cwwpajax;

// From WP:US mainpage (wpajax renamed to cwwpajax)

cwwpajax={

download:function(bundle) {

// mandatory: bundle.url

// optional: bundle.onSuccess (xmlhttprequest, bundle)

// optional: bundle.onFailure (xmlhttprequest, bundle)

// optional: bundle.otherStuff OK too, passed to onSuccess and onFailure

var x = window.XMLHttpRequest ? new XMLHttpRequest()

: window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP")

: false;

if (x) {

x.onreadystatechange=function() {

x.readyState==4 && cwwpajax.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));

}

};

// Example:

// function dlComplete(xmlreq, data) {

// alert(data.message + xmlreq.responseText);

// }

// cwwpajax.download({url:'http://en.wikipedia.org/w/index.php?title=Thresher&action=raw',

// onSuccess: dlComplete, message: "Here's what we got:\n\n" });

// End of WP:US quote

function cwOntoWatchlist(xmlreq, data)

{

var a=xmlreq.responseText;

var c=data.catname;

var i;

if(a.indexOf("")!=-1) return; //cat is empty, nothing to do here

if(a.indexOf("");

var latesttime=0;

var latestpage="";

var temp, temp2;

for(i in a)

{

temp=a[i].indexOf("");

if(temp!=-1)

{

temp=new Number(a[i].substr(0,temp));

if(temp>latesttime)

{

latesttime=temp;

a[i]=a[i].substr(a[i].indexOf("")+7);</p> <p>latestpage=a[i].substr(0,a[i].indexOf(""));

}

}

}

a=document.getElementsByTagName("h4"); //get dates in the watchlist

var monthname=new Array();

monthname['01']="January";

monthname['02']="February";

monthname['03']="March";

monthname['04']="April";

monthname['05']="May";

monthname['06']="June";

monthname['07']="July";

monthname['08']="August";

monthname['09']="September";

monthname['10']="October";

monthname['11']="November";

monthname['12']="December";

latesttime=new String(latesttime);

temp=""+new Number(latesttime.substr(6,2))+" "+monthname[latesttime.substr(4,2)]+" "+latesttime.substr(0,4);

i=a.length;

while(i--)

{

if(a[i].innerHTML==temp)

{

temp=a[i].nextSibling.firstChild;

while(temp!=null)

{

if(temp.tagName!=null)

if(temp.tagName.toLowerCase()=="li")

{

temp2=temp.innerHTML.match(/; ([0-9][0-9]):([0-9][0-9]) \. \./);

temp2=new Number(temp2[1])*100+new Number(temp2[2]);

if(temp2

}

temp2=temp; temp=temp.nextSibling;

if(temp==null) break;

}

temp=document.createElement("li");

a[i].nextSibling.insertBefore(temp,temp2);

temp.innerHTML="(diff) (hist) . . Category:"+c+"; "+latesttime.substr(8,2)+":"+latesttime.substr(10,2)+" . . (+ "+

""+latestpage+" "+

"(last))";

return;

}

}

}

var WatchedCategories; //prevent error if there isn't a cat-watchlist yet

//An example of a query to check a category would be

//http://en.wikipedia.org/w/query.php?what=category&cptitle=Wikipedia%20protected%20edit%20requests&cplimit=100&cpextended

$(function(){

if(wgPageName=="Special:Watchlist")

{

if(WatchedCategories==undefined)

{

if(confirm("You don't have a category watchlist yet. Do you want to create one?"))

location.href='http://en.wikipedia.org/w/index.php?title=User:'+wgUserName+

'/WatchedCategories.js&action=edit&preload=User:Ais523/WatchedCategoriesTemplate.js';

}

else

{

var i;

for(i in WatchedCategories)

{

var a=WatchedCategories[i];

cwwpajax.download({url:'http://en.wikipedia.org/w/query.php?what=category&cptitle='+encodeURI(a)+

'&cplimit=100&cpextended&format=xml', onSuccess:cwOntoWatchlist, catname:a});

}

}

}

});

// include current user's category watchlist

document.write('');

//

//Category:Wikipedia scripts

// install User:Cacycle/wikEd in-browser text editor

mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'

+ '&action=raw&ctype=text/javascript');

// Script from User:Dr pda/persondata.js

importScript('User:Dr pda/persondata.js'); //User:Dr pda/persondata.js