diff options
author | Andreas Gohr <andi@splitbrain.org> | 2009-02-14 17:11:35 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2009-02-14 17:11:35 +0100 |
commit | 6b6b9e2699e5bbdef7b605a5b58c7827ad5137d2 (patch) | |
tree | 5a5b6ab863fe657f80a42ed37829f1e47321f834 /lib/scripts | |
parent | 68df1afc7421053a4c32c82db32e66cd2e19802f (diff) | |
download | rpg-6b6b9e2699e5bbdef7b605a5b58c7827ad5137d2.tar.gz rpg-6b6b9e2699e5bbdef7b605a5b58c7827ad5137d2.tar.bz2 |
highlight section on section edit button mouseover
Ignore-this: 128d5873729a0a00558465b45d5d9f58
Some people seem to have problems to see which section will be edited when
using a section editing button. This patch adds a litle bit JavaScript magic
to highlight the edited section to be, when hovering over a section button.
darcs-hash:20090214161135-7ad00-59db7d9185784ba1fec2f2c2da30c6e64ae1ccc3.gz
Diffstat (limited to 'lib/scripts')
-rw-r--r-- | lib/scripts/script.js | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/lib/scripts/script.js b/lib/scripts/script.js index 2421f3577..5ef9aef85 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -520,7 +520,7 @@ addInitEvent(function(){ /** * Display error for Windows Shares on browsers other than IE * - * Michael Klier <chi@chimeric.de> + * @author Michael Klier <chi@chimeric.de> */ function checkWindowsShares() { var elems = getElementsByClass('windows',document,'a'); @@ -539,8 +539,34 @@ function checkWindowsShares() { /** * Add the event handler for the Windows Shares check * - * Michael Klier <chi@chimeric.de> + * @author Michael Klier <chi@chimeric.de> */ addInitEvent(function(){ checkWindowsShares(); }); + +/** + * Highlight the section when hovering over the appropriate section edit button + * + * @author Andreas Gohr <andi@splitbrain.org> + */ +addInitEvent(function(){ + var btns = getElementsByClass('btn_secedit',document,'form'); + for(var i=0; i<btns.length; i++){ + addEvent(btns[i],'mouseover',function(e){ + var tgt = e.target; + if(tgt.form) tgt = tgt.form; + tgt = tgt.parentNode.previousSibling; + if(tgt.nodeName != "DIV") tgt = tgt.previousSibling; + if(tgt.nodeName != "DIV") return; + tgt.className += ' section_highlight'; + }); + + addEvent(btns[i],'mouseout',function(e){ + var secs = getElementsByClass('section_highlight',document,'div'); + for(var j=0; j<secs.length; j++){ + secs[j].className = secs[j].className.replace(/ section_highlight/,''); + } + }); + } +}); |