1/* This notice must be untouched at all times. 2Copyright (c) 2002-2008 Walter Zorn. All rights reserved. 3 4wz_tooltip.js v. 5.20 5 6The latest version is available at 7http://www.walterzorn.com 8or http://www.devira.com 9or http://www.walterzorn.de 10 11Created 1.12.2002 by Walter Zorn (Web: http://www.walterzorn.com ) 12Last modified: 1.8.2008 13 14Easy-to-use cross-browser tooltips. 15Just include the script at the beginning of the <body> section, and invoke 16Tip('Tooltip text') to show and UnTip() to hide the tooltip, from the desired 17HTML eventhandlers. Example: 18<a onmouseover="Tip('Some text')" onmouseout="UnTip()" href="index.htm">My home page</a> 19No container DIV required. 20By default, width and height of tooltips are automatically adapted to content. 21Is even capable of dynamically converting arbitrary HTML elements to tooltips 22by calling TagToTip('ID_of_HTML_element_to_be_converted') instead of Tip(), 23which means you can put important, search-engine-relevant stuff into tooltips. 24Appearance & behaviour of tooltips can be individually configured 25via commands passed to Tip() or TagToTip(). 26 27Tab Width: 4 28LICENSE: LGPL 29 30This library is free software; you can redistribute it and/or 31modify it under the terms of the GNU Lesser General Public 32License (LGPL) as published by the Free Software Foundation; either 33version 2.1 of the License, or (at your option) any later version. 34 35This library is distributed in the hope that it will be useful, 36but WITHOUT ANY WARRANTY; without even the implied warranty of 37MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 38 39For more details on the GNU Lesser General Public License, 40see http://www.gnu.org/copyleft/lesser.html 41*/ 42 43var config = new Object(); 44 45 46//=================== GLOBAL TOOPTIP CONFIGURATION =========================// 47var tt_Debug = true // false or true - recommended: false once you release your page to the public 48var tt_Enabled = true // Allows to (temporarily) suppress tooltips, e.g. by providing the user with a button that sets this global variable to false 49var TagsToTip = true // false or true - if true, HTML elements to be converted to tooltips via TagToTip() are automatically hidden; 50 // if false, you should hide those HTML elements yourself 51 52// For each of the following config variables there exists a command, which is 53// just the variablename in uppercase, to be passed to Tip() or TagToTip() to 54// configure tooltips individually. Individual commands override global 55// configuration. Order of commands is arbitrary. 56// Example: onmouseover="Tip('Tooltip text', LEFT, true, BGCOLOR, '#FF9900', FADEIN, 400)" 57 58config. Above = false // false or true - tooltip above mousepointer 59config. BgColor = '#686666' // Background colour (HTML colour value, in quotes) 60config. BgImg = '' // Path to background image, none if empty string '' 61config. BorderColor = '#686666' 62config. BorderStyle = 'solid' // Any permitted CSS value, but I recommend 'solid', 'dotted' or 'dashed' 63config. BorderWidth = 1 64config. CenterMouse = false // false or true - center the tip horizontally below (or above) the mousepointer 65config. ClickClose = false // false or true - close tooltip if the user clicks somewhere 66config. ClickSticky = false // false or true - make tooltip sticky if user left-clicks on the hovered element while the tooltip is active 67config. CloseBtn = false // false or true - closebutton in titlebar 68config. CloseBtnColors = ['#990000', '#FFFFFF', '#DD3333', '#FFFFFF'] // [Background, text, hovered background, hovered text] - use empty strings '' to inherit title colours 69config. CloseBtnText = ' X ' // Close button text (may also be an image tag) 70config. CopyContent = true // When converting a HTML element to a tooltip, copy only the element's content, rather than converting the element by its own 71config. Delay = 400 // Time span in ms until tooltip shows up 72config. Duration = 15000 // Time span in ms after which the tooltip disappears; 0 for infinite duration, < 0 for delay in ms _after_ the onmouseout until the tooltip disappears
73config. FadeIn = 200 // Fade-in duration in ms, e.g. 400; 0 for no animation 74config. FadeOut = 100 75config. FadeInterval = 30 // Duration of each fade step in ms (recommended: 30) - shorter is smoother but causes more CPU-load 76config. Fix = null // Fixated position, two modes. Mode 1: x- an y-coordinates in brackets, e.g. [210, 480]. Mode 2: Show tooltip at a position related to an HTML element: [ID of HTML element, x-offset, y-offset from HTML element], e.g. ['SomeID', 10, 30]. Value null (default) for no fixated positioning. 77config. FollowMouse = true // false or true - tooltip follows the mouse 78config. FontColor = '#ffffff' 79config. FontFace = 'Verdana,Geneva,sans-serif' 80config. FontSize = '9pt' // E.g. '9pt' or '12px' - unit is mandatory 81config. FontWeight = 'normal' // 'normal' or 'bold'; 82config. Height = 0 // Tooltip height; 0 for automatic adaption to tooltip content, < 0 (e.g. -100) for a maximum for automatic adaption 83config. JumpHorz = true // false or true - jump horizontally to other side of mouse if tooltip would extend past clientarea boundary 84config. JumpVert = true // false or true - jump vertically " 85config. Left = false // false or true - tooltip on the left of the mouse 86config. OffsetX = 14 // Horizontal offset of left-top corner from mousepointer 87config. OffsetY = -50 // Vertical offset 88config. Opacity = 100 // Integer between 0 and 100 - opacity of tooltip in percent 89config. Padding = 5 // Spacing between border and content 90config. Shadow = false // false or true 91config. ShadowColor = '#dd87f6' 92config. ShadowWidth = 5 93config. Sticky = false // false or true - fixate tip, ie. don't follow the mouse and don't hide on mouseout 94config. TextAlign = 'left' // 'left', 'right' or 'justify' 95config. Title = '' // Default title text applied to all tips (no default title: empty string '') 96config. TitleAlign = 'left' // 'left' or 'right' - text alignment inside the title bar 97config. TitleBgColor = '' // If empty string '', BorderColor will be used 98config. TitleFontColor = '#dd87f6' // Color of title text - if '', BgColor (of tooltip body) will be used 99config. TitleFontFace = '' // If '' use FontFace (boldified) 100config. TitleFontSize = '' // If '' use FontSize 101config. TitlePadding = 2 102config. Width = 0 // Tooltip width; 0 for automatic adaption to tooltip content; < -1 (e.g. -240) for a maximum width for that automatic adaption; 103 // -1: tooltip width confined to the width required for the titlebar 104//======= END OF TOOLTIP CONFIG, DO NOT CHANGE ANYTHING BELOW ==============// 105 106 107 108 109//===================== PUBLIC =============================================// 110function Tip() 111{ 112 tt_Tip(arguments, null); 113} 114function TagToTip() 115{ 116 var t2t = tt_GetElt(arguments[0]); 117 if(t2t) 118 tt_Tip(arguments, t2t); 119} 120function UnTip() 121{ 122 tt_OpReHref(); 123 if(tt_aV[DURATION] < 0 && (tt_iState & 0x2)) 124 tt_tDurt.Timer("tt_HideInit()", -tt_aV[DURATION], true); 125 else if(!(tt_aV[STICKY] && (tt_iState & 0x2))) 126 tt_HideInit(); 127} 128 129//================== PUBLIC PLUGIN API =====================================// 130// Extension eventhandlers currently supported: 131// OnLoadConfig, OnCreateContentString, OnSubDivsCreated, OnShow, OnMoveBefore, 132// OnMoveAfter, OnHideInit, OnHide, OnKill 133 134var tt_aElt = new Array(10), // Container DIV, outer title & body DIVs, inner title & body TDs, closebutton SPAN, shadow DIVs, and IFRAME to cover windowed elements in IE 135tt_aV = new Array(), // Caches and enumerates config data for currently active tooltip 136tt_sContent, // Inner tooltip text or HTML 137tt_t2t, tt_t2tDad, // Tag converted to tip, and its DOM parent element 138tt_scrlX = 0, tt_scrlY = 0, 139tt_musX, tt_musY, 140tt_over, 141tt_x, tt_y, tt_w, tt_h; // Position, width and height of currently displayed tooltip 142 143function tt_Extension() 144{ 145 tt_ExtCmdEnum(); 146 tt_aExt[tt_aExt.length] = this; 147 return this; 148} 149function tt_SetTipPos(x, y) 150{ 151 var css = tt_aElt[0].style; 152 153 tt_x = x; 154 tt_y = y; 155 css.left = x + "px"; 156 css.top = y + "px"; 157 if(tt_ie56) 158 { 159 var ifrm = tt_aElt[tt_aElt.length - 1]; 160 if(ifrm) 161 { 162 ifrm.style.left = css.left; 163 ifrm.style.top = css.top; 164 } 165 } 166} 167function tt_HideInit() 168{ 169 if(tt_iState) 170 { 171 tt_ExtCallFncs(0, "HideInit"); 172 tt_iState &= ~0x4; 173 if(tt_flagOpa && tt_aV[FADEOUT]) 174 { 175 tt_tFade.EndTimer(); 176 if(tt_opa) 177 { 178 var n = Math.round(tt_aV[FADEOUT] / (tt_aV[FADEINTERVAL] * (tt_aV[OPACITY] / tt_opa))); 179 tt_Fade(tt_opa, tt_opa, 0, n); 180 return; 181 } 182 } 183 tt_tHide.Timer("tt_Hide();", 1, false); 184 } 185} 186function tt_Hide() 187{ 188 if(tt_db && tt_iState) 189 { 190 tt_OpReHref(); 191 if(tt_iState & 0x2) 192 { 193 tt_aElt[0].style.visibility = "hidden"; 194 tt_ExtCallFncs(0, "Hide"); 195 } 196 tt_tShow.EndTimer(); 197 tt_tHide.EndTimer(); 198 tt_tDurt.EndTimer(); 199 tt_tFade.EndTimer(); 200 if(!tt_op && !tt_ie) 201 { 202 tt_tWaitMov.EndTimer(); 203 tt_bWait = false; 204 } 205 if(tt_aV[CLICKCLOSE] || tt_aV[CLICKSTICKY]) 206 tt_RemEvtFnc(document, "mouseup", tt_OnLClick); 207 tt_ExtCallFncs(0, "Kill"); 208 // In case of a TagToTip tip, hide converted DOM node and 209 // re-insert it into DOM 210 if(tt_t2t && !tt_aV[COPYCONTENT]) 211 tt_UnEl2Tip();
212 tt_iState = 0; 213 tt_over = null; 214 tt_ResetMainDiv(); 215 if(tt_aElt[tt_aElt.length - 1]) 216 tt_aElt[tt_aElt.length - 1].style.display = "none"; 217 } 218} 219function tt_GetElt(id) 220{ 221 return(document.getElementById ? document.getElementById(id) 222 : document.all ? document.all[id] 223 : null); 224} 225function tt_GetDivW(el) 226{ 227 return(el ? (el.offsetWidth || el.style.pixelWidth || 0) : 0); 228} 229function tt_GetDivH(el) 230{ 231 return(el ? (el.offsetHeight || el.style.pixelHeight || 0) : 0); 232} 233function tt_GetScrollX() 234{ 235 return(window.pageXOffset || (tt_db ? (tt_db.scrollLeft || 0) : 0)); 236} 237function tt_GetScrollY() 238{ 239 return(window.pageYOffset || (tt_db ? (tt_db.scrollTop || 0) : 0)); 240} 241function tt_GetClientW() 242{ 243 var de = document.documentElement; 244 return((de && de.clientWidth) ? de.clientWidth : (document.body.clientWidth || window.innerWidth || 0)); 245} 246function tt_GetClientH() 247{ 248 var de = document.documentElement; 249 return((de && de.clientHeight) ? de.clientHeight : (document.body.clientHeight || window.innerHeight || 0)); 250} 251function tt_GetEvtX(e) 252{ 253 return (e ? ((typeof(e.pageX) != tt_u) ? e.pageX : (e.clientX + tt_scrlX)) : 0); 254} 255function tt_GetEvtY(e) 256{ 257 return (e ? ((typeof(e.pageY) != tt_u) ? e.pageY : (e.clientY + tt_scrlY)) : 0); 258} 259function tt_AddEvtFnc(el, sEvt, PFnc) 260{ 261 if(el) 262 { 263 if(el.addEventListener) 264 el.addEventListener(sEvt, PFnc, false); 265 else 266 el.attachEvent("on" + sEvt, PFnc); 267 } 268} 269function tt_RemEvtFnc(el, sEvt, PFnc) 270{ 271 if(el) 272 { 273 if(el.removeEventListener) 274 el.removeEventListener(sEvt, PFnc, false); 275 else 276 el.detachEvent("on" + sEvt, PFnc); 277 } 278} 279function tt_GetDad(el) 280{ 281 return(el.parentNode || el.parentElement || el.offsetParent); 282} 283function tt_MovDomNode(el, dadFrom, dadTo) 284{ 285 if(dadFrom) 286 dadFrom.removeChild(el); 287 if(dadTo) 288 dadTo.appendChild(el); 289} 290 291//====================== PRIVATE ===========================================// 292var tt_aExt = new Array(), // Array of extension objects 293 294tt_db, tt_op, tt_ie, tt_ie56, tt_bBoxOld, // Browser flags 295tt_body, 296tt_ovr_, // HTML element the mouse is currently over 297tt_flagOpa, // Opacity support: 1=IE, 2=Khtml, 3=KHTML, 4=Moz, 5=W3C 298tt_maxPosX, tt_maxPosY, 299tt_iState = 0, // Tooltip active |= 1, shown |= 2, move with mouse |= 4 300tt_opa, // Currently applied opacity 301tt_bJmpVert, tt_bJmpHorz,// Tip temporarily on other side of mouse 302tt_elDeHref, // The tag from which we've removed the href attribute 303// Timer 304tt_tShow = new Number(0), tt_tHide = new Number(0), tt_tDurt = new Number(0), 305tt_tFade = new Number(0), tt_tWaitMov = new Number(0), 306tt_bWait = false, 307tt_u = "undefined"; 308 309 310function tt_Init() 311{ 312 tt_MkCmdEnum(); 313 // Send old browsers instantly to hell 314 if(!tt_Browser() || !tt_MkMainDiv()) 315 return; 316 // Levy 06/11/2008: Important! IE doesn't fire an onscroll when a page 317 // refresh is made, so we need to recalc page positions on init. 318 tt_OnScrl(); 319 tt_IsW3cBox(); 320 tt_OpaSupport(); 321 tt_AddEvtFnc(window, "scroll", tt_OnScrl); 322 // IE doesn't fire onscroll event when switching to fullscreen;
323 // fix suggested by Yoav Karpeles 14.2.2008 324 tt_AddEvtFnc(window, "resize", tt_OnScrl); 325 tt_AddEvtFnc(document, "mousemove", tt_Move); 326 // In Debug mode we search for TagToTip() calls in order to notify 327 // the user if they've forgotten to set the TagsToTip config flag 328 if(TagsToTip || tt_Debug) 329 tt_SetOnloadFnc(); 330 // Ensure the tip be hidden when the page unloads 331 tt_AddEvtFnc(window, "unload", tt_Hide); 332} 333// Creates command names by translating config variable names to upper case 334function tt_MkCmdEnum() 335{ 336 var n = 0; 337 for(var i in config) 338 eval("window." + i.toString().toUpperCase() + " = " + n++); 339 tt_aV.length = n; 340} 341function tt_Browser() 342{ 343 var n, nv, n6, w3c; 344 345 n = navigator.userAgent.toLowerCase(), 346 nv = navigator.appVersion; 347 tt_op = (document.defaultView && typeof(eval("w" + "indow" + "." + "o" + "p" + "er" + "a")) != tt_u); 348 tt_ie = n.indexOf("msie") != -1 && document.all && !tt_op; 349 if(tt_ie) 350 { 351 var ieOld = (!document.compatMode || document.compatMode == "BackCompat"); 352 tt_db = !ieOld ? document.documentElement : (document.body || null); 353 if(tt_db) 354 tt_ie56 = parseFloat(nv.substring(nv.indexOf("MSIE") + 5)) >= 5.5 355 && typeof document.body.style.maxHeight == tt_u; 356 } 357 else 358 { 359 tt_db = document.documentElement || document.body || 360 (document.getElementsByTagName ? document.getElementsByTagName("body")[0] 361 : null); 362 if(!tt_op) 363 { 364 n6 = document.defaultView && typeof document.defaultView.getComputedStyle != tt_u; 365 w3c = !n6 && document.getElementById; 366 } 367 } 368 tt_body = (document.getElementsByTagName ? document.getElementsByTagName("body")[0] 369 : (document.body || null)); 370 if(tt_ie || n6 || tt_op || w3c) 371 { 372 if(tt_body && tt_db) 373 { 374 if(document.attachEvent || document.addEventListener) 375 return true; 376 } 377 else 378 tt_Err("wz_tooltip.js must be included INSIDE the body section," 379 + " immediately after the opening <body> tag.", false); 380 } 381 tt_db = null; 382 return false; 383} 384function tt_MkMainDiv() 385{ 386 // Create the tooltip DIV 387 if(tt_body.insertAdjacentHTML)
388 tt_body.insertAdjacentHTML("afterBegin", tt_MkMainDivHtm()); 389 else if(typeof tt_body.innerHTML != tt_u && document.createElement && tt_body.appendChild) 390 tt_body.appendChild(tt_MkMainDivDom()); 391 if(window.tt_GetMainDivRefs /* FireFox Alzheimer */ && tt_GetMainDivRefs()) 392 return true; 393 tt_db = null; 394 return false; 395} 396function tt_MkMainDivHtm() 397{ 398 return('<div id="WzTtDiV"></div>' + 399 (tt_ie56 ? ('<iframe id="WzTtIfRm" src="javascript:false" scrolling="no" frameborder="0" style="filter:Alpha(opacity=0);position:absolute;top:0px;left:0px;display:none;"></iframe>') 400 : '')); 401} 402function tt_MkMainDivDom() 403{ 404 var el = document.createElement("div"); 405 if(el) 406 el.id = "WzTtDiV"; 407 return el; 408} 409function tt_GetMainDivRefs() 410{ 411 tt_aElt[0] = tt_GetElt("WzTtDiV"); 412 if(tt_ie56 && tt_aElt[0]) 413 { 414 tt_aElt[tt_aElt.length - 1] = tt_GetElt("WzTtIfRm"); 415 if(!tt_aElt[tt_aElt.length - 1]) 416 tt_aElt[0] = null; 417 } 418 if(tt_aElt[0]) 419 { 420 var css = tt_aElt[0].style; 421 422 css.visibility = "hidden"; 423 css.position = "absolute"; 424 css.overflow = "hidden"; 425 return true; 426 } 427 return false; 428} 429function tt_ResetMainDiv() 430{ 431 tt_SetTipPos(0, 0); 432 tt_aElt[0].innerHTML = ""; 433 tt_aElt[0].style.width = "auto"; 434 tt_h = 0; 435} 436function tt_IsW3cBox() 437{ 438 var css = tt_aElt[0].style; 439 440 css.padding = "10px"; 441 css.width = "40px"; 442 tt_bBoxOld = (tt_GetDivW(tt_aElt[0]) == 40); 443 css.padding = "0px"; 444 tt_ResetMainDiv(); 445} 446function tt_OpaSupport() 447{ 448 var css = tt_body.style; 449 450 tt_flagOpa = (typeof(css.KhtmlOpacity) != tt_u) ? 2 451 : (typeof(css.KHTMLOpacity) != tt_u) ? 3 452 : (typeof(css.MozOpacity) != tt_u) ? 4 453 : (typeof(css.opacity) != tt_u) ? 5 454 : (typeof(css.filter) != tt_u) ? 1 455 : 0; 456} 457// Ported from http://dean.edwards.name/weblog/2006/06/again/ 458// (Dean Edwards et al.) 459function tt_SetOnloadFnc() 460{ 461 tt_AddEvtFnc(document, "DOMContentLoaded", tt_HideSrcTags); 462 tt_AddEvtFnc(window, "load", tt_HideSrcTags); 463 if(tt_body.attachEvent) 464 tt_body.attachEvent("onreadystatechange", 465 function() { 466 if(tt_body.readyState == "complete") 467 tt_HideSrcTags(); 468 } ); 469 if(/WebKit|KHTML/i.test(navigator.userAgent)) 470 { 471 var t = setInterval(function() { 472 if(/loaded|complete/.test(document.readyState)) 473 { 474 clearInterval(t); 475 tt_HideSrcTags(); 476 } 477 }, 10); 478 } 479} 480function tt_HideSrcTags() 481{ 482 if(!window.tt_HideSrcTags || window.tt_HideSrcTags.done) 483 return; 484 window.tt_HideSrcTags.done = true; 485 if(!tt_HideSrcTagsRecurs(tt_body)) 486 tt_Err("There are HTML elements to be converted to tooltips.\nIf you" 487 + " want these HTML elements to be automatically hidden, you" 488 + " must edit wz_tooltip.js, and set TagsToTip in the global" 489 + " tooltip configuration to true.", true); 490} 491function tt_HideSrcTagsRecurs(dad) 492{ 493 var ovr, asT2t; 494 // Walk the DOM tree for tags that have an onmouseover or onclick attribute 495 // containing a TagToTip('...') call. 496 // (.childNodes first since .children is bugous in Safari) 497 var a = dad.childNodes || dad.children || null; 498 499 for(var i = a ? a.length : 0; i;) 500 {--i; 501 if(!tt_HideSrcTagsRecurs(a[i])) 502 return false; 503 ovr = a[i].getAttribute ? (a[i].getAttribute("onmouseover") || a[i].getAttribute("onclick")) 504 : (typeof a[i].onmouseover == "function") ? (a[i].onmouseover || a[i].onclick) 505 : null; 506 if(ovr) 507 { 508 asT2t = ovr.toString().match(/TagToTip\s*\(\s*'[^'.]+'\s*[\),]/); 509 if(asT2t && asT2t.length) 510 { 511 if(!tt_HideSrcTag(asT2t[0])) 512 return false; 513 } 514 } 515 } 516 return true; 517} 518function tt_HideSrcTag(sT2t) 519{ 520 var id, el; 521 522 // The ID passed to the found TagToTip() call identifies an HTML element 523 // to be converted to a tooltip, so hide that element 524 id = sT2t.replace(/.+'([^'.]+)'.+/, "$1"); 525 el = tt_GetElt(id); 526 if(el) 527 { 528 if(tt_Debug && !TagsToTip) 529 return false; 530 else 531 el.style.display = "none"; 532 } 533 else 534 tt_Err("Invalid ID\n'" + id + "'\npassed to TagToTip()." 535 + " There exists no HTML element with that ID.", true); 536 return true; 537} 538function tt_Tip(arg, t2t) 539{ 540 if(!tt_db) 541 return; 542 if(tt_iState) 543 tt_Hide(); 544 if(!tt_Enabled) 545 return; 546 tt_t2t = t2t; 547 if(!tt_ReadCmds(arg)) 548 return; 549 tt_iState = 0x1 | 0x4; 550 tt_AdaptConfig1(); 551 tt_MkTipContent(arg); 552 tt_MkTipSubDivs(); 553 tt_FormatTip(); 554 tt_bJmpVert = false; 555 tt_bJmpHorz = false; 556 tt_maxPosX = tt_GetClientW() + tt_scrlX - tt_w - 1; 557 tt_maxPosY = tt_GetClientH() + tt_scrlY - tt_h - 1; 558 tt_AdaptConfig2(); 559 // Ensure the tip be shown and positioned before the first onmousemove 560 tt_OverInit(); 561 tt_ShowInit(); 562 tt_Move(); 563} 564function tt_ReadCmds(a) 565{ 566 var i; 567 568 // First load the global config values, to initialize also values 569 // for which no command is passed 570 i = 0; 571 for(var j in config) 572 tt_aV[i++] = config[j]; 573 // Then replace each cached config value for which a command is 574 // passed (ensure the # of command args plus value args be even) 575 if(a.length & 1) 576 { 577 for(i = a.length - 1; i > 0; i -= 2) 578 tt_aV[a[i - 1]] = a[i]; 579 return true; 580 } 581 tt_Err("Incorrect call of Tip() or TagToTip().\n" 582 + "Each command must be followed by a value.", true); 583 return false; 584} 585function tt_AdaptConfig1() 586{ 587 tt_ExtCallFncs(0, "LoadConfig"); 588 // Inherit unspecified title formattings from body 589 if(!tt_aV[TITLEBGCOLOR].length) 590 tt_aV[TITLEBGCOLOR] = tt_aV[BORDERCOLOR]; 591 if(!tt_aV[TITLEFONTCOLOR].length) 592 tt_aV[TITLEFONTCOLOR] = tt_aV[BGCOLOR]; 593 if(!tt_aV[TITLEFONTFACE].length) 594 tt_aV[TITLEFONTFACE] = tt_aV[FONTFACE]; 595 if(!tt_aV[TITLEFONTSIZE].length) 596 tt_aV[TITLEFONTSIZE] = tt_aV[FONTSIZE]; 597 if(tt_aV[CLOSEBTN]) 598 { 599 // Use title colours for non-specified closebutton colours 600 if(!tt_aV[CLOSEBTNCOLORS]) 601 tt_aV[CLOSEBTNCOLORS] = new Array("", "", "", ""); 602 for(var i = 4; i;) 603 {--i; 604 if(!tt_aV[CLOSEBTNCOLORS][i].length) 605 tt_aV[CLOSEBTNCOLORS][i] = (i & 1) ? tt_aV[TITLEFONTCOLOR] : tt_aV[TITLEBGCOLOR]; 606 } 607 // Enforce titlebar be shown 608 if(!tt_aV[TITLE].length) 609 tt_aV[TITLE] = " "; 610 }
611 // Circumvents broken display of images and fade-in flicker in Geckos < 1.8 612 if(tt_aV[OPACITY] == 100 && typeof tt_aElt[0].style.MozOpacity != tt_u && !Array.every) 613 tt_aV[OPACITY] = 99; 614 // Smartly shorten the delay for fade-in tooltips 615 if(tt_aV[FADEIN] && tt_flagOpa && tt_aV[DELAY] > 100) 616 tt_aV[DELAY] = Math.max(tt_aV[DELAY] - tt_aV[FADEIN], 100); 617} 618function tt_AdaptConfig2() 619{ 620 if(tt_aV[CENTERMOUSE]) 621 { 622 tt_aV[OFFSETX] -= ((tt_w - (tt_aV[SHADOW] ? tt_aV[SHADOWWIDTH] : 0)) >> 1); 623 tt_aV[JUMPHORZ] = false; 624 } 625} 626// Expose content globally so extensions can modify it 627function tt_MkTipContent(a) 628{ 629 if(tt_t2t) 630 { 631 if(tt_aV[COPYCONTENT]) 632 tt_sContent = tt_t2t.innerHTML; 633 else 634 tt_sContent = ""; 635 } 636 else 637 tt_sContent = a[0]; 638 tt_ExtCallFncs(0, "CreateContentString"); 639} 640function tt_MkTipSubDivs() 641{ 642 var sCss = 'position:relative;margin:0px;padding:0px;border-width:0px;left:0px;top:0px;line-height:normal;width:auto;', 643 sTbTrTd = ' cellspacing="0" cellpadding="0" border="0" style="' + sCss + '"><tbody style="' + sCss + '"><tr><td '; 644 645 tt_aElt[0].innerHTML = 646 ('' 647 + (tt_aV[TITLE].length ? 648 ('<div id="WzTiTl" style="position:relative;z-index:1;">' 649 + '<table id="WzTiTlTb"' + sTbTrTd + 'id="WzTiTlI" style="' + sCss + '">' 650 + tt_aV[TITLE] 651 + '</td>' 652 + (tt_aV[CLOSEBTN] ? 653 ('<td align="right" style="' + sCss 654 + 'text-align:right;">' 655 + '<span id="WzClOsE" style="position:relative;left:2px;padding-left:2px;padding-right:2px;' 656 + 'cursor:' + (tt_ie ? 'hand' : 'pointer') 657 + ';" onmouseover="tt_OnCloseBtnOver(1)" onmouseout="tt_OnCloseBtnOver(0)" onclick="tt_HideInit()">' 658 + tt_aV[CLOSEBTNTEXT] 659 + '</span></td>') 660 : '') 661 + '</tr></tbody></table></div>') 662 : '') 663 + '<div id="WzBoDy" style="position:relative;z-index:0;">' 664 + '<table' + sTbTrTd + 'id="WzBoDyI" style="' + sCss + '">' 665 + tt_sContent 666 + '</td></tr></tbody></table></div>' 667 + (tt_aV[SHADOW] 668 ? ('<div id="WzTtShDwR" style="position:absolute;overflow:hidden;"></div>' 669 + '<div id="WzTtShDwB" style="position:relative;overflow:hidden;"></div>') 670 : '') 671 ); 672 tt_GetSubDivRefs(); 673 // Convert DOM node to tip 674 if(tt_t2t && !tt_aV[COPYCONTENT]) 675 tt_El2Tip(); 676 tt_ExtCallFncs(0, "SubDivsCreated"); 677} 678function tt_GetSubDivRefs() 679{ 680 var aId = new Array("WzTiTl", "WzTiTlTb", "WzTiTlI", "WzClOsE", "WzBoDy", "WzBoDyI", "WzTtShDwB", "WzTtShDwR"); 681 682 for(var i = aId.length; i; --i) 683 tt_aElt[i] = tt_GetElt(aId[i - 1]); 684} 685function tt_FormatTip() 686{ 687 var css, w, h, pad = tt_aV[PADDING], padT, wBrd = tt_aV[BORDERWIDTH], 688 iOffY, iOffSh, iAdd = (pad + wBrd) << 1; 689 690 //--------- Title DIV ---------- 691 if(tt_aV[TITLE].length) 692 { 693 padT = tt_aV[TITLEPADDING]; 694 css = tt_aElt[1].style; 695 css.background = tt_aV[TITLEBGCOLOR]; 696 css.paddingTop = css.paddingBottom = padT + "px"; 697 css.paddingLeft = css.paddingRight = (padT + 2) + "px"; 698 css = tt_aElt[3].style; 699 css.color = tt_aV[TITLEFONTCOLOR]; 700 if(tt_aV[WIDTH] == -1) 701 css.whiteSpace = "nowrap"; 702 css.fontFamily = tt_aV[TITLEFONTFACE]; 703 css.fontSize = tt_aV[TITLEFONTSIZE]; 704 css.fontWeight = "bold"; 705 css.textAlign = tt_aV[TITLEALIGN]; 706 // Close button DIV 707 if(tt_aElt[4]) 708 { 709 css = tt_aElt[4].style; 710 css.background = tt_aV[CLOSEBTNCOLORS][0]; 711 css.color = tt_aV[CLOSEBTNCOLORS][1]; 712 css.fontFamily = tt_aV[TITLEFONTFACE]; 713 css.fontSize = tt_aV[TITLEFONTSIZE]; 714 css.fontWeight = "bold"; 715 } 716 if(tt_aV[WIDTH] > 0) 717 tt_w = tt_aV[WIDTH]; 718 else 719 { 720 tt_w = tt_GetDivW(tt_aElt[3]) + tt_GetDivW(tt_aElt[4]); 721 // Some spacing between title DIV and closebutton 722 if(tt_aElt[4]) 723 tt_w += pad; 724 // Restrict auto width to max width 725 if(tt_aV[WIDTH] < -1 && tt_w > -tt_aV[WIDTH]) 726 tt_w = -tt_aV[WIDTH]; 727 } 728 // Ensure the top border of the body DIV be covered by the title DIV 729 iOffY = -wBrd; 730 } 731 else 732 { 733 tt_w = 0; 734 iOffY = 0; 735 } 736 737 //-------- Body DIV ------------ 738 css = tt_aElt[5].style; 739 css.top = iOffY + "px"; 740 if(wBrd) 741 { 742 css.borderColor = tt_aV[BORDERCOLOR]; 743 css.borderStyle = tt_aV[BORDERSTYLE]; 744 css.borderWidth = wBrd + "px"; 745 } 746 if(tt_aV[BGCOLOR].length) 747 css.background = tt_aV[BGCOLOR]; 748 if(tt_aV[BGIMG].length) 749 css.backgroundImage = "url(" + tt_aV[BGIMG] + ")"; 750 css.padding = pad + "px"; 751 css.textAlign = tt_aV[TEXTALIGN]; 752 if(tt_aV[HEIGHT]) 753 { 754 css.overflow = "auto"; 755 if(tt_aV[HEIGHT] > 0) 756 css.height = (tt_aV[HEIGHT] + iAdd) + "px"; 757 else 758 tt_h = iAdd - tt_aV[HEIGHT]; 759 } 760 // TD inside body DIV 761 css = tt_aElt[6].style; 762 css.color = tt_aV[FONTCOLOR]; 763 css.fontFamily = tt_aV[FONTFACE]; 764 css.fontSize = tt_aV[FONTSIZE]; 765 css.fontWeight = tt_aV[FONTWEIGHT]; 766 css.textAlign = tt_aV[TEXTALIGN]; 767 if(tt_aV[WIDTH] > 0) 768 w = tt_aV[WIDTH]; 769 // Width like title (if existent) 770 else if(tt_aV[WIDTH] == -1 && tt_w) 771 w = tt_w; 772 else
773 { 774 // Measure width of the body's inner TD, as some browsers would expand 775 // the container and outer body DIV to 100% 776 w = tt_GetDivW(tt_aElt[6]); 777 // Restrict auto width to max width 778 if(tt_aV[WIDTH] < -1 && w > -tt_aV[WIDTH]) 779 w = -tt_aV[WIDTH]; 780 } 781 if(w > tt_w) 782 tt_w = w; 783 tt_w += iAdd; 784 785 //--------- Shadow DIVs ------------ 786 if(tt_aV[SHADOW]) 787 { 788 tt_w += tt_aV[SHADOWWIDTH]; 789 iOffSh = Math.floor((tt_aV[SHADOWWIDTH] * 4) / 3); 790 // Bottom shadow 791 css = tt_aElt[7].style; 792 css.top = iOffY + "px"; 793 css.left = iOffSh + "px"; 794 css.width = (tt_w - iOffSh - tt_aV[SHADOWWIDTH]) + "px"; 795 css.height = tt_aV[SHADOWWIDTH] + "px"; 796 css.background = tt_aV[SHADOWCOLOR]; 797 // Right shadow 798 css = tt_aElt[8].style; 799 css.top = iOffSh + "px"; 800 css.left = (tt_w - tt_aV[SHADOWWIDTH]) + "px"; 801 css.width = tt_aV[SHADOWWIDTH] + "px"; 802 css.background = tt_aV[SHADOWCOLOR]; 803 } 804 else 805 iOffSh = 0; 806 807 //-------- Container DIV ------- 808 tt_SetTipOpa(tt_aV[FADEIN] ? 0 : tt_aV[OPACITY]); 809 tt_FixSize(iOffY, iOffSh); 810} 811// Fixate the size so it can't dynamically change while the tooltip is moving. 812function tt_FixSize(iOffY, iOffSh) 813{ 814 var wIn, wOut, h, add, pad = tt_aV[PADDING], wBrd = tt_aV[BORDERWIDTH], i; 815 816 tt_aElt[0].style.width = tt_w + "px"; 817 tt_aElt[0].style.pixelWidth = tt_w; 818 wOut = tt_w - ((tt_aV[SHADOW]) ? tt_aV[SHADOWWIDTH] : 0); 819 // Body 820 wIn = wOut; 821 if(!tt_bBoxOld) 822 wIn -= (pad + wBrd) << 1; 823 tt_aElt[5].style.width = wIn + "px"; 824 // Title 825 if(tt_aElt[1]) 826 { 827 wIn = wOut - ((tt_aV[TITLEPADDING] + 2) << 1); 828 if(!tt_bBoxOld) 829 wOut = wIn; 830 tt_aElt[1].style.width = wOut + "px"; 831 tt_aElt[2].style.width = wIn + "px"; 832 } 833 // Max height specified 834 if(tt_h) 835 { 836 h = tt_GetDivH(tt_aElt[5]); 837 if(h > tt_h) 838 { 839 if(!tt_bBoxOld) 840 tt_h -= (pad + wBrd) << 1; 841 tt_aElt[5].style.height = tt_h + "px"; 842 } 843 } 844 tt_h = tt_GetDivH(tt_aElt[0]) + iOffY; 845 // Right shadow 846 if(tt_aElt[8]) 847 tt_aElt[8].style.height = (tt_h - iOffSh) + "px"; 848 i = tt_aElt.length - 1; 849 if(tt_aElt[i]) 850 { 851 tt_aElt[i].style.width = tt_w + "px"; 852 tt_aElt[i].style.height = tt_h + "px"; 853 } 854} 855function tt_DeAlt(el) 856{ 857 var aKid; 858 859 if(el) 860 { 861 if(el.alt) 862 el.alt = ""; 863 if(el.title) 864 el.title = ""; 865 aKid = el.childNodes || el.children || null; 866 if(aKid) 867 { 868 for(var i = aKid.length; i;) 869 tt_DeAlt(aKid[--i]); 870 } 871 } 872} 873// This hack removes the native tooltips over links in Opera 874function tt_OpDeHref(el) 875{ 876 if(!tt_op) 877 return; 878 if(tt_elDeHref) 879 tt_OpReHref(); 880 while(el) 881 { 882 if(el.hasAttribute && el.hasAttribute("href")) 883 { 884 el.t_href = el.getAttribute("href"); 885 el.t_stats = window.status; 886 el.removeAttribute("href"); 887 el.style.cursor = "hand"; 888 tt_AddEvtFnc(el, "mousedown", tt_OpReHref); 889 window.status = el.t_href; 890 tt_elDeHref = el; 891 break; 892 } 893 el = tt_GetDad(el); 894 } 895} 896function tt_OpReHref() 897{ 898 if(tt_elDeHref) 899 { 900 tt_elDeHref.setAttribute("href", tt_elDeHref.t_href); 901 tt_RemEvtFnc(tt_elDeHref, "mousedown", tt_OpReHref); 902 window.status = tt_elDeHref.t_stats; 903 tt_elDeHref = null; 904 } 905} 906function tt_El2Tip() 907{ 908 var css = tt_t2t.style; 909 910 // Store previous positioning 911 tt_t2t.t_cp = css.position; 912 tt_t2t.t_cl = css.left; 913 tt_t2t.t_ct = css.top; 914 tt_t2t.t_cd = css.display; 915 // Store the tag's parent element so we can restore that DOM branch 916 // when the tooltip is being hidden 917 tt_t2tDad = tt_GetDad(tt_t2t); 918 tt_MovDomNode(tt_t2t, tt_t2tDad, tt_aElt[6]); 919 css.display = "block"; 920 css.position = "static"; 921 css.left = css.top = css.marginLeft = css.marginTop = "0px"; 922} 923function tt_UnEl2Tip() 924{ 925 // Restore positioning and display 926 var css = tt_t2t.style; 927 928 css.display = tt_t2t.t_cd; 929 tt_MovDomNode(tt_t2t, tt_GetDad(tt_t2t), tt_t2tDad); 930 css.position = tt_t2t.t_cp; 931 css.left = tt_t2t.t_cl; 932 css.top = tt_t2t.t_ct; 933 tt_t2tDad = null; 934} 935function tt_OverInit() 936{ 937 if(window.event) 938 tt_over = window.event.target || window.event.srcElement; 939 else 940 tt_over = tt_ovr_; 941 tt_DeAlt(tt_over); 942 tt_OpDeHref(tt_over); 943} 944function tt_ShowInit() 945{ 946 tt_tShow.Timer("tt_Show()", tt_aV[DELAY], true); 947 if(tt_aV[CLICKCLOSE] || tt_aV[CLICKSTICKY]) 948 tt_AddEvtFnc(document, "mouseup", tt_OnLClick); 949} 950function tt_Show() 951{ 952 var css = tt_aElt[0].style; 953 954 // Override the z-index of the topmost wz_dragdrop.js D&D item 955 css.zIndex = Math.max((window.dd && dd.z) ? (dd.z + 2) : 0, 1010); 956 if(tt_aV[STICKY] || !tt_aV[FOLLOWMOUSE]) 957 tt_iState &= ~0x4; 958 if(tt_aV[DURATION] > 0) 959 tt_tDurt.Timer("tt_HideInit()", tt_aV[DURATION], true); 960 tt_ExtCallFncs(0, "Show") 961 css.visibility = "visible"; 962 tt_iState |= 0x2; 963 if(tt_aV[FADEIN]) 964 tt_Fade(0, 0, tt_aV[OPACITY], Math.round(tt_aV[FADEIN] / tt_aV[FADEINTERVAL])); 965 tt_ShowIfrm(); 966} 967function tt_ShowIfrm() 968{ 969 if(tt_ie56) 970 { 971 var ifrm = tt_aElt[tt_aElt.length - 1]; 972 if(ifrm) 973 { 974 var css = ifrm.style; 975 css.zIndex = tt_aElt[0].style.zIndex - 1; 976 css.display = "block"; 977 } 978 } 979} 980function tt_Move(e) 981{ 982 if(e) 983 tt_ovr_ = e.target || e.srcElement; 984 e = e || window.event; 985 if(e) 986 { 987 tt_musX = tt_GetEvtX(e); 988 tt_musY = tt_GetEvtY(e); 989 } 990 if(tt_iState & 0x04) 991 { 992 // Prevent jam of mousemove events 993 if(!tt_op && !tt_ie) 994 { 995 if(tt_bWait) 996 return; 997 tt_bWait = true; 998 tt_tWaitMov.Timer("tt_bWait = false;", 1, true); 999 } 1000 if(tt_aV[FIX]) 1001 { 1002 tt_iState &= ~0x4; 1003 tt_PosFix();
1004 } 1005 else if(!tt_ExtCallFncs(e, "MoveBefore")) 1006 tt_SetTipPos(tt_Pos(0), tt_Pos(1)); 1007 tt_ExtCallFncs([tt_musX, tt_musY], "MoveAfter") 1008 } 1009} 1010function tt_Pos(iDim) 1011{ 1012 var iX, bJmpMod, cmdAlt, cmdOff, cx, iMax, iScrl, iMus, bJmp; 1013 1014 // Map values according to dimension to calculate 1015 if(iDim) 1016 { 1017 bJmpMod = tt_aV[JUMPVERT]; 1018 cmdAlt = ABOVE; 1019 cmdOff = OFFSETY; 1020 cx = tt_h; 1021 iMax = tt_maxPosY; 1022 iScrl = tt_scrlY; 1023 iMus = tt_musY; 1024 bJmp = tt_bJmpVert; 1025 } 1026 else 1027 { 1028 bJmpMod = tt_aV[JUMPHORZ]; 1029 cmdAlt = LEFT; 1030 cmdOff = OFFSETX; 1031 cx = tt_w; 1032 iMax = tt_maxPosX; 1033 iScrl = tt_scrlX; 1034 iMus = tt_musX; 1035 bJmp = tt_bJmpHorz; 1036 } 1037 if(bJmpMod) 1038 { 1039 if(tt_aV[cmdAlt] && (!bJmp || tt_CalcPosAlt(iDim) >= iScrl + 16)) 1040 iX = tt_PosAlt(iDim); 1041 else if(!tt_aV[cmdAlt] && bJmp && tt_CalcPosDef(iDim) > iMax - 16) 1042 iX = tt_PosAlt(iDim); 1043 else 1044 iX = tt_PosDef(iDim); 1045 } 1046 else 1047 { 1048 iX = iMus; 1049 if(tt_aV[cmdAlt]) 1050 iX -= cx + tt_aV[cmdOff] - (tt_aV[SHADOW] ? tt_aV[SHADOWWIDTH] : 0); 1051 else 1052 iX += tt_aV[cmdOff]; 1053 } 1054 // Prevent tip from extending past clientarea boundary 1055 if(iX > iMax) 1056 iX = bJmpMod ? tt_PosAlt(iDim) : iMax; 1057 // In case of insufficient space on both sides, ensure the left/upper part 1058 // of the tip be visible 1059 if(iX < iScrl) 1060 iX = bJmpMod ? tt_PosDef(iDim) : iScrl; 1061 return iX; 1062} 1063function tt_PosDef(iDim) 1064{ 1065 if(iDim) 1066 tt_bJmpVert = tt_aV[ABOVE]; 1067 else 1068 tt_bJmpHorz = tt_aV[LEFT]; 1069 return tt_CalcPosDef(iDim); 1070} 1071function tt_PosAlt(iDim) 1072{ 1073 if(iDim) 1074 tt_bJmpVert = !tt_aV[ABOVE]; 1075 else 1076 tt_bJmpHorz = !tt_aV[LEFT]; 1077 return tt_CalcPosAlt(iDim); 1078} 1079function tt_CalcPosDef(iDim) 1080{ 1081 return iDim ? (tt_musY + tt_aV[OFFSETY]) : (tt_musX + tt_aV[OFFSETX]); 1082} 1083function tt_CalcPosAlt(iDim) 1084{ 1085 var cmdOff = iDim ? OFFSETY : OFFSETX; 1086 var dx = tt_aV[cmdOff] - (tt_aV[SHADOW] ? tt_aV[SHADOWWIDTH] : 0); 1087 if(tt_aV[cmdOff] > 0 && dx <= 0) 1088 dx = 1; 1089 return((iDim ? (tt_musY - tt_h) : (tt_musX - tt_w)) - dx); 1090} 1091function tt_PosFix() 1092{ 1093 var iX, iY; 1094 1095 if(typeof(tt_aV[FIX][0]) == "number") 1096 { 1097 iX = tt_aV[FIX][0]; 1098 iY = tt_aV[FIX][1]; 1099 } 1100 else 1101 { 1102 if(typeof(tt_aV[FIX][0]) == "string") 1103 el = tt_GetElt(tt_aV[FIX][0]); 1104 // First slot in array is direct reference to HTML element 1105 else 1106 el = tt_aV[FIX][0]; 1107 iX = tt_aV[FIX][1]; 1108 iY = tt_aV[FIX][2]; 1109 // By default, vert pos is related to bottom edge of HTML element 1110 if(!tt_aV[ABOVE] && el) 1111 iY += tt_GetDivH(el); 1112 for(; el; el = el.offsetParent) 1113 { 1114 iX += el.offsetLeft || 0; 1115 iY += el.offsetTop || 0; 1116 } 1117 } 1118 // For a fixed tip positioned above the mouse, use the bottom edge as anchor 1119 // (recommended by Christophe Rebeschini, 31.1.2008) 1120 if(tt_aV[ABOVE]) 1121 iY -= tt_h; 1122 tt_SetTipPos(iX, iY); 1123} 1124function tt_Fade(a, now, z, n) 1125{ 1126 if(n) 1127 { 1128 now += Math.round((z - now) / n); 1129 if((z > a) ? (now >= z) : (now <= z)) 1130 now = z; 1131 else 1132 tt_tFade.Timer( 1133 "tt_Fade(" 1134 + a + "," + now + "," + z + "," + (n - 1) 1135 + ")", 1136 tt_aV[FADEINTERVAL], 1137 true 1138 ); 1139 } 1140 now ? tt_SetTipOpa(now) : tt_Hide(); 1141} 1142function tt_SetTipOpa(opa) 1143{ 1144 // To circumvent the opacity nesting flaws of IE, we set the opacity 1145 // for each sub-DIV separately, rather than for the container DIV. 1146 tt_SetOpa(tt_aElt[5], opa); 1147 if(tt_aElt[1]) 1148 tt_SetOpa(tt_aElt[1], opa); 1149 if(tt_aV[SHADOW]) 1150 { 1151 opa = Math.round(opa * 0.8); 1152 tt_SetOpa(tt_aElt[7], opa); 1153 tt_SetOpa(tt_aElt[8], opa); 1154 } 1155} 1156function tt_OnScrl() 1157{ 1158 tt_scrlX = tt_GetScrollX(); 1159 tt_scrlY = tt_GetScrollY(); 1160} 1161function tt_OnCloseBtnOver(iOver) 1162{ 1163 var css = tt_aElt[4].style; 1164 1165 iOver <<= 1; 1166 css.background = tt_aV[CLOSEBTNCOLORS][iOver]; 1167 css.color = tt_aV[CLOSEBTNCOLORS][iOver + 1]; 1168} 1169function tt_OnLClick(e) 1170{ 1171 // Ignore right-clicks 1172 e = e || window.event; 1173 if(!((e.button && e.button & 2) || (e.which && e.which == 3))) 1174 { 1175 if(tt_aV[CLICKSTICKY] && (tt_iState & 0x4)) 1176 { 1177 tt_aV[STICKY] = true; 1178 tt_iState &= ~0x4; 1179 } 1180 else if(tt_aV[CLICKCLOSE]) 1181 tt_HideInit(); 1182 } 1183} 1184function tt_Int(x) 1185{ 1186 var y; 1187 1188 return(isNaN(y = parseInt(x)) ? 0 : y); 1189} 1190Number.prototype.Timer = function(s, iT, bUrge) 1191{ 1192 if(!this.value || bUrge) 1193 this.value = window.setTimeout(s, iT); 1194} 1195Number.prototype.EndTimer = function() 1196{ 1197 if(this.value) 1198 { 1199 window.clearTimeout(this.value); 1200 this.value = 0; 1201 } 1202} 1203function tt_SetOpa(el, opa) 1204{ 1205 var css = el.style; 1206 1207 tt_opa = opa; 1208 if(tt_flagOpa == 1) 1209 { 1210 if(opa < 100) 1211 { 1212 // Hacks for bugs of IE: 1213 // 1.) Once a CSS filter has been applied, fonts are no longer
1214 // anti-aliased, so we store the previous 'non-filter' to be 1215 // able to restore it 1216 if(typeof(el.filtNo) == tt_u) 1217 el.filtNo = css.filter; 1218 // 2.) A DIV cannot be made visible in a single step if an 1219 // opacity < 100 has been applied while the DIV was hidden 1220 var bVis = css.visibility != "hidden"; 1221 // 3.) In IE6, applying an opacity < 100 has no effect if the 1222 // element has no layout (position, size, zoom, ...) 1223 css.zoom = "100%"; 1224 if(!bVis) 1225 css.visibility = "visible"; 1226 css.filter = "alpha(opacity=" + opa + ")"; 1227 if(!bVis) 1228 css.visibility = "hidden"; 1229 } 1230 else if(typeof(el.filtNo) != tt_u) 1231 // Restore 'non-filter' 1232 css.filter = el.filtNo; 1233 } 1234 else 1235 { 1236 opa /= 100.0; 1237 switch(tt_flagOpa) 1238 { 1239 case 2: 1240 css.KhtmlOpacity = opa; break; 1241 case 3: 1242 css.KHTMLOpacity = opa; break; 1243 case 4: 1244 css.MozOpacity = opa; break; 1245 case 5: 1246 css.opacity = opa; break; 1247 } 1248 } 1249} 1250function tt_Err(sErr, bIfDebug) 1251{ 1252 if(tt_Debug || !bIfDebug) 1253 alert("Tooltip Script Error Message:\n\n" + sErr); 1254} 1255 1256//============ EXTENSION (PLUGIN) MANAGER ===============// 1257function tt_ExtCmdEnum() 1258{ 1259 var s; 1260 1261 // Add new command(s) to the commands enum 1262 for(var i in config) 1263 { 1264 s = "window." + i.toString().toUpperCase(); 1265 if(eval("typeof(" + s + ") == tt_u")) 1266 { 1267 eval(s + " = " + tt_aV.length); 1268 tt_aV[tt_aV.length] = null; 1269 } 1270 } 1271} 1272function tt_ExtCallFncs(arg, sFnc) 1273{ 1274 var b = false; 1275 for(var i = tt_aExt.length; i;) 1276 {--i; 1277 var fnc = tt_aExt[i]["On" + sFnc]; 1278 // Call the method the extension has defined for this event 1279 if(fnc && fnc(arg)) 1280 b = true; 1281 } 1282 return b; 1283} 1284 1285tt_Init();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.