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