User talk:Alex Smotrov/edittop.js

From OpenWetWare
Jump to: navigation, search

30px This script has been superseded by MediaWiki:Gadget-edittop.js:

  • either select "Add an [edit] link for the lead section of a page" gadget in your preferences;
  • or use importScript('MediaWiki:Gadget-edittop.js') in your personal js file.

For discussion please use MediaWiki_talk:Gadget-edittop.js.

EditTop is a script that adds an [edit] link above page heading, allowing you to edit the top section of the page.

Unlike other similar scripts that check the page you're on and then construct an [edit] link, this script simply looks for another [edit] link inside level 2 header below, then duplicates it. As a result:

  • good: link url, name and tooltip are always correct, whatever project or user interface language is;
  • good: script obeys "no-section-editing" (either in your preferences or __NOEDITSECTION__ on the page);
  • bad: there's no link if the page doesn't have level 2 headers (but such pages are supposedly short enough anyway).

Script should work in all major browsers. Source code is here.

Automatic (Intro) edit summary can be added with the following code in your monobook.js: <source lang="javascript"> if (wgAction=='edit' && document.URL.indexOf('&section=0') != -1) addOnloadHook(function(){

 document.getElementById('wpSummary').value = '(Intro) '

}) </source> Please do not use /* Intro */<code> as this creates misleading non-existent section link.</small>




This works for, but it's a step down for me since it doesn't add a /* Intro */ or similar thing to the edit summary. Any chance of that being added? --Gwern (contribs) 21:32 19 June 2007 (GMT)

I added it as an extra option: see above. Good luck ∴ Alex Smotrov 22:51, 19 June 2007 (UTC)
Great! Seems to work over here. --Gwern (contribs) 20:41 15 July 2007 (GMT)