xref: /plugin/include/script.js (revision afa996bc2ef19982ae3f733592699dcbfb6fd847)
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 * @author Michael Hamann <michael@content-space.de>
11 */
12addInitEvent(function(){
13    var btns = getElementsByClass('btn_incledit',document,'form');
14    for(var i=0; i<btns.length; i++){
15        addEvent(btns[i],'mouseover',function(e){
16            var container_div = this;
17            while (container_div != document && !container_div.className.match(/\bplugin_include_content\b/)) {
18                container_div = container_div.parentNode;
19            }
20
21            if (container_div != document) {
22                container_div.className += ' section_highlight';
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:
36