diff options
author | Andreas Gohr <andi@splitbrain.org> | 2012-10-13 13:19:18 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2012-10-13 13:19:18 +0200 |
commit | 51ac8ceac09c3fd35b5bf0a1ae8665c792cc7419 (patch) | |
tree | 3bd542088f8732f3e37d33c7795dd949f9295594 /lib/scripts/page.js | |
parent | 955290461b4caad351e55a5d037492acc9318cd3 (diff) | |
parent | 41c22da8bcdc9a844d7605440fa4c5ba19b97471 (diff) | |
download | rpg-51ac8ceac09c3fd35b5bf0a1ae8665c792cc7419.tar.gz rpg-51ac8ceac09c3fd35b5bf0a1ae8665c792cc7419.tar.bz2 |
Merge branch 'master' into stable
* master: (54 commits)
release preparations
RTL and IE7 fixes for code blocks
beautified code blocks, also using lighter background colour (FS#2444)
improved section highlighting styles
removed unnecessary print styles
fixed interwiki and filetype styles being included in all css modes
moved some styles around
improved tab styles
fixed typo in style.ini
Brazilia Portuguese language update
#2541, alter section highlighting to insert a container into the DOM to hold the elements being highlighted & later remove it
fixed lib/tpl/index.php to reflect recent changes
changed local style.ini to be merged with standard one
removed template dependencies from underscored CSS files in new default template
fixed 2-digit ordered list items in sidebar (FS#2624)
improved grammar in preview text (FS#2614)
improvements to h1 in sidebar (follow font size scale + vertical grid)
adjusted h1 size in sidebar
fixed warning in popularity plugin FS#2628
added support for local style.ini files
...
Diffstat (limited to 'lib/scripts/page.js')
-rw-r--r-- | lib/scripts/page.js | 33 |
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(); }); }, |