1 // Copyright (C) 2009 Rod Roark <rod@sunsetsystems.com>
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License
5 // as published by the Free Software Foundation; either version 2
6 // of the License, or (at your option) any later version.
8 // See interface/reports/players_report.php for an example of
9 // implementing tooltips with this module.
12 function ttGetX(elem) {
16 elem = elem.offsetParent;
20 function ttGetY(elem) {
24 elem = elem.offsetParent;
34 function ttClearTimer() {
36 clearTimeout(ttTimerId);
43 // timer completion handler
45 ttobject = document.getElementById("tooltipdiv");
46 // ttobject.innerHTML = (ttTitle.length > 0) ? ttTitle : 'Loading...';
47 ttobject.innerHTML = ' ';
48 var x = ttGetX(ttElem);
49 var dw = window.innerWidth ? window.innerWidth - 20 : document.body.clientWidth;
50 if (dw && dw < (x + ttobject.offsetWidth)) {
51 x = dw - ttobject.offsetWidth;
54 // var y = ttGetY(ttElem) - ttobject.offsetHeight - 10;
55 // if (y < 0) y = ttGetY(ttElem) + ttElem.offsetHeight + 10;
56 var dh = window.innerHeight ? window.innerHeight : document.body.clientHeight;
57 var y = ttGetY(ttElem) + ttobject.offsetHeight + 10;
58 if (y + 40 > dh) y = 0;
59 ttobject.style.left = x;
60 ttobject.style.top = y;
61 ttobject.style.visibility='visible';
62 // if (!ttElem.ttTitle) {
70 // onmouseover handler
71 function ttMouseOver(elem, url) {
75 ttTimerId = setTimeout("ttMake()", 250);
79 // onmouseout handler.
80 function ttMouseOut() {
82 var ttobject = document.getElementById("tooltipdiv");
83 ttobject.style.visibility='hidden';
84 ttobject.style.left = '-1000px';