Wikipedia Edit First Section

By Joshua Nelson Last update Nov 1, 2006 — Installed 472 times.
// JavaScript Document
// ==UserScript==
// @name          Wikipedia Edit First Section
// @description   Edit the first section of a story in wikipedia
// @include       http://en.wikipedia.org/wiki/*
// @include       http://en.wikipedia.org/wiki/Main_page*
// ==/UserScript==
//gets the original page for inserting after the customized content.
OriginalPassage = document.getElementById("bodyContent").innerHTML
//sets currentURL to the current URL
currentURL = document.URL
//retreives the topic of the page for later
topic = currentURL.substring(currentURL.lastIndexOf("/") + 1,currentURL.length)
window.edittarget = "http://en.wikipedia.org/w/index.php?title=" + topic + "&action=edit&section=0"
//Splits the eventual target into two parts so that the quotation marks are not mixed up
edithtmlA = '<div style="text-align: right;"> [<a href='
edithtmlB = 'http://en.wikipedia.org/w/index.php?title=' + topic + '&action=edit&section=0> edit </a>]</div>'
document.getElementById("bodyContent").innerHTML = (edithtmlA + edithtmlB + OriginalPassage)