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