User:Josette/monobook.js
Appearance
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. |
The accompanying .css page for this skin is at User:Josette/monobook.css. |
//<pre><nowiki>
//---------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Script loading function by Quarl (http://en.wikipedia.org/wiki/User:Quarl)
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// loads from en...
function winc(s) {
s = s.replace(/^\[\[/, '').replace(/\]\]$/, '');
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=' + s
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}
// **** 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 = '<span style="color:black;">[</span>edit top<span style="color:black;">]</span>';
// 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 = '<div class="editsection" style="float:right;margin-left:5px;margin-right:35px;margin-top:3px;"><a href="/w/index.php?title='+pageTitle+'&action=edit§ion=0" title="'+document.title.split(" - ")[0]+'">' + edittop + '</a></div>';
// insert divContainer into the DOM before the h1
if (document.getElementById("content") !=undefined) {
document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);}
}
//END
// [[User:Lupin/popups.js]]
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
//************