diff --git a/js/tooltip.js b/js/tooltip.js deleted file mode 100644 index 31b62e68e..000000000 --- a/js/tooltip.js +++ /dev/null @@ -1,227 +0,0 @@ -/* vim: set expandtab sw=4 ts=4 sts=4: */ -/** - * Displays the Tooltips (hints), if we have some - * 2005-01-20 added by Michael Keck (mkkeck) - * - * @version $Id$ - */ - -/** - * - */ -var ttXpos = 0, ttYpos = 0; -var ttXadd = 10, ttYadd = -10; -var ttDisplay = 0, ttHoldIt = 0; - -// Check if browser does support dynamic content and dhtml -if (document.getElementById) { - // DOM-compatible browsers - var ttDOM = 1; -} else { - // the old Netscape 4 - var ttNS4 = (document.layers) ? 1 : 0; - // browser wich uses document.all - var ttIE4 = (document.all) ? 1 : 0; -} - -var myTooltipContainer = null; - -/** - * initialize tooltip - */ -function PMA_TT_init() -{ - // get all 'light bubbles' on page - var tooltip_icons = $("img[class='footnotemarker']"); - var tooltip_count = tooltip_icons.length; - - if (tooltip_count < 1) { - // no 'bubbles' found - return; - } - - // insert tooltip container - myTooltipContainer = document.createElement("div"); - myTooltipContainer.id = 'TooltipContainer'; - window.parent.addEvent(myTooltipContainer, 'mouseover', holdTooltip); - window.parent.addEvent(myTooltipContainer, 'mouseout', swapTooltip); - document.body.appendChild(myTooltipContainer); - - // capture mouse-events - for (i = 0; i < tooltip_count; i++) { - window.parent.addEvent(tooltip_icons[i], 'mousemove', mouseMove); - window.parent.addEvent(tooltip_icons[i], 'mouseover', pmaTooltip); - window.parent.addEvent(tooltip_icons[i], 'mouseout', swapTooltip); - } -} - -/** - * init the tooltip and write the text into it - * - * @param string theText tooltip content - */ -function PMA_TT_setText(theText) -{ - if (ttDOM || ttIE4) { // document.getEelementById || document.all - myTooltipContainer.innerHTML = ""; // we should empty it first - myTooltipContainer.innerHTML = theText; - } else if (ttNS4) { // document.layers - var layerNS4 = myTooltipContainer.document; - layerNS4.write(theText); - layerNS4.close(); - } -} - -/** - * @var integer - */ -var ttTimerID = 0; - -/** - * swap the Tooltip // show and hide - * - * @param boolean stat view status - */ -function swapTooltip(stat) -{ - if (ttHoldIt != 1) { - if (stat == 'true') { - showTooltip(true); - } else if (ttDisplay) { - ttTimerID = setTimeout("showTooltip(false);", 500); - } else { - showTooltip(true); - } - } else { - if (ttTimerID) { - clearTimeout(ttTimerID); - ttTimerID = 0; - } - showTooltip(true); - } -} - -/** - * 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 - * usally called from eventhandler - * - * @param string theText tooltip content - */ -function pmaTooltip(e) -{ - - var footnoteID = this.id.split("_")[2]; - var footnote = $('#footnote_' + footnoteID); - // Remove the footnote number since it is not needed - footnote.children("sup").remove(); - var plusX = 0, plusY = 0, docX = 0, docY = 0; - var divHeight = myTooltipContainer.clientHeight; - var divWidth = myTooltipContainer.clientWidth; - - if (navigator.appName.indexOf("Explorer") != -1) { - // IE ... - 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; - } - - ttXpos = ttXpos + plusX; - ttYpos = ttYpos + plusY; - - if ((ttXpos + divWidth) > docX) - ttXpos = ttXpos - (divWidth + (ttXadd * 2)); - if ((ttYpos + divHeight) > docY) - ttYpos = ttYpos - (divHeight + (ttYadd * 2)); - - PMA_TT_setText(footnote.html()); - moveTooltip((ttXpos + ttXadd), (ttYpos + ttYadd)); - holdTooltip(); -} - -/** - * register mouse moves - * - * @param event e - */ -function mouseMove(e) { - if ( typeof( event ) != 'undefined' ) { - ttXpos = event.x; - ttYpos = event.y; - } else { - ttXpos = e.pageX; - ttYpos = e.pageY; - } - moveTooltip((ttXpos + ttXadd), (ttYpos + ttYadd)); -} - -$(document).ready(function() { - // Hide the footnotes from the footer (which are displayed for - // JavaScript-disabled browsers) since the tooltip is sufficient - $(".footnotes").hide(); - // The border and padding must be removed otherwise a thin yellow box remains visible - $(".footnotes").css("border", "none"); - $(".footnotes").css("padding", "0px"); - // Replace the superscripts with the help icon - $("sup[class='footnotemarker']").remove(); - $("img[class='footnotemarker']").show(); -}); \ No newline at end of file