summaryrefslogtreecommitdiff
path: root/lib/scripts/page.js
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-11-04 20:19:52 +0100
committerAndreas Gohr <andi@splitbrain.org>2012-11-04 20:19:52 +0100
commit383dc9895eac5f1b8ee2a938bfff4a1482228817 (patch)
treea6af696a4ecd6259628f2885e23eadb637603b30 /lib/scripts/page.js
parentecd445c000e4e54bf7228890848222312cffd3e3 (diff)
parent2005b6b650f2523cb58a005961a55a6f099c70c3 (diff)
downloadrpg-383dc9895eac5f1b8ee2a938bfff4a1482228817.tar.gz
rpg-383dc9895eac5f1b8ee2a938bfff4a1482228817.tar.bz2
Merge branch 'master' into future
* master: (45 commits) 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 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 Kazach language update correctly check hash parameter in media dispatcher FS#2648 avoid broken browser_uid on IE Removed acronyms for "Perl" and "PERL" as Perl is not an acronym. See http://learn.perl.org/faq/perlfaq1.html#Whats-the-difference-between-perl-and-Perl- Made striplangs.php executable release preparations ...
Diffstat (limited to 'lib/scripts/page.js')
-rw-r--r--lib/scripts/page.js33
1 files changed, 18 insertions, 15 deletions
diff --git a/lib/scripts/page.js b/lib/scripts/page.js
index b8e83cb0c..4ab0bf9b5 100644
--- a/lib/scripts/page.js
+++ b/lib/scripts/page.js
@@ -22,24 +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)) {
- // go down when the sectionedit begin marker is below $tgt
- if ($tgt.find('.sectionedit' + nr).length > 0) {
- $tgt = $tgt.children().last();
- } else {
- // $.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();
});
},