// jncsp-start The section below (up to jncsp-end) is maintained by [[Wikipedia:WikiProject_User_scripts/User-script_manager]]
// jncsp-config addEditSection0 addPurgeTab addLastDiff
if (location.href == "http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/User-script_manager")
document.write('<script type="text/javascript" src="http://en.wikipedia.org/w' +
'/index.php?title=User:Jitse_Niesen/Client-side_preferences/Main.js&action=raw&ctype=text/javascript"></script>');
// From [[Wikipedia:WikiProject User_scripts/Scripts/Add_LI_link]], revision 28011435
function addlilink(tabs, url, name, id, title, key){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
if(id) li.id = id;
li.appendChild(na);
tabs.appendChild(li);
if(id)
{
if(key && title)
{
ta[id] = [key, title];
}
else if(key)
{
ta[id] = [key, ''];
}
else if(title)
{
ta[id] = ['', title];
}
}
// re-render the title and accesskeys from existing code in wikibits.js
akeytt();
return li;
}
// From [[Wikipedia:WikiProject User_scripts/Scripts/Add_tab]], revision 57703819
function addTab(url, name, id, title, key){
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
return addlilink(tabs, url, name, id, title, key)
};
// From [[Wikipedia:WikiProject User_scripts/Scripts/Show_last_diff]], revision 67477415
//From http://en.wikipedia.org/w/index.php?title=User:JesseW/monobook.js&oldid=20755510
// addLastDiff
$(function () {
z=document.getElementById("content").childNodes;
for (var n=0;n<z.length;n++) {
if (z[n].className=="firstHeading") {
var pname=z[n].textContent ? z[n].textContent : z[n].innerText;
}
}
var l=addTab("http://en.wikipedia.org/w/index.php?title=" + pname + "&diff=cur&oldid=prev", 'last', '');
l.lastChild.title="Show most recent diff";
});
// From [[Wikipedia:WikiProject User_scripts/Scripts/addLink]], revision 42043964
function addLink(where, url, name, id, title, key, after){
//* where is the id of the toolbar where the button should be added;
// i.e. one of "p-cactions", "p-personal", "p-navigation", or "p-tb".
//
//* url is the URL which will be called when the button is clicked.
// javascript: urls can be used to do more complex things.
//
//* name is what will appear as the name of the button.
//
//* id is the id of the button; it's best to define one.
// Use a prefix to make sure its unique. Optional.
//
//* title is the tooltip title that gives a longer description
// of the button; if you define a accesskey, mention it here. Optional.
//
//* key is the char you want for the accesskey. Optional.
//
//* after is the id of the button you want to follow this one. Optional.
//
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
if(id) li.id = id;
li.appendChild(na);
var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
if(after) {
tabs.insertBefore(li,document.getElementById(after));
} else {
tabs.appendChild(li);
}
if(id) {
if(key && title) { ta[id] = [key, title]; }
else if(key) { ta[id] = [key, '']; }
else if(title) { ta[id] = ['', title];}
}
// re-render the title and accesskeys from existing code in wikibits.js
akeytt();
return li;
}
// From [[Wikipedia:WikiProject User_scripts/Scripts/Add_purge_to_tabs]], revision 33908589
// addPurge
$( function (){
var x = document.getElementById('ca-history');
if(!x) return;
if(x.children) x = x.children[0].href;
else x = x.childNodes[0].href;
addLink("p-cactions", x.replace(/=history/, "=purge"), 'purge', 'ca-purge', 'Purge the internal cache for this page', 0);
});
// From [[Wikipedia:WikiProject User_scripts/Scripts/Add_edit_section_0]], revision 33908474
//If you are not editing a page, a tab will appear allowing you to edit the 0th section of a page (the top area usually used as an introduction.
function addEditSection0() {
ta['ca-edit-0'] = ['', 'Edit the zeroth section of this page'];
if (!document.getElementById) return;
x = document.getElementById('ca-edit');
if(!x) return;
y = document.createElement('LI');
y.id = 'ca-edit-0';
if (x.className == 'selected') {
if (/&action=edit§ion=0$/.test(window.location.href)) {
x.className = 'istalk';
y.className = 'selected';
} else {
x.className = 'selected istalk';
}
} else if (x.className == 'selected istalk') {
if (/&action=edit§ion=0$/.test(window.location.href)) {
x.className = 'istalk';
y.className = 'selected istalk';
} else {
y.className = 'istalk';
}
} else {
y.className = x.className;
x.className = 'istalk';
}
z = document.createElement('A');
if (x.children) {
z.href = x.children[0].href + '§ion=0';
z.appendChild(document.createTextNode('0'));
y.appendChild(z);
document.getElementById('p-cactions').children[1].insertBefore(y,x.nextSibling);
} else {
z.href = x.childNodes[0].href + '§ion=0';
z.appendChild(document.createTextNode('0'));
y.appendChild(z);
document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling);
}
}
if (document.title.indexOf("Editing ") == -1) {
addOnloadHook(addEditSection0);
}
// jncsp-end