User:LouCypher/vector.js

(function { /* This program is free software. It comes without any warranty, to * the extent permitted by applicable law. You can redistribute it * and/or modify it under the terms of the Do What The Fuck You Want * To Public License, Version 2, as published by Sam Hocevar. See * http://sam.zoy.org/wtfpl/COPYING for more details. */

// @name           Edit 1st Section // @description    Allow editing the first section // @author         LouCypher // @version        2.0 // @license        WTFPL http://sam.zoy.org/wtfpl/ // @homepage       http://userscripts.org/scripts/show/106314

var isArticle = wgIsArticle; if (!isArticle) return; var pageName = wgPageName; var head = document.querySelector("#content > #firstHeading"); var span = head.parentNode.insertBefore(document.createElement("span"), head); span.className = "editsection"; span.style.fontSize = "80%"; span.textContent = "[";

var link = span.appendChild(document.createElement("a")); link.title = "Edit section: " + head.textContent; link.setAttribute("href", "/w/index.php?title=" + pageName + "&action=edit&section=0"); link.textContent = "edit"; span.appendChild(document.createTextNode("]")); })