Kasutaja:Samurai/editsection.js
Märkus: Võimalik, et pärast avaldamist tuleb muudatuste nägemiseks brauseri puhver tühjendada.
- Firefox / Safari: Hoia all Shift-klahvi ja klõpsa Laadi uuesti või vajuta kas Ctrl-F5 või Ctrl-R (Macis ⌘-R).
- Google Chrome: Vajuta Ctrl-Shift-R (Macis ⌘-Shift-R).
- Internet Explorer / Edge: Hoia all Ctrl-klahvi ja klõpsa Värskenda või vajuta Ctrl-F5.
- Opera: Vajuta Ctrl-F5.
$(function () {
// if this is preview page or generated page, stop
if(
document.getElementById("wikiPreview") ||
document.getElementById("histlegend") ||
document.getElementById("difference") ||
document.getElementById("watchdetails") ||
document.getElementById("ca-viewsource") ||
window.location.href.indexOf("/wiki/Special:") != -1 ||
wgPageName == "Main_Page"
) {
if(window.location.href.indexOf("&action=edit§ion=0") != -1) {
document.getElementById("wpSummary").value = "/* top */ ";
}
return;
};
// get the page title
var pageTitle = wgPageName;
// create div and set innerHTML to link
var divContainer = document.createElement("div");
divContainer.innerHTML = '<div class="editsection">[<a href="/w/index.php?title='+pageTitle+'&action=edit§ion=0" title="Edit section: 0">edit</a>]</div>';
// insert divContainer into the DOM below the h1
if(window.location.href.indexOf("&action=edit") == -1 && wgNamespaceNumber == "0") {
document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);
}
});