1/* 2 * jQuery clueTip plugin 3 * Version 1.0.7 (January 28, 2010) 4 * @requires jQuery v1.3+ 5 * 6 * Dual licensed under the MIT and GPL licenses: 7 * http://www.opensource.org/licenses/mit-license.php 8 * http://www.gnu.org/licenses/gpl.html 9 * 10 */ 11 12/* 13 * 14 * Full list of options/settings can be found at the bottom of this file and at http://plugins.learningjquery.com/cluetip/ 15 * 16 * Examples can be found at http://plugins.learningjquery.com/cluetip/demo/ 17 * 18*/ 19 20;(function($) { 21 $.cluetip = {version: '1.0.6'}; 22 var $cluetip, $cluetipInner, $cluetipOuter, $cluetipTitle, $cluetipArrows, $cluetipWait, $dropShadow, imgCount; 23 24 $.fn.cluetip = function(js, options) { 25 if (typeof js == 'object') { 26 options = js; 27 js = null; 28 } 29 if (js == 'destroy') { 30 return this.removeData('thisInfo').unbind('.cluetip'); 31 } 32 return this.each(function(index) { 33 var link = this, $this = $(this), $elRelative = null;; 34 35 // support metadata plugin (v1.0 and 2.0) 36 var opts = $.extend(true, {}, $.fn.cluetip.defaults, options || {}, $.metadata ? $this.metadata() : $.meta ? $this.data() : {}); 37 38 // thanhnp add for mio. If have setting about elRelative (element Relative) 39 // set this value to $elRelative 40 $elRelative = opts.elRelative || null; 41 if ($elRelative != null && $elRelative.length >0) { 42 $elRelative = ($elRelative.jquery ? $elRelative : $($elRelative)); 43 } 44 45 // start out with no contents (for ajax activation) 46 var cluetipContents = false; 47 var cluezIndex = +opts.cluezIndex; 48 $this.data('thisInfo', {title: link.title, zIndex: cluezIndex}); 49 var isActive = false, closeOnDelay = 0; 50 51 // create the cluetip divs 52 if (!$('#cluetip').length) { 53 $(['<div id="cluetip">', 54 '<div id="cluetip-outer">', 55 '<h3 id="cluetip-title"></h3>', 56 '<div id="cluetip-inner"></div>', 57 '</div>', 58 '<div id="cluetip-extra"></div>', 59 '<div id="cluetip-arrows" class="cluetip-arrows"></div>', 60 '</div>'].join('')) 61 [insertionType](insertionElement).hide(); 62 63 $cluetip = $('#cluetip').css({position: 'absolute'}); 64 $cluetipOuter = $('#cluetip-outer').css({position: 'relative', zIndex: cluezIndex}); 65 $cluetipInner = $('#cluetip-inner'); 66 $cluetipTitle = $('#cluetip-title'); 67 $cluetipArrows = $('#cluetip-arrows'); 68 $cluetipWait = $('<div id="cluetip-waitimage"></div>') 69 .css({position: 'absolute'}).insertBefore($cluetip).hide(); 70 } 71 var dropShadowSteps = (opts.dropShadow) ? +opts.dropShadowSteps : 0; 72 if (!$dropShadow) { 73 $dropShadow = $([]); 74 for (var i=0; i < dropShadowSteps; i++) { 75 $dropShadow = $dropShadow.add($('<div></div>').css({zIndex: cluezIndex-1, opacity:.1, top: 1+i, left: 1+i})); 76 } 77 $dropShadow.css({position: 'absolute', backgroundColor: '#000'}) 78 .prependTo($cluetip); 79 } 80 var tipAttribute = $this.attr(opts.attribute), ctClass = opts.cluetipClass; 81 if (!tipAttribute && !opts.splitTitle && !js) { 82 return true; 83 } 84 // if hideLocal is set to true, on DOM ready hide the local content that will be displayed in the clueTip 85 if (opts.local && opts.localPrefix) {tipAttribute = opts.localPrefix + tipAttribute;} 86 if (opts.local && opts.hideLocal) { $(tipAttribute + ':first').hide(); } 87 var tOffset = parseInt(opts.topOffset, 10), lOffset = parseInt(opts.leftOffset, 10); 88 // vertical measurement variables 89 var tipHeight, wHeight, 90 defHeight = isNaN(parseInt(opts.height, 10)) ? 'auto' : (/\D/g).test(opts.height) ? opts.height : opts.height + 'px'; 91 var sTop, linkTop, posY, tipY, mouseY, baseline; 92 // horizontal measurement variables 93 var tipInnerWidth = parseInt(opts.width, 10) || 275, 94 tipWidth = tipInnerWidth + (parseInt($cluetip.css('paddingLeft'),10)||0) + (parseInt($cluetip.css('paddingRight'),10)||0) + dropShadowSteps, 95 // linkWidth = this.offsetWidth, 96 linkLeft, posX, tipX, mouseX, winWidth; 97 98 // thanhnp add for mio. 99 // Update linkWidth, linkHeight with setting about elRelative 100 if ($elRelative != null && $elRelative.length >0) { 101 var linkWidth = $elRelative.get(0).offsetWidth; 102 var linkHeight = $elRelative.get(0).offsetHeight; 103 } 104 else { 105 var linkWidth = this.offsetWidth; 106 var linkHeight = this.offsetHeight; 107 } 108 109 // parse the title 110 var tipParts; 111 var tipTitle = (opts.attribute != 'title') ? $this.attr(opts.titleAttribute) : ''; 112 if (opts.splitTitle) { 113 if (tipTitle == undefined) {tipTitle = '';} 114 tipParts = tipTitle.split(opts.splitTitle); 115 tipTitle = tipParts.shift(); 116 } 117 if (opts.escapeTitle) { 118 tipTitle = tipTitle.replace(/&/g,'&').replace(/>/g,'>').replace(/</g,'<'); 119 } 120 121 var localContent; 122 function returnFalse() { return false; } 123 124/*************************************** 125* ACTIVATION 126****************************************/ 127 128//activate clueTip 129 var activate = function(event) { 130 if (!opts.onActivate($this)) { 131 return false;
132 } 133 isActive = true; 134 $cluetip.removeClass().css({width: tipInnerWidth}); 135 if (tipAttribute == $this.attr('href')) { 136 $this.css('cursor', opts.cursor); 137 } 138 if (opts.hoverClass) { 139 $this.addClass(opts.hoverClass); 140 } 141 142 // thanhnp add for mio. to fixed position by relative tag 143 if ($elRelative != null) { 144 linkTop = posY = $elRelative.offset().top; 145 linkLeft = $elRelative.offset().left; 146 } 147 else { 148 linkTop = posY = $this.offset().top; 149 linkLeft = $this.offset().left; 150 } 151 152 //linkTop = posY = $this.offset().top; 153 //linkLeft = $this.offset().left; 154 155 mouseX = event.pageX; 156 mouseY = event.pageY; 157 if (link.tagName.toLowerCase() != 'area') { 158 sTop = $(document).scrollTop(); 159 winWidth = $(window).width(); 160 } 161// position clueTip horizontally 162 if (opts.positionBy == 'fixed') { 163 // posX = linkWidth + linkLeft + lOffset; 164 // thanhnp add for mio 165 // re calculate position X for cluetip 166 posX = (linkLeft + linkWidth + tipWidth + lOffset > winWidth) 167 ? ((linkLeft < tipWidth) ? (linkWidth - tipWidth) / 2 + linkLeft : linkLeft - tipWidth - lOffset) 168 : linkWidth + linkLeft + lOffset; 169 $cluetip.css({left: posX}); 170 } else { 171 posX = (linkWidth > linkLeft && linkLeft > tipWidth) 172 || linkLeft + linkWidth + tipWidth + lOffset > winWidth 173 ? linkLeft - tipWidth - lOffset 174 : linkWidth + linkLeft + lOffset; 175 if (link.tagName.toLowerCase() == 'area' || opts.positionBy == 'mouse' || linkWidth + tipWidth > winWidth) { // position by mouse 176 if (mouseX + 20 + tipWidth > winWidth) { 177 $cluetip.addClass(' cluetip-' + ctClass); 178 posX = (mouseX - tipWidth - lOffset) >= 0 ? mouseX - tipWidth - lOffset - parseInt($cluetip.css('marginLeft'),10) + parseInt($cluetipInner.css('marginRight'),10) : mouseX - (tipWidth/2); 179 } else { 180 posX = mouseX + lOffset; 181 } 182 } 183 var pY = posX < 0 ? event.pageY + tOffset : event.pageY; 184 $cluetip.css({ 185 left: (posX > 0 && opts.positionBy != 'bottomTop') ? posX : (mouseX + (tipWidth/2) > winWidth) ? winWidth/2 - tipWidth/2 : Math.max(mouseX - (tipWidth/2),0), 186 zIndex: $this.data('thisInfo').zIndex 187 }); 188 $cluetipArrows.css({zIndex: $this.data('thisInfo').zIndex+1}); 189 } 190 wHeight = $(window).height(); 191 192/*************************************** 193* load a string from cluetip method's first argument 194***************************************/ 195 if (js) { 196 if (typeof js == 'function') { 197 js = js.call(link); 198 } 199 $cluetipInner.html(js); 200 cluetipShow(pY); 201 } 202/*************************************** 203* load the title attribute only (or user-selected attribute). 204* clueTip title is the string before the first delimiter 205* subsequent delimiters place clueTip body text on separate lines 206***************************************/ 207 208 else if (tipParts) { 209 var tpl = tipParts.length; 210 $cluetipInner.html(tpl ? tipParts[0] : ''); 211 if (tpl > 1) { 212 for (var i=1; i < tpl; i++){ 213 $cluetipInner.append('<div class="split-body">' + tipParts[i] + '</div>'); 214 } 215 } 216 cluetipShow(pY); 217 } 218/*************************************** 219* load external file via ajax 220***************************************/ 221 222 else if (!opts.local && tipAttribute.indexOf('#') !== 0) { 223 if (/\.(jpe?g|tiff?|gif|png)$/i.test(tipAttribute)) { 224 $cluetipInner.html('<img src="' + tipAttribute + '" alt="' + tipTitle + '" />'); 225 cluetipShow(pY); 226 } else if (cluetipContents && opts.ajaxCache) { 227 $cluetipInner.html(cluetipContents); 228 cluetipShow(pY); 229 } else { 230 var optionBeforeSend = opts.ajaxSettings.beforeSend, 231 optionError = opts.ajaxSettings.error, 232 optionSuccess = opts.ajaxSettings.success, 233 optionComplete = opts.ajaxSettings.complete; 234 var ajaxSettings = { 235 cache: false, // force requested page not to be cached by browser 236 url: tipAttribute, 237 beforeSend: function(xhr) {
238 if (optionBeforeSend) {optionBeforeSend.call(link, xhr, $cluetip, $cluetipInner);} 239 $cluetipOuter.children().empty(); 240 if (opts.waitImage) { 241 $cluetipWait 242 .css({top: mouseY+20, left: mouseX+20, zIndex: $this.data('thisInfo').zIndex-1}) 243 .show(); 244 } 245 }, 246 error: function(xhr, textStatus) { 247 if (isActive) { 248 if (optionError) { 249 optionError.call(link, xhr, textStatus, $cluetip, $cluetipInner); 250 } else { 251 $cluetipInner.html('<i>sorry, the contents could not be loaded</i>'); 252 } 253 } 254 }, 255 success: function(data, textStatus) { 256 cluetipContents = opts.ajaxProcess.call(link, data); 257 if (isActive) { 258 if (optionSuccess) {optionSuccess.call(link, data, textStatus, $cluetip, $cluetipInner);} 259 $cluetipInner.html(cluetipContents); 260 } 261 }, 262 complete: function(xhr, textStatus) { 263 if (optionComplete) {optionComplete.call(link, xhr, textStatus, $cluetip, $cluetipInner);} 264 var imgs = $cluetipInner[0].getElementsByTagName('img'); 265 imgCount = imgs.length; 266 for (var i=0, l = imgs.length; i < l; i++) { 267 if (imgs[i].complete) { 268 imgCount--; 269 } 270 } 271 if (imgCount && !$.browser.opera) { 272 $(imgs).bind('load error', function() { 273 imgCount--; 274 if (imgCount<1) { 275 $cluetipWait.hide(); 276 if (isActive) { cluetipShow(pY); } 277 } 278 }); 279 } else { 280 $cluetipWait.hide(); 281 if (isActive) { cluetipShow(pY); } 282 } 283 } 284 }; 285 var ajaxMergedSettings = $.extend(true, {}, opts.ajaxSettings, ajaxSettings); 286 287 $.ajax(ajaxMergedSettings); 288 } 289 290/*************************************** 291* load an element from the same page 292***************************************/ 293 } else if (opts.local) { 294 295 var $localContent = $(tipAttribute + (/#\S+$/.test(tipAttribute) ? '' : ':eq(' + index + ')')).clone(true).show(); 296 $cluetipInner.html($localContent); 297 cluetipShow(pY); 298 } 299 }; 300 301// get dimensions and options for cluetip and prepare it to be shown 302 var cluetipShow = function(bpY) { 303 $cluetip.addClass('cluetip-' + ctClass); 304 if (opts.truncate) { 305 var $truncloaded = $cluetipInner.text().slice(0,opts.truncate) + '...'; 306 $cluetipInner.html($truncloaded); 307 } 308 function doNothing() {}; //empty function 309 (opts.showTitle)? (tipTitle ? $cluetipTitle.show().html(tipTitle) : $cluetipTitle.hide() ) : $cluetipTitle.hide(); 310 if (opts.sticky) { 311 var $closeLink = $('<div id="cluetip-close"'+( opts.closeClass ? 'class="'+opts.closeClass+'"' : '') +' ><a href="#">' + opts.closeText + '</a></div>'); 312 (opts.closePosition == 'bottom') ? $closeLink.appendTo($cluetipInner) : (opts.closePosition == 'title') ? $closeLink.prependTo($cluetipTitle) : $closeLink.prependTo($cluetipInner); 313 $closeLink.bind('click.cluetip', function() { 314 cluetipClose(); 315 return false; 316 }); 317 if (opts.mouseOutClose) { 318 $cluetip.bind('mouseleave.cluetip', function() { 319 cluetipClose(); 320 }); 321 } else { 322 $cluetip.unbind('mouseleave.cluetip'); 323 } 324 } 325// now that content is loaded, finish the positioning 326 var direction = ''; 327 $cluetipOuter.css({zIndex: $this.data('thisInfo').zIndex, overflow: defHeight == 'auto' ? 'visible' : 'auto', height: defHeight}); 328 tipHeight = defHeight == 'auto' ? Math.max($cluetip.outerHeight(),$cluetip.height()) : parseInt(defHeight,10); 329 tipY = posY; 330 baseline = sTop + wHeight; 331 if (opts.positionBy == 'fixed') { 332 // thanhnp add for mio 333 // move tip to top position 334 if (linkLeft < tipWidth && (linkLeft + linkWidth + tipWidth + lOffset > winWidth)) { 335 // posY = posY - linkHeight 336 direction = 'bottom'; 337 var arrow_height = 15; 338 tipY = posY -arrow_height- tOffset-$cluetip.height(); 339 } 340 else { 341 tipY = posY - opts.dropShadowSteps + tOffset; 342 } 343 //tipY = posY - opts.dropShadowSteps + tOffset; 344 } else if ( (posX < mouseX && Math.max(posX, 0) + tipWidth > mouseX) || opts.positionBy == 'bottomTop') { 345 if (posY + tipHeight + tOffset > baseline && mouseY - sTop > tipHeight + tOffset) { 346 tipY = mouseY - tipHeight - tOffset; 347 direction = 'top'; 348 } else { 349 tipY = mouseY + tOffset; 350 direction = 'bottom'; 351 } 352 } else if ( posY + tipHeight + tOffset > baseline ) { 353 tipY = (tipHeight >= wHeight) ? sTop : baseline - tipHeight - tOffset; 354 } else if ($this.css('display') == 'block' || link.tagName.toLowerCase() == 'area' || opts.positionBy == "mouse") { 355 tipY = bpY - tOffset; 356 } else { 357 tipY = posY - opts.dropShadowSteps; 358 } 359 if (direction == '') { 360 posX < linkLeft ? direction = 'left' : direction = 'right'; 361 } 362 $cluetip.css({top: tipY + 'px'}).removeClass().addClass('clue-' + direction + '-' + ctClass).addClass(' cluetip-' + ctClass); 363 if (opts.arrows) { // set up arrow positioning to align with element 364 var bgY = (posY - tipY - opts.dropShadowSteps); 365 $cluetipArrows.css({top: (/(left|right)/.test(direction) && posX >=0 && bgY > 0) ? bgY + 'px' : /(left|right)/.test(direction) ? 0 : ''}).show(); 366 } else { 367 $cluetipArrows.hide(); 368 } 369 370// (first hide, then) ***SHOW THE CLUETIP*** 371 $dropShadow.hide(); 372 $cluetip.hide()[opts.fx.open](opts.fx.openSpeed || 0); 373 if (opts.dropShadow) { $dropShadow.css({height: tipHeight, width: tipInnerWidth, zIndex: $this.data('thisInfo').zIndex-1}).show(); } 374 if ($.fn.bgiframe) { $cluetip.bgiframe(); } 375 // delayed close (not fully tested) 376 if (opts.delayedClose > 0) { 377 closeOnDelay = setTimeout(cluetipClose, opts.delayedClose); 378 } 379 // trigger the optional onShow function 380 opts.onShow.call(link, $cluetip, $cluetipInner); 381 }; 382 383/*************************************** 384 =INACTIVATION 385-------------------------------------- */ 386 var inactivate = function(event) { 387 isActive = false;
388 $cluetipWait.hide(); 389 if (!opts.sticky || (/click|toggle/).test(opts.activation) ) { 390 cluetipClose(); 391 clearTimeout(closeOnDelay); 392 } 393 if (opts.hoverClass) { 394 $this.removeClass(opts.hoverClass); 395 } 396 }; 397// close cluetip and reset some things 398 var cluetipClose = function() { 399 $cluetipOuter 400 .parent().hide().removeClass(); 401 opts.onHide.call(link, $cluetip, $cluetipInner); 402 $this.removeClass('cluetip-clicked'); 403 if (tipTitle) { 404 $this.attr(opts.titleAttribute, tipTitle); 405 } 406 $this.css('cursor',''); 407 if (opts.arrows) { 408 $cluetipArrows.css({top: ''}); 409 } 410 }; 411 412 $(document).bind('hideCluetip', function(e) { 413 cluetipClose(); 414 }); 415/*************************************** 416 =BIND EVENTS 417-------------------------------------- */ 418 // activate by click 419 if ( (/click|toggle/).test(opts.activation) ) { 420 $this.bind('click.cluetip', function(event) { 421 if ($cluetip.is(':hidden') || !$this.is('.cluetip-clicked')) { 422 activate(event); 423 $('.cluetip-clicked').removeClass('cluetip-clicked'); 424 $this.addClass('cluetip-clicked'); 425 } else { 426 inactivate(event); 427 } 428 this.blur(); 429 return false; 430 }); 431 // activate by focus; inactivate by blur 432 } else if (opts.activation == 'focus') { 433 $this.bind('focus.cluetip', function(event) { 434 activate(event); 435 }); 436 $this.bind('blur.cluetip', function(event) { 437 inactivate(event); 438 }); 439 // activate by hover 440 } else { 441 // clicking is returned false if clickThrough option is set to false 442 $this[opts.clickThrough ? 'unbind' : 'bind']('click', returnFalse); 443 //set up mouse tracking 444 var mouseTracks = function(evt) { 445 if (opts.tracking == true) { 446 var trackX = posX - evt.pageX; 447 var trackY = tipY ? tipY - evt.pageY : posY - evt.pageY; 448 $this.bind('mousemove.cluetip', function(evt) { 449 $cluetip.css({left: evt.pageX + trackX, top: evt.pageY + trackY }); 450 }); 451 } 452 }; 453 if ($.fn.hoverIntent && opts.hoverIntent) { 454 $this.hoverIntent({ 455 sensitivity: opts.hoverIntent.sensitivity, 456 interval: opts.hoverIntent.interval, 457 over: function(event) { 458 activate(event); 459 mouseTracks(event); 460 }, 461 timeout: opts.hoverIntent.timeout, 462 out: function(event) {inactivate(event); $this.unbind('mousemove.cluetip');} 463 }); 464 } else { 465 $this.bind('mouseenter.cluetip', function(event) { 466 activate(event); 467 mouseTracks(event); 468 }) 469 .bind('mouseleave.cluetip', function(event) { 470 inactivate(event); 471 $this.unbind('mousemove.cluetip'); 472 }); 473 } 474 475 // thanhnp fix lost focus bug on the selectbox on IE 476 /* 477 $this.bind('mouseover.cluetip', function(event) { 478 $this.attr('title',''); 479 }).bind('mouseleave.cluetip', function(event) { 480 $this.attr('title', $this.data('thisInfo').title); 481 }); 482 */ 483 } 484 }); 485 }; 486 487/* 488 * options for clueTip 489 * 490 * each one can be explicitly overridden by changing its value. 491 * for example: $.fn.cluetip.defaults.width = 200; 492 * would change the default width for all clueTips to 200. 493 * 494 * each one can also be overridden by passing an options map to the cluetip method. 495 * for example: $('a.example').cluetip({width: 200}); 496 * would change the default width to 200 for clueTips invoked by a link with class of "example" 497 * 498 */ 499 500 $.fn.cluetip.defaults = { // set up default options 501 width: 275, // The width of the clueTip 502 height: 'auto', // The height of the clueTip 503 cluezIndex: 97, // Sets the z-index style property of the clueTip 504 positionBy: 'auto', // Sets the type of positioning: 'auto', 'mouse','bottomTop', 'fixed' 505 topOffset: 15, // Number of px to offset clueTip from top of invoking element 506 leftOffset: 15, // Number of px to offset clueTip from left of invoking element 507 // added by thanhnp allow fixed position by relative tag. 508 elRelative: null, 509 local: false, // Whether to use content from the same page for the clueTip's body 510 localPrefix: null, // string to be prepended to the tip attribute if local is true 511 hideLocal: true, // If local option is set to true, this determines whether local content 512 // to be shown in clueTip should be hidden at its original location 513 attribute: 'rel', // the attribute to be used for fetching the clueTip's body content 514 titleAttribute: 'title', // the attribute to be used for fetching the clueTip's title 515 splitTitle: '', // A character used to split the title attribute into the clueTip title and divs 516 // within the clueTip body. more info below [6] 517 escapeTitle: false, // whether to html escape the title attribute 518 showTitle: true, // show title bar of the clueTip, even if title attribute not set 519 cluetipClass: 'default',// class added to outermost clueTip div in the form of 'cluetip-' + clueTipClass. 520 hoverClass: '', // class applied to the invoking element onmouseover and removed onmouseout 521 waitImage: true, // whether to show a "loading" img, which is set in jquery.cluetip.css 522 cursor: 'help', 523 arrows: true, // if true, displays arrow on appropriate side of clueTip 524 dropShadow: true, // set to false if you don't want the drop-shadow effect on the clueTip 525 dropShadowSteps: 6, // adjusts the size of the drop shadow 526 sticky: true, // keep visible until manually closed 527 mouseOutClose: false, // close when clueTip is moused out 528 activation: 'hover', // set to 'click' to force user to click to show clueTip 529 // set to 'focus' to show on focus of a form element and hide on blur 530 clickThrough: false, // if true, and activation is not 'click', then clicking on link will take user to the link's href, 531 // even if href and tipAttribute are equal 532 tracking: false, // if true, clueTip will track mouse movement (experimental) 533 delayedClose: 0, // close clueTip on a timed delay (experimental) 534 closePosition: 'top', // location of close text for sticky cluetips; can be 'top' or 'bottom' or 'title'
535 closeText: 'Close', // text (or HTML) to to be clicked to close sticky clueTips 536 truncate: 0, // number of characters to truncate clueTip's contents. if 0, no truncation occurs 537 538 // effect and speed for opening clueTips 539 fx: { 540 open: 'show', // can be 'show' or 'slideDown' or 'fadeIn' 541 openSpeed: '' 542 }, 543 544 // settings for when hoverIntent plugin is used 545 hoverIntent: { 546 sensitivity: 3, 547 interval: 50, 548 timeout: 0 549 }, 550 551 // short-circuit function to run just before clueTip is shown. 552 onActivate: function(e) {return true;}, 553 // function to run just after clueTip is shown. 554 onShow: function(ct, ci){}, 555 // function to run just after clueTip is hidden. 556 onHide: function(ct, ci){}, 557 // whether to cache results of ajax request to avoid unnecessary hits to server 558 ajaxCache: true, 559 560 // process data retrieved via xhr before it's displayed 561 ajaxProcess: function(data) { 562 data = data.replace(/<(script|style|title)[^<]+<\/(script|style|title)>/gm, '').replace(/<(link|meta)[^>]+>/g,''); 563 return data; 564 }, 565 566 // can pass in standard $.ajax() parameters. Callback functions, such as beforeSend, 567 // will be queued first within the default callbacks. 568 // The only exception is error, which overrides the default 569 ajaxSettings: { 570 // error: function(ct, ci) { /* override default error callback */ } 571 // beforeSend: function(ct, ci) { /* called first within default beforeSend callback } 572 dataType: 'html' 573 }, 574 debug: false 575 }; 576 577 578/* 579 * Global defaults for clueTips. Apply to all calls to the clueTip plugin. 580 * 581 * @example $.cluetip.setup({ 582 * insertionType: 'prependTo', 583 * insertionElement: '#container' 584 * }); 585 * 586 * @property 587 * @name $.cluetip.setup 588 * @type Map 589 * @cat Plugins/tooltip 590 * @option String insertionType: Default is 'appendTo'. Determines the method to be used for inserting the clueTip into the DOM. Permitted values are 'appendTo', 'prependTo', 'insertBefore', and 'insertAfter' 591 * @option String insertionElement: Default is 'body'. Determines which element in the DOM the plugin will reference when inserting the clueTip. 592 * 593 */ 594 595 var insertionType = 'appendTo', insertionElement = 'body'; 596 597 $.cluetip.setup = function(options) { 598 if (options && options.insertionType && (options.insertionType).match(/appendTo|prependTo|insertBefore|insertAfter/)) { 599 insertionType = options.insertionType; 600 } 601 if (options && options.insertionElement) { 602 insertionElement = options.insertionElement; 603 } 604 }; 605 606})(jQuery);
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.