Jump to content

User:Efitu/monobook.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
function efitu_addRawLink(){
var pca = document.getElementById("p-cactions");
var pca_li = pca.getElementsByTagName("ul")[0];

if (!(/^Special:/i).test(wgPageName))
pca_li.appendChild(
efitu_newLi("download-source", "Download",
"Downloads a copy of the page's source code to your computer.",
"http://" + wgContentLanguage + ".wikipedia.org" + wgScript +
"?title=" + encodeURIComponent(mw.config.get('wgPageName')) + "&action=raw"
));

}

function efitu_newLi(id, text, title, href){
var li = document.createElement("li");
li.id = id;
var a = document.createElement("a");
a.appendChild(document.createTextNode(text));
a.href = href;
a.title = title;
li.appendChild(a);
return li;
}

window.addEventListener('load', efitu_addRawLink, false);


importScript('User:AzaToth/twinkle.js');