User:Cneubauer/monobook.js

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); } // 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(,,'');"); 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); } } } //