summaryrefslogtreecommitdiff
path: root/lib/scripts/page.js
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-11-08 23:15:08 +0100
committerAndreas Gohr <andi@splitbrain.org>2012-11-08 23:15:08 +0100
commit04924b7a9d090c0814cfff3e6706263e4d5a46e8 (patch)
treed83fc6b5683fbc9c639bfd1832f96dca2f3c8646 /lib/scripts/page.js
parent1ea7a6bada66fc9b7a45f61b4892e4ea23196d89 (diff)
parenta731ed1d6736ca405b3559adfd9500affcc59412 (diff)
downloadrpg-04924b7a9d090c0814cfff3e6706263e4d5a46e8.tar.gz
rpg-04924b7a9d090c0814cfff3e6706263e4d5a46e8.tar.bz2
Merge branch 'master' into proxyconnect
* master: (169 commits) added PCRE UTF-8 checks to do=check FS#2636 avoid multiple paralell update checks fix regression bug in HTTPClient FS#2621 changed PAGEUTILS_ID_HIDEPAGE to has BEFORE/AFTER TarLib code cleanup TarLib: fixed appending in non-dynamic mode fixed third method of adding files in TarLib fix lone zero block in TarLib created archives fix use of constructor in TarLib Slovak language update Korean language update Latvian language update added event PAGEUTILS_ID_HIDEPAGE added test for isHiddenPage() removed redundant variables in tpl_include_page() (because of 3ff8773b) added cut off points for mobile devices as parameters to style.ini Corrected typo: ruke -> rule Persian language update Spanish language update russian language update ...
Diffstat (limited to 'lib/scripts/page.js')
-rw-r--r--lib/scripts/page.js28
1 files changed, 18 insertions, 10 deletions
diff --git a/lib/scripts/page.js b/lib/scripts/page.js
index 5ac81f33b..4ab0bf9b5 100644
--- a/lib/scripts/page.js
+++ b/lib/scripts/page.js
@@ -22,19 +22,27 @@ dw_page = {
jQuery('form.btn_secedit')
.mouseover(function(){
var $tgt = jQuery(this).parent(),
- nr = $tgt.attr('class').match(/(\s+|^)editbutton_(\d+)(\s+|$)/)[2];
-
- // Walk the DOM tree up (first previous siblings, then parents)
- // until boundary element
- while($tgt.length > 0 && !$tgt.hasClass('sectionedit' + nr)) {
- // $.last gives the DOM-ordered last element:
- // prev if present, else parent.
- $tgt = $tgt.prev().add($tgt.parent()).last();
- $tgt.addClass('section_highlight');
+ nr = $tgt.attr('class').match(/(\s+|^)editbutton_(\d+)(\s+|$)/)[2],
+ $highlight = jQuery(), // holder for elements in the section to be highlighted
+ $highlightWrap = jQuery('<div class="section_highlight"></div>'); // section highlight wrapper
+
+ // Walk the dom tree in reverse to find the sibling which is or contains the section edit marker
+ while($tgt.length > 0 && !($tgt.hasClass('sectionedit' + nr) || $tgt.find('.sectionedit' + nr).length)) {
+ $tgt = $tgt.prev();
+ $highlight = $highlight.add($tgt);
}
+ // insert the section highlight wrapper before the last element added to $highlight
+ $highlight.filter(':last').before($highlightWrap);
+ // and move the elements to be highlighted inside the section highlight wrapper
+ $highlight.detach().appendTo($highlightWrap);
})
.mouseout(function(){
- jQuery('.section_highlight').removeClass('section_highlight');
+ // find the section highlight wrapper...
+ var $highlightWrap = jQuery('.section_highlight');
+ // ...move its children in front of it (as siblings)...
+ $highlightWrap.before($highlightWrap.children().detach());
+ // ...and remove the section highlight wrapper
+ $highlightWrap.detach();
});
},