User:Quarl/edit top link.js

// User:Quarl/edit_top_link.js

// requires: wikipage.js

// based on http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/Scripts/Add_Edit_Top_Link

// This will add an [edit top] link at the top of all pages except preview pages // by User:Pile0nades

function editTopLink { // if this is preview page or generated page, stop if (previewP || wikiPage.nsSpecialP) return;

// get the page title var pageTitle = wikiPage.page; var editURL = wikiPage.qurl + '&action=edit&section=0';

// create div and set innerHTML to link var divContainer = document.createElement("div"); divContainer.innerHTML = ' [edit top] ';

// insert divContainer into the DOM before the h1 document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]); }

addOnloadHook(editTopLink);