-
Notifications
You must be signed in to change notification settings - Fork 0
/
help.js
50 lines (50 loc) · 1.4 KB
/
help.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
help.js
*/
//simple code to verify modules are setup
window['Help'] = {
logger: Logger.create("Help.js", "help"),
register: function(domEl, helpText) {
$(domEl).attr('help-rq', 'true')
.attr('help-text', helpText);
return Help.refresh();//allow chaining
},
unregister: function(element) {
$(element).attr('help-rq', 'false').off('mouseover mouseout');
return Help;
},
refresh: function() {
$('[help-rq="true"]').off('mouseover mouseout').unbind('mouseover mouseout')
.bind('mouseover', function(ev) {
Help.logger.log(ev, false);
Help.help(ev.currentTarget);
}).bind('mouseout', function(ev) {
Help.logger.log(ev, false);//log without prefix
if($(ev.currentTarget).attr('help-active')=='true') {
$('#help-div').hide();
$(ev.currentTarget).attr('help-active', 'false');
}
});
return Help;
},
help: function(domEl) {
if($(domEl).attr('help-rq')=='false'){
//help was disabled previously
Help.unregister(domEl);
return Help;
}
$('#help-div').show()
.html($(domEl).attr('help-text'))
.css('right', ($(window).width()-295)+'px')
.css('top', $(domEl).offset().top /*+ 65*/ + 'px');
$(domEl).attr('help-active', 'true');
if(ISSET($(domEl).attr('help-color'))){
$('#help-div').css('background-color', $(domEl).attr('help-color'));
}
return Help;
},
setColor: function (domEl, color) {
$(domEl).attr('help-color', color);
return Help;
}
};