From 4e99e2d1f296112915ec4a2f1300a955a7c7470f Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Wed, 19 Oct 2005 14:53:19 +0000 Subject: [PATCH] moved not always needed code out of event handler, fixed display with larger font --- ChangeLog | 3 +- libraries/tooltip.js | 119 ++++++++++-------- .../darkblue_orange/css/theme_right.css.php | 10 +- themes/original/css/theme_right.css.php | 10 +- 4 files changed, 82 insertions(+), 60 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3765fc926..f74360789 100755 --- a/ChangeLog +++ b/ChangeLog @@ -11,7 +11,8 @@ $Source$ 2005-10-19 Sebastian Mendel * footer.inc.php, index.php, server_databases.php, libraries/querywindow.js: 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ř * libraries/relation.lib.php: Do not set database if not needed. diff --git a/libraries/tooltip.js b/libraries/tooltip.js index c06fc5899..accefd144 100644 --- a/libraries/tooltip.js +++ b/libraries/tooltip.js @@ -2,9 +2,9 @@ /** - * Displays the Tooltips (hints), if we have some - * 2005-01-20 added by Michael Keck (mkkeck) - */ + * Displays the Tooltips (hints), if we have some + * 2005-01-20 added by Michael Keck (mkkeck) + */ var ttXpos = 0, ttYpos = 0; 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) { if (ttDOM || ttIE4) { // document.getEelementById || document.all 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; + +/** + * swap the Tooltip // show and hide + * + * @param boolean stat view status + */ function swapTooltip(stat) { if (ttHoldIt!=1) { 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) { + 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 divHeight = myTooltipContainer.clientHeight; var divWidth = myTooltipContainer.clientWidth; @@ -98,51 +153,15 @@ function showTooltip(stat) { docX = document.body.clientWidth; docY = document.body.clientHeight; } + + ttXpos = ttXpos + plusX; + ttYpos = ttYpos + plusY; + if ((ttXpos + divWidth) > docX) ttXpos = ttXpos - (divWidth + (ttXadd * 2)); if ((ttYpos + divHeight) > docY) 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); moveTooltip((ttXpos + ttXadd), (ttYpos + ttYadd)); holdTooltip(); @@ -150,6 +169,8 @@ function pmaTooltip(theText) { /** * register mouse moves + * + * @param event e */ function mouseMove(e) { if ( typeof( event ) != 'undefined' ) { diff --git a/themes/darkblue_orange/css/theme_right.css.php b/themes/darkblue_orange/css/theme_right.css.php index d06001cad..d224dfacc 100644 --- a/themes/darkblue_orange/css/theme_right.css.php +++ b/themes/darkblue_orange/css/theme_right.css.php @@ -529,14 +529,14 @@ tr.disabled td, td.disabled { #TooltipContainer { position: absolute; z-index: 99; - width: 250px; - height: 50px; - overflow: auto; + width: 20em; + height: auto; + overflow: visible; visibility: hidden; background-color: #ffffcc; color: #006600; - border: 1px solid #000000; - padding: 5px; + border: 0.1em solid #000000; + padding: 0.5em; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; } diff --git a/themes/original/css/theme_right.css.php b/themes/original/css/theme_right.css.php index 020ee5ef5..a3fd77520 100644 --- a/themes/original/css/theme_right.css.php +++ b/themes/original/css/theme_right.css.php @@ -315,14 +315,14 @@ tr.disabled td, td.disabled { #TooltipContainer { position: absolute; z-index: 99; - width: 250px; - height: 50px; - overflow: auto; + width: 20em; + height: auto; + overflow: visible; visibility: hidden; background-color: #ffffcc; color: #006600; - border: 1px solid #000000; - padding: 5px; + border: 0.1em solid #000000; + padding: 0.5em; font-family: ; font-size: ; }