File: tooltip.js

package info (click to toggle)
ocsinventory-server 2.5%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,088 kB
  • sloc: php: 27,462; perl: 8,241; sh: 1,680; sql: 1,355; xml: 1,041; makefile: 34
file content (50 lines) | stat: -rwxr-xr-x 1,510 bytes parent folder | download | duplicates (3)
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
/*
 * 
 * tx to Damien ALEXANDRE
 * http://damienalexandre.fr/Info-Bulle-en-Javascript.html 
 * 
 * 
 *
 */


var i = false; // visible or not?

function GetId(id)
{
    return document.getElementById(id);
}


function move(e) {
    if (i) {  // calcul the position
        if (navigator.appName != "Microsoft Internet Explorer") { // IE or other?
            GetId("mouse_pointer").style.left = e.pageX + 5 + "px";
            GetId("mouse_pointer").style.top = e.pageY + 10 + "px";
        } else { // TeDeum Modif
            if (document.documentElement.clientWidth > 0) {
                GetId("mouse_pointer").style.left = 20 + event.x + document.documentElement.scrollLeft + "px";
                GetId("mouse_pointer").style.top = 10 + event.y + document.documentElement.scrollTop + "px";
            } else {
                GetId("mouse_pointer").style.left = 20 + event.x + document.body.scrollLeft + "px";
                GetId("mouse_pointer").style.top = 10 + event.y + document.body.scrollTop + "px";
            }
        }
    }
}

function show_me(text) {
    if (i == false) {
        GetId("mouse_pointer").style.visibility = "visible"; // show tooltip.
        GetId("mouse_pointer").innerHTML = text; // copy the text in html
        i = true;
    }
}
function hidden_me() {
    if (i == true) {
        GetId("mouse_pointer").style.visibility = "hidden"; // hidden tooltip
        i = false;
    }
}
document.onmousemove = move; // when mouse move, calcul again the mouse pointer.
//-->