Please check
[[:en:User:Dschwen/HighlightSection.js]]
include in monobook.js, refresh cache, etc., you know the drill
Some comments in the code would be good so it could be better
reviewed.
It's relly simple:
onmouseover:
1. Take the parent of the editsection span (which contains the [edit] link).
2. This parent should be some kind of heading, determine its level (H1, H2,
H3, etc. ) and store it.
3. Iterate over all nextSiblings in the DOM tree, as long as the 'level' of
the current element is bigger than the level of the original heading (non
heading elements have level 10).
4. If the current element has nodeType 1 (HTML tag), get its
style.backgroundColor and store it in a new property (oldBGcol)
5. set style.backgroundColor to babyblue
onmouseout:
1. - 3. as above
4. if the current element has an oldBGcol property, copy it to
style.backgroundColor (restores the original bgcolor should it ever be set)
done
Also, I'd imagine a single box surrounding all the
code
(including the header itself) would look quite a bit nicer. That
Mh, this would
require serious DOM tree gymnastics, but should be doable.
--
[[:en:User:Dschwen]]
[[:de:User:Dschwen]]
[[:fr:User:Dschwen]]
[[:commons:User:Dschwen]]