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