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