User:INoMed/common.js: Difference between revisions

Undid edit by INoMed: Turns out that it actually doesn't halt the process on special pages, which is not what I want.
(Hang on)
(Undid edit by INoMed: Turns out that it actually doesn't halt the process on special pages, which is not what I want.)
 
Line 65: Line 65:
   }
   }
);
);
// Add an [edit] link to pages
addOnloadHook(function () {
if(
// document.getElementById("wikiPreview") ||
document.getElementById("histlegend‎") ||
document.getElementById("difference‎") ||
document.getElementById("watchdetails") ||
document.getElementById("ca-viewsource") ||
window.location.href.indexOf("/index.php?title=Special:") != -1
) {
if(window.location.href.indexOf("&action=edit&section=0") != -1) {
document.getElementById("wpSummary").value = "/* Intro */ ";
}
return;
};
var pageTitle = wgPageName;
var divContainer = document.createElement("div");
divContainer.innerHTML = '<div class="editsection" style="font-family: raleway;color:black;margin: 1em 0 0 0;text-align:right;float:right;">[<a href="/w/index.php?title='+pageTitle+'&action=edit&section=0" title="Edit section: '+pageTitle+'">Edit top</a>]</div>';
if(window.location.href.indexOf("&action=edit") == -1) {
document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);
}
});