moved not always needed code out of event handler, fixed display with larger font

This commit is contained in:
Sebastian Mendel
2005-10-19 14:53:19 +00:00
parent 798558ea4d
commit 4e99e2d1f2
4 changed files with 82 additions and 60 deletions

View File

@@ -11,7 +11,8 @@ $Source$
2005-10-19 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 * libraries/tooltip.js, themes/*/theme_right.css.php:
moved not always needed code out of event handler, fixed display with larger font
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

@@ -2,9 +2,9 @@
/** /**
* Displays the Tooltips (hints), if we have some * Displays the Tooltips (hints), if we have some
* 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;
@@ -36,8 +36,10 @@ if ( (ttDOM) || (ttIE4) || (ttNS4) ) {
} }
/** /**
* init the tooltip and write the text into it * init the tooltip and write the text into it
*/ *
* @param string theText tooltip content
*/
function textTooltip(theText) { function textTooltip(theText) {
if (ttDOM || ttIE4) { // document.getEelementById || document.all if (ttDOM || ttIE4) { // document.getEelementById || document.all
myTooltipContainer.innerHTML = ""; // we should empty it first myTooltipContainer.innerHTML = ""; // we should empty it first
@@ -50,9 +52,15 @@ function textTooltip(theText) {
} }
/** /**
* swap the Tooltip // show and hide * @var integer
*/ */
var ttTimerID = 0; var ttTimerID = 0;
/**
* swap the Tooltip // show and hide
*
* @param boolean stat view status
*/
function swapTooltip(stat) { function swapTooltip(stat) {
if (ttHoldIt!=1) { if (ttHoldIt!=1) {
if (stat!='default') { if (stat!='default') {
@@ -76,9 +84,56 @@ function swapTooltip(stat) {
} }
/** /**
* show / hide the Tooltip * show / hide the Tooltip
*/ *
* @param boolean stat view status
*/
function showTooltip(stat) { function showTooltip(stat) {
if (stat==false) {
if (ttNS4)
myTooltipContainer.visibility = "hide";
else
myTooltipContainer.style.visibility = "hidden";
ttDisplay = 0;
} else {
if (ttNS4)
myTooltipContainer.visibility = "show";
else
myTooltipContainer.style.visibility = "visible";
ttDisplay = 1;
}
}
/**
* hold it, if we create or move the mouse over the tooltip
*/
function holdTooltip() {
ttHoldIt = 1;
swapTooltip('true');
ttHoldIt = 0;
}
/**
* move the tooltip to mouse position
*
* @param integer posX horiz. position
* @param integer posY vert. position
*/
function moveTooltip(posX, posY) {
if (ttDOM || ttIE4) {
myTooltipContainer.style.left = posX + "px";
myTooltipContainer.style.top = posY + "px";
} else if (ttNS4) {
myTooltipContainer.left = posX;
myTooltipContainer.top = posY;
}
}
/**
* build the tooltip
*
* @param string theText tooltip content
*/
function pmaTooltip(theText) {
var plusX=0, plusY=0, docX=0; docY=0; var plusX=0, plusY=0, docX=0; docY=0;
var divHeight = myTooltipContainer.clientHeight; var divHeight = myTooltipContainer.clientHeight;
var divWidth = myTooltipContainer.clientWidth; var divWidth = myTooltipContainer.clientWidth;
@@ -98,51 +153,15 @@ function showTooltip(stat) {
docX = document.body.clientWidth; docX = document.body.clientWidth;
docY = document.body.clientHeight; docY = document.body.clientHeight;
} }
ttXpos = ttXpos + plusX;
ttYpos = ttYpos + plusY;
if ((ttXpos + divWidth) > docX) if ((ttXpos + divWidth) > docX)
ttXpos = ttXpos - (divWidth + (ttXadd * 2)); ttXpos = ttXpos - (divWidth + (ttXadd * 2));
if ((ttYpos + divHeight) > docY) if ((ttYpos + divHeight) > docY)
ttYpos = ttYpos - (divHeight + (ttYadd * 2)); ttYpos = ttYpos - (divHeight + (ttYadd * 2));
if (stat==false) {
if (ttNS4)
myTooltipContainer.visibility = "hide";
else
myTooltipContainer.style.visibility = "hidden";
ttDisplay = 0;
} else {
if (ttNS4)
myTooltipContainer.visibility = "show";
else
myTooltipContainer.style.visibility = "visible";
ttDisplay = 1;
}
}
/**
* hold it, if we create or move the mouse over the tooltip
*/
function holdTooltip() {
ttHoldIt = 1;
swapTooltip('true');
ttHoldIt = 0;
}
/**
* move the tooltip to mouse position
*/
function moveTooltip(posX, posY) {
if (ttDOM || ttIE4) {
myTooltipContainer.style.left = posX + "px";
myTooltipContainer.style.top = posY + "px";
} else if (ttNS4) {
myTooltipContainer.left = posX;
myTooltipContainer.top = posY;
}
}
/**
* build the tooltip
*/
function pmaTooltip(theText) {
textTooltip(theText); textTooltip(theText);
moveTooltip((ttXpos + ttXadd), (ttYpos + ttYadd)); moveTooltip((ttXpos + ttXadd), (ttYpos + ttYadd));
holdTooltip(); holdTooltip();
@@ -150,6 +169,8 @@ function pmaTooltip(theText) {
/** /**
* register mouse moves * register mouse moves
*
* @param event e
*/ */
function mouseMove(e) { function mouseMove(e) {
if ( typeof( event ) != 'undefined' ) { if ( typeof( event ) != 'undefined' ) {

View File

@@ -529,14 +529,14 @@ tr.disabled td, td.disabled {
#TooltipContainer { #TooltipContainer {
position: absolute; position: absolute;
z-index: 99; z-index: 99;
width: 250px; width: 20em;
height: 50px; height: auto;
overflow: auto; overflow: visible;
visibility: hidden; visibility: hidden;
background-color: #ffffcc; background-color: #ffffcc;
color: #006600; color: #006600;
border: 1px solid #000000; border: 0.1em solid #000000;
padding: 5px; padding: 0.5em;
font-family: Verdana, Arial, Helvetica, sans-serif; font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px; font-size: 10px;
} }

View File

@@ -315,14 +315,14 @@ tr.disabled td, td.disabled {
#TooltipContainer { #TooltipContainer {
position: absolute; position: absolute;
z-index: 99; z-index: 99;
width: 250px; width: 20em;
height: 50px; height: auto;
overflow: auto; overflow: visible;
visibility: hidden; visibility: hidden;
background-color: #ffffcc; background-color: #ffffcc;
color: #006600; color: #006600;
border: 1px solid #000000; border: 0.1em solid #000000;
padding: 5px; padding: 0.5em;
font-family: <?php echo $right_font_family; ?>; font-family: <?php echo $right_font_family; ?>;
font-size: <?php echo $font_size; ?>; font-size: <?php echo $font_size; ?>;
} }