User:Cneubauer/monobook.js
From Wikisource
< User:Cneubauer(Redirected from User:CSN/monobook.js)
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Konqueror: Click Reload or press F5
- Opera: Clear the cache in Tools → Preferences
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>