MediaWiki talk:Gadget-edittop.js/Archive 1
Introduction{{editprotected}} Please change "first section" to "introduction", since I read "first section" as the text contained within the first header, not before it (and suspect others might as well). GracenotesT § 04:56, 20 December 2007 (UTC)
Fixes: icons and uncluded sectionsPlease replace the current code with the one below. The new version:
∴ AlexSm 21:04, 21 January 2008 (UTC) if (wgAction == 'view' && wgNamespaceNumber >=0)
addOnloadHook(editTopSection)
function editTopSection(){
var h2s = document.getElementsByTagName('H2')
var h2 = h2s[0]
if (!h2) return
if (h2.parentNode.id == 'toctitle') h2 = h2s[1]
if (!h2) return
var span = h2.firstChild
if (!span || span.className != 'editsection') return
var zero = span.cloneNode(true)
if (document.getElementById('featured-star')) zero.style.marginRight = '20px'
if (document.getElementById('spoken-icon')) zero.style.marginRight = '40px'
if (document.getElementById('administrator') && zero.style.marginRight) zero.style.marginRight = '65px'
var parent = document.getElementsByTagName('H1')[0]
parent.insertBefore(zero, parent.firstChild)
var a = zero.getElementsByTagName('A')[0]
if (a.href.indexOf('§ion=T') == -1 )
a.title = a.title.replace(/:.*$/,': 0')
else
a.title = 'Edit section: 0'
a.setAttribute('href', wgScript + '?title='+wgPageName + '&action=edit§ion=0')
}
I have added the checks for other absolute iconsI can't understand what the other code does, and I've added localization anyway so it would have to be changed. —Random832 18:21, 29 January 2008 (UTC)
Localization ErrorLine 14, ja: ... - this line ends with a comma which appears to be an error since it the last item in the initialization list. Franamax (talk) 00:09, 30 January 2008 (UTC) Selecting the title with a triple-clickOne of the more annoying side effects of an editlink after the title is that a tripleclick (which could have been used before to comfortably select the title) also selects the [edit] texts. Is it possible to circumvent this somehow? (I experimented with -moz-user-select:none and selectable=no on huwiki, where top level edit link is on by default, but neither worked. On the other hand, the selected region seemed to be based - at least in Firefox - on the limits of the block level element, not on the visual position, so some clever HTML formatting might be able to help.) --Tgr (talk) 21:00, 28 February 2008 (UTC)
In FF2 the [edit] text is not highlighted if its set to -moz-user-select:none, but it still gets copyed to the clipboard (and i think selectable doesn't even make it through the sanitizer). --Tgr (talk) 09:33, 29 February 2008 (UTC)
What makes it move to the leftOr better... what triggers it to move to the left? I'm puzzled because the top edit link overlaps the {{Administrator}} icon on user pages (and the template page itself), eventhough it has "administartor" as it's id. — Edokter • Talk • 13:17, 6 March 2008 (UTC)
if (document.getElementById('featured-star') || document.getElementById('top-icon')) zero.style.marginRight = '25px'; Bug: Templates with transcluded documentationThe script show an edit link on templates with thanscluded {{documentation}}, and susequently (and erroniously) links to the first section of the documentation page. This can be filtered out by changing if (!span || span.className != 'editsection') return; to if (!span || span.className != 'editsection' || span.id = 'doc_editlinks') return; — Edokter • Talk • 14:11, 8 March 2008 (UTC)
Nostalgia skinIs this meant to be used only with the MonoBook skin? A version of this compatible with the Nostalgia skin would be highly desirable. NerdyNSK (talk) 10:11, 6 October 2008 (UTC)
Included sections fix
if(localtitles[wgUserLanguage]) a.title = localtitles[wgUserLanguage];
// TODO check for content of header, to get a more precise replacement
else a.title = a.title.replace(/:.*$/,': 0');
})
with if (a.href.indexOf('§ion=T') == -1){
a.title = a.title.replace(/:.*$/,': 0')
a.setAttribute('href', a.href.replace(/§ion=\d+/,'§ion=0'));
}else{//transcluded
a.title = localtitles['en']
a.setAttribute('href', wgScript+'?title='+encodeURIComponent(wgPageName)+'&action=edit§ion=0')
}
if (localtitles[wgUserLanguage]) a.title = localtitles[wgUserLanguage]
})
to make sure the gadget works properly on the pages where the 1st section is transcluded from another page. It has been discussed before (see top section) but never implemented. —AlexSm 16:00, 6 October 2008 (UTC)
Incorrect section link + requestHey Alex, I've noticed that occasionally when using this script, clicking the edit link will bring up the edit screen for section 2 instead of section 0. I have a sneaking suspicion this has to do with improper use of headers on the page in question (e.g. the first header is level 3 instead of level 2), but I'll have to try and track down one of the pages it happens on, and maybe whip up a testpage in my userspace for you. In addition, would it be possible for you to modify this script to also add a lead edit link when you're looking through an article's history and you arrive at the current revision (for instance, User:Dinoguy1000/List of Shaman King chapters most recent diff as of today)? Note that in such cases, edit links are provided for all other sections, and I think there are at least two obvious ways for you to check for whether it's the diff of the current revision. I can't count the number of times I've wanted to do this, but been forced to click to view the article before clicking the lead edit link. Thoughts? —Dinoguy1000 16:35, 4 October 2008 (UTC)
This discussion was moved here from User talk:Alex Smotrov/edittop.js —Dinoguy1000 20:04, 6 October 2008 (UTC)
All right, since Edokter implemented your edit request, the edit link on my sample page correctly refers to section 0 now. —Dinoguy1000 21:22, 6 October 2008 (UTC) Hey alex, where in the code would I insert the "getElementsByClassName" snippet above to enable edittop links on diff pages? I've decided that this is bugging me too much, so I'm gonna copy the code to my userspace and modify it, even at the cost of a little page execution time. —Dinoguy1000 22:17, 22 October 2008 (UTC) No edit link on pages with no level two sectionsSee for example Legend of the Galactic Heroes release history, a list with all level three headers. As you can see, there's no edit link for the lead being inserted. —Dinoguy1000 18:02, 25 October 2008 (UTC)
Spanish translationI think "Editar sección superior" would be a good Spanish translation of "Edit lead section" (although it actually translates to "Edit top section", the meaning is basically the same... see also en --> es Google translation of "Edit lead section" & "Edit top section" and the reverse translation of the resulting phrases). —Dinoguy1000 01:24, 25 November 2008 (UTC) New version that is aware of any topiconI have created a new version of this script. diff User:TheDJ/Gadget-edittop.js. It will put the edit section always at the far right, and moves topicons (including those in userspace) to the left by the amount of pixels the edit section occupies. Any objections to such changes ? --TheDJ (talk • contribs) 11:38, 25 November 2008 (UTC)
regex{{editprotected}} please change line a.title = a.title.replace(/:.*$/,': 0')
to a.title = a.title.replace(/(: ?|:).*$/,'$10')
so that it can support languages using full-width colons, such as Chinese. --Liangent (talk) 14:18, 16 July 2009 (UTC)
Czech translation{{Editprotected}} Hi, please add Czech translation of "Edit lead section": cs: 'Editovat úvodní sekci', Thanks. --Sevela.p 17:47, 1 March 2010 (UTC)
Korean translation{{Editprotected}} Please add Korean translation of "Edit lead section": ko: '도입부를 편집', Thanks. -- ChongDae (talk) 14:07, 26 March 2010 (UTC)
Edit link too large in VectorEver noticed that in Vector, the page title, being a h1.firstHeading span.editsection {font-size: 50%;}
|
Portal di Ensiklopedia Dunia