User talk:Alex Smotrov/edittop.js

From Wikipedia, the free encyclopedia

Contents

[edit] EditTop Documentation

The script adds an [edit] link above page heading, allowing you to edit the top section of the page.

It should look like the link in the top right corner of this page (absolutely positioned with CSS as an example).


Unlike other similar scripts this one doesn't check what kind of page you're own but 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 on the other hand, such page is probably short enough anyway)


Installation: copy to your monobook.js

  • either importScript('User:Alex_Smotrov/edittop.js');
  • or raw code from the script page


Tested in FireFox 1.5, Opera 9.10, Internet Explorer 6


[edit] Link under page heading

If you prefer [edit] link below page heading then simply remove

if (document.getElementById('featured-star')) zero.style.marginRight = '25px'

and replace

var parent = document.getElementsByTagName('H1')[0];

with

var parent = document.getElementById('bodyContent');


[edit] Automatic summary

If you would like the edit summary to be automatically set to /* Intro */ (like in other script), also add this to your monobook.js

if (wgAction=='edit' && document.URL.indexOf('&section=0') != -1)
addOnloadHook(function(){
  document.getElementById('wpSummary').value = "/* Intro */ ";
})


[edit] Summary

This works for secure.wikimedia.org, 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)