User:Josette/monobook.js
//
//---------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Script loading function by Quarl (http://en.wikipedia.org/wiki/User:Quarl)
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// loads from en...
function winc(s) {
s = s.replace(/^\[\[/, ).replace(/\]\]$/, );
document.write('');
}
// **** Add tab to tab structure 'tabs' with function 'url' and label 'name'****
function addlilink(tabs, url, name, id){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.id = id;
li.appendChild(na);
tabs.appendChild(li);
return li;
}
function addlimenu(tabset, name, id)
{
var na = document.createElement('a');
na.href = '#';
var mn = document.createElement('ul');
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.id = id;
li.className = 'tabmenu';
li.appendChild(na);
li.appendChild(mn);
tabset.appendChild(li);
return li;
}
//---------------------------------------------------------------
/* like submitting the URL http://en.wikipedia.org/w/index.php?title={{{PAGENAME}}}&action=purge */
// addPurge
$(function () {
var hist; var url;
if (!(hist = document.getElementById('ca-history') )) return;
if (!(url = hist.getElementsByTagName('a')[0] )) return;
if (!(url = url.href )) return;
mw.util.addPortletLink('p-cactions', url.replace(/([?&]action=)history([]|$)/, '$1purge$2'),
'purge', 'ca-purge', 'Purge server cache for this page', 'p');
});
//
// This will add an [edit top] link at the top of all pages except preview pages
function addtoplink()
{
var edittop = '[edit top]';
// if this is preview page or generated page, stop
if(document.getElementById("wikiPreview") || window.location.href.indexOf("w/index.php?title=Special:") != -1) return;
if(document.title.indexOf("Main Page") != -1) return;
// get the page title
var pageTitle = document.title.split(" - ")[0].replace(" ", "_");
// create div and set innerHTML to link
var divContainer = document.createElement("div");
divContainer.innerHTML = '
';// insert divContainer into the DOM before the h1
if (document.getElementById("content") !=undefined) {
document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);}
}
//END
mw.loader.load(
'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s');
//First loads
//Helper tools for tabs
// Helper tools (addtabs mandatory for other functions)
winc('User:Voice_of_All/Addtabs/monobook.js');
// UTC clock
winc('User:Voice_of_All/UTCclock.js');
// Deletion
winc('User:Voice_of_All/Deletion/monobook.js');
// Replace txt
winc('User:Voice_of_All/replacetxt.js');
//************
//MAIN
//************
window.onload = Main;
function Main()
{
changemovetab();
changelinks();
addtoplink();
addtoolboxlinks();
if(addSinceTab)
{addSinceTab();}
}
//END
//************