xref: /plugin/include/script.js (revision 75668fa90184ea2394730e9a5f5e6f72a797e94a)
1/**
2 * Javascript functionality for the include plugin
3 */
4
5/**
6 * Highlight the included section when hovering over the appropriate include edit button
7 *
8 * @author Andreas Gohr <andi@splitbrain.org>
9 * @author Michael Klier <chi@chimeric.de>
10 */
11addInitEvent(function(){
12    var btns = getElementsByClass('btn_incledit',document,'form');
13    for(var i=0; i<btns.length; i++){
14        addEvent(btns[i],'mouseover',function(e){
15            var tgt = e.target;
16            if(tgt.form) tgt = tgt.form;
17            id = 'plugin_include__' + tgt.id.value;
18            var divs = getElementsByClass('plugin_include_content');
19            for(var j=0; j<divs.length; j++) {
20                if(divs[j].id == id) {
21                    divs[j].className += ' section_highlight';
22                }
23            }
24        });
25
26        addEvent(btns[i],'mouseout',function(e){
27            var secs = getElementsByClass('section_highlight',document,'div');
28            for(var j=0; j<secs.length; j++){
29                secs[j].className = secs[j].className.replace(/ section_highlight/,'');
30            }
31        });
32    }
33});
34
35// vim:ts:4:sw:4:et:enc=utf-8:
36