moved not always needed code out of event handler

This commit is contained in:
Sebastian Mendel
2005-10-19 14:32:07 +00:00
parent 98e04cadda
commit 798558ea4d
2 changed files with 37 additions and 34 deletions

View File

@@ -8,9 +8,10 @@ $Source$
2005-10-19 Marc Delisle <lem9@users.sourceforge.net> 2005-10-19 Marc Delisle <lem9@users.sourceforge.net>
* libraries/bookmark.lib.php: PHP 5.1.0-dev compatibility * libraries/bookmark.lib.php: PHP 5.1.0-dev compatibility
2005-10-18 Sebastian Mendel <cybot_tm@users.sourceforge.net> 2005-10-19 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* footer.inc.php, index.php, server_databases.php, libraries/querywindow.js: * footer.inc.php, index.php, server_databases.php, libraries/querywindow.js:
fix problem not remembering selected server fix problem not remembering selected server
* libraries/tooltip.js: moved not always needed code out of event handler
2005-10-18 Michal Čihař <michal@cihar.com> 2005-10-18 Michal Čihař <michal@cihar.com>
* libraries/relation.lib.php: Do not set database if not needed. * libraries/relation.lib.php: Do not set database if not needed.

View File

@@ -6,7 +6,6 @@
* 2005-01-20 added by Michael Keck (mkkeck) * 2005-01-20 added by Michael Keck (mkkeck)
*/ */
var ttXpos = 0, ttYpos = 0; var ttXpos = 0, ttYpos = 0;
var ttXadd = 10, ttYadd = -10; var ttXadd = 10, ttYadd = -10;
var ttDisplay = 0, ttHoldIt = 0; var ttDisplay = 0, ttHoldIt = 0;
@@ -29,10 +28,11 @@ if ( (ttDOM) || (ttIE4) || (ttNS4) ) {
var myTooltipContainer = document.getElementById('TooltipContainer'); var myTooltipContainer = document.getElementById('TooltipContainer');
} }
// mouse-event // mouse-event
document.onmousemove = mouseMove; if ( ttNS4 ) {
if (ttNS4)
document.captureEvents(Event.MOUSEMOVE); document.captureEvents(Event.MOUSEMOVE);
} else {
document.onmousemove = mouseMove;
}
} }
/** /**
@@ -79,6 +79,30 @@ function swapTooltip(stat) {
* show / hide the Tooltip * show / hide the Tooltip
*/ */
function showTooltip(stat) { function showTooltip(stat) {
var plusX=0, plusY=0, docX=0; docY=0;
var divHeight = myTooltipContainer.clientHeight;
var divWidth = myTooltipContainer.clientWidth;
if (navigator.appName.indexOf("Explorer")!=-1) {
if (document.documentElement && document.documentElement.scrollTop) {
plusX = document.documentElement.scrollLeft;
plusY = document.documentElement.scrollTop;
docX = document.documentElement.offsetWidth + plusX;
docY = document.documentElement.offsetHeight + plusY;
} else {
plusX = document.body.scrollLeft;
plusY = document.body.scrollTop;
docX = document.body.offsetWidth + plusX;
docY = document.body.offsetHeight + plusY;
}
} else {
docX = document.body.clientWidth;
docY = document.body.clientHeight;
}
if ((ttXpos + divWidth) > docX)
ttXpos = ttXpos - (divWidth + (ttXadd * 2));
if ((ttYpos + divHeight) > docY)
ttYpos = ttYpos - (divHeight + (ttYadd * 2));
if (stat==false) { if (stat==false) {
if (ttNS4) if (ttNS4)
myTooltipContainer.visibility = "hide"; myTooltipContainer.visibility = "hide";
@@ -125,36 +149,14 @@ function pmaTooltip(theText) {
} }
/** /**
* register mouse moves * register mouse moves
*/ */
function mouseMove(e) { function mouseMove(e) {
var x=0, y=0, plusX=0, plusY=0, docX=0; docY=0; if ( typeof( event ) != 'undefined' ) {
var divHeight = myTooltipContainer.clientHeight; ttXpos = event.x;
var divWidth = myTooltipContainer.clientWidth; ttYpos = event.y;
if (navigator.appName.indexOf("Explorer")!=-1) {
if (document.documentElement && document.documentElement.scrollTop) {
plusX = document.documentElement.scrollLeft;
plusY = document.documentElement.scrollTop;
docX = document.documentElement.offsetWidth + plusX;
docY = document.documentElement.offsetHeight + plusY;
} else {
plusX = document.body.scrollLeft;
plusY = document.body.scrollTop;
docX = document.body.offsetWidth + plusX;
docY = document.body.offsetHeight + plusY;
}
x = event.x + plusX;
y = event.y + plusY;
} else { } else {
x = e.pageX; ttXpos = e.pageX;
y = e.pageY; ttYpos = e.pageY;
docX = document.body.clientWidth;
docY = document.body.clientHeight;
} }
ttXpos = x;
ttYpos = y;
if ((ttXpos + divWidth) > docX)
ttXpos = ttXpos - (divWidth + (ttXadd * 2));
if ((ttYpos + divHeight) > docY)
ttYpos = ttYpos - (divHeight + (ttYadd * 2));
} }