User:Cneubauer/monobook.js
(Redirected from User:CSN/monobook.js)
Note: After saving, changes may not occur immediately. Click here to learn how to bypass your browser's cache.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Cmd-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (Cmd-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Clear the cache in Tools → Preferences
For details and instructions about other browsers, see Wikipedia:Bypass your cache.
Code that you insert on this page could contain malicious content capable of compromising your account. If you are unsure whether code you are adding to this page is safe, you can ask at the central discussion page, Scriptorium. The code will be executed when previewing this page under some skins, including Monobook. You can in the interim if you wish to refresh the content sooner under another skin. |
The accompanying .css page for this skin can be added at User:Cneubauer/monobook.css. |
if (window.addEventListener) {
window.addEventListener("load",removeMaxPageSizeMessage,false);
window.addEventListener("load",addScriptorium,false);
window.addEventListener("load",addAuthorTemplateLink,false);
}
else if (window.attachEvent) {
window.attachEvent("onload",removeMaxPageSizeMessage);
window.attachEvent("onload",addScriptorium);
window.attachEvent("onload",addAuthorTemplateLink);
}
function removeMaxPageSizeMessage() {
if(document.getElementById) {
var content = document.getElementById('bodyContent');
var p = content.getElementsByTagName('p')[0];
if(p != null) {
var text = p.firstChild.innerHTML;
var re = /This page is (\d+) kilobytes long/;
var match = re.exec(text);
if(match != null) {
var num = match[1] * 1;
if(num != NaN && num < 100) {
content.removeChild(p);
}
}
}
}
}
// add link to scriptorium
function addScriptorium() {
var div = document.getElementById('p-navigation').getElementsByTagName('div')[0];
var oldul = div.getElementsByTagName('ul')[0];
var lis = oldul.getElementsByTagName('li');
var ul = document.createElement('ul');
var scriptorium = document.createElement('li');
var watchlist = document.createElement('li');
var deletions = document.createElement('li');
var a = document.createElement('a');
a.setAttribute('href', '/wiki/Special:Watchlist');
a.appendChild(document.createTextNode("Watchlist"));
watchlist.appendChild(a);
var a2 = document.createElement('a');
a2.setAttribute('href', '/wiki/Wikisource:Scriptorium');
a2.appendChild(document.createTextNode("Scriptorium"));
scriptorium.appendChild(a2);
var a3 = document.createElement('a');
a3.setAttribute('href', '/wiki/Wikisource:Proposed deletions');
a3.appendChild(document.createTextNode("Proposed deletions"));
deletions.appendChild(a3);
ul.appendChild(scriptorium); // scriptorium
ul.appendChild(lis[3]); // recent changes
ul.appendChild(deletions); // proposed deletions
ul.appendChild(watchlist); // watchlist
ul.appendChild(lis[1]); // community portal
ul.appendChild(lis[2]); // random page
div.replaceChild(ul, oldul);
}
// <nowiki>
function addAuthorTemplateLink() {
if(document.getElementById) {
var loc = '' + window.location;
if(loc.indexOf("action=edit") > -1 || loc.indexOf("action=submit") > -1) {
var toolbar = document.getElementById('toolbar');
var a = document.createElement('a');
a.setAttribute('href',"javascript:insertTags('{{Author|\\n Name=\\n|Dates=\\n|FileUnder=\\n|FirstLetterLastName=\\n|Wikipedia=\\n|Wikiquote=\\n|Wikicommons=\\n|TOC=\\n|MiscBio=\\n|Image=\\n}}','','');");
var img = document.createElement('img');
img.setAttribute('src', "/skins-1.5/common/images/button_headline.png");
img.setAttribute('alt', "Author Template");
img.setAttribute('title', "Author Template");
img.setAttribute('border', "0");
img.setAttribute('height', "22");
img.setAttribute('width', "23");
a.appendChild(img);
toolbar.appendChild(a);
}
}
}
// </nowiki>