Ignore:
Timestamp:
Mar 6, 2011, 10:46:00 AM (13 years ago)
Author:
patdenice
Message:

bug:2214
Update jQuery to 1.5.1 and cluetip to 1.0.7.
Now cluetip work on IE9.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/themes/default/js/plugins/jquery.cluetip.js

    r3282 r9553  
    11/*
    22 * jQuery clueTip plugin
    3  * Version 0.9.8  (05/22/2008)
    4  * @requires jQuery v1.1.4+
    5  * @requires Dimensions plugin (for jQuery versions < 1.2.5)
     3 * Version 1.0.7  (January 28, 2010)
     4 * @requires jQuery v1.3+
    65 *
    76 * Dual licensed under the MIT and GPL licenses:
     
    109 *
    1110 */
     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
    1220;(function($) {
    13 /*
    14  * @name clueTip
    15  * @type jQuery
    16  * @cat Plugins/tooltip
    17  * @return jQuery
    18  * @author Karl Swedberg
    19  *
    20  * @credit Inspired by Cody Lindley's jTip (http://www.codylindley.com)
    21  * @credit Thanks to the following people for their many and varied contributions:
    22       Shelane Enos, Glen Lipka, Hector Santos, Torben Schreiter, Dan G. Switzer, Jörn Zaefferer
    23  * @credit Thanks to Jonathan Chaffer, as always, for help with the hard parts. :-)
    24  */
    25 
    26  /**
    27  *
    28  * Displays a highly customizable tooltip when the user hovers (default) or clicks (optional) the matched element.
    29  * By default, the clueTip plugin loads a page indicated by the "rel" attribute via ajax and displays its contents.
    30  * If a "title" attribute is specified, its value is used as the clueTip's heading.
    31  * The attribute to be used for both the body and the heading of the clueTip is user-configurable.
    32  * Optionally, the clueTip's body can display content from an element on the same page.
    33  * * Just indicate the element's id (e.g. "#some-id") in the rel attribute.
    34  * Optionally, the clueTip's body can display content from the title attribute, when a delimiter is indicated.
    35  * * The string before the first instance of the delimiter is set as the clueTip's heading.
    36  * * All subsequent strings are wrapped in separate DIVs and placed in the clueTip's body.
    37  * The clueTip plugin allows for many, many more options. Pleasee see the examples and the option descriptions below...
    38  *
    39  *
    40  * @example $('#tip).cluetip();
    41  * @desc This is the most basic clueTip. It displays a 275px-wide clueTip on mouseover of the element with an ID of "tip." On mouseout of the element, the clueTip is hidden.
    42  *
    43  *
    44  * @example $('a.clue').cluetip({
    45  *  hoverClass: 'highlight',
    46  *  sticky: true,
    47  *  closePosition: 'bottom',
    48  *  closeText: '<img src="cross.png" alt="close" />',
    49  *  truncate: 60,
    50  *  ajaxSettings: {
    51  *    type: 'POST'
    52  *  }
    53  * });
    54  * @desc Displays a clueTip on mouseover of all <a> elements with class="clue". The hovered element gets a class of "highlight" added to it (so that it can be styled appropriately. This is esp. useful for non-anchor elements.). The clueTip is "sticky," which means that it will not be hidden until the user either clicks on its "close" text/graphic or displays another clueTip. The "close" text/graphic is set to diplay at the bottom of the clueTip (default is top) and display an image rather than the default "Close" text. Moreover, the body of the clueTip is truncated to the first 60 characters, which are followed by an ellipsis (...). Finally, the clueTip retrieves the content using POST rather than the $.ajax method's default "GET."
    55  *
    56  * More examples can be found at http://plugins.learningjquery.com/cluetip/demo/
    57  *
    58  * Full list of options/settings can be found at the bottom of this file and at http://plugins.learningjquery.com/cluetip/
    59  */
    60 
    61   var $cluetip, $cluetipInner, $cluetipOuter, $cluetipTitle, $cluetipArrows, $dropShadow, imgCount;
     21  $.cluetip = {version: '1.0.6'};
     22  var $cluetip, $cluetipInner, $cluetipOuter, $cluetipTitle, $cluetipArrows, $cluetipWait, $dropShadow, imgCount;
     23 
    6224  $.fn.cluetip = function(js, options) {
    6325    if (typeof js == 'object') {
     
    6527      js = null;
    6628    }
     29    if (js == 'destroy') {
     30      return this.removeData('thisInfo').unbind('.cluetip');
     31    }
    6732    return this.each(function(index) {
    68       var $this = $(this);     
     33      var link = this, $this = $(this);
    6934     
    7035      // support metadata plugin (v1.0 and 2.0)
    71       var opts = $.extend(false, {}, $.fn.cluetip.defaults, options || {}, $.metadata ? $this.metadata() : $.meta ? $this.data() : {});
     36      var opts = $.extend(true, {}, $.fn.cluetip.defaults, options || {}, $.metadata ? $this.metadata() : $.meta ? $this.data() : {});
    7237
    7338      // start out with no contents (for ajax activation)
    7439      var cluetipContents = false;
    75       var cluezIndex = parseInt(opts.cluezIndex, 10)-1;
     40      var cluezIndex = +opts.cluezIndex;
     41      $this.data('thisInfo', {title: link.title, zIndex: cluezIndex});
    7642      var isActive = false, closeOnDelay = 0;
    7743
    7844      // create the cluetip divs
    7945      if (!$('#cluetip').length) {
    80         $cluetipInner = $('<div id="cluetip-inner"></div>');
    81         $cluetipTitle = $('<h3 id="cluetip-title"></h3>');       
    82         $cluetipOuter = $('<div id="cluetip-outer"></div>').append($cluetipInner).prepend($cluetipTitle);
    83         $cluetip = $('<div id="cluetip"></div>').css({zIndex: opts.cluezIndex})
    84         .append($cluetipOuter).append('<div id="cluetip-extra"></div>')[insertionType](insertionElement).hide();
    85         $('<div id="cluetip-waitimage"></div>').css({position: 'absolute', zIndex: cluezIndex-1})
    86         .insertBefore('#cluetip').hide();
    87         $cluetip.css({position: 'absolute', zIndex: cluezIndex});
    88         $cluetipOuter.css({position: 'relative', zIndex: cluezIndex+1});
    89         $cluetipArrows = $('<div id="cluetip-arrows" class="cluetip-arrows"></div>').css({zIndex: cluezIndex+1}).appendTo('#cluetip');
     46        $(['<div id="cluetip">',
     47          '<div id="cluetip-outer">',
     48            '<h3 id="cluetip-title"></h3>',
     49            '<div id="cluetip-inner"></div>',
     50          '</div>',
     51          '<div id="cluetip-extra"></div>',
     52          '<div id="cluetip-arrows" class="cluetip-arrows"></div>',
     53        '</div>'].join(''))
     54        [insertionType](insertionElement).hide();
     55       
     56        $cluetip = $('#cluetip').css({position: 'absolute'});
     57        $cluetipOuter = $('#cluetip-outer').css({position: 'relative', zIndex: cluezIndex});
     58        $cluetipInner = $('#cluetip-inner');
     59        $cluetipTitle = $('#cluetip-title');       
     60        $cluetipArrows = $('#cluetip-arrows');
     61        $cluetipWait = $('<div id="cluetip-waitimage"></div>')
     62          .css({position: 'absolute'}).insertBefore($cluetip).hide();
    9063      }
    9164      var dropShadowSteps = (opts.dropShadow) ? +opts.dropShadowSteps : 0;
     
    9366        $dropShadow = $([]);
    9467        for (var i=0; i < dropShadowSteps; i++) {
    95           $dropShadow = $dropShadow.add($('<div></div>').css({zIndex: cluezIndex-i-1, opacity:.1, top: 1+i, left: 1+i}));
    96         };
     68          $dropShadow = $dropShadow.add($('<div></div>').css({zIndex: cluezIndex-1, opacity:.1, top: 1+i, left: 1+i}));
     69        }
    9770        $dropShadow.css({position: 'absolute', backgroundColor: '#000'})
    9871        .prependTo($cluetip);
    9972      }
    10073      var tipAttribute = $this.attr(opts.attribute), ctClass = opts.cluetipClass;
    101       if (!tipAttribute && !opts.splitTitle && !js) return true;
    102       // if hideLocal is set to true, on DOM ready hide the local content that will be displayed in the clueTip     
     74      if (!tipAttribute && !opts.splitTitle && !js) {
     75        return true;
     76      }
     77      // if hideLocal is set to true, on DOM ready hide the local content that will be displayed in the clueTip
     78      if (opts.local && opts.localPrefix) {tipAttribute = opts.localPrefix + tipAttribute;}
    10379      if (opts.local && opts.hideLocal) { $(tipAttribute + ':first').hide(); }
    10480      var tOffset = parseInt(opts.topOffset, 10), lOffset = parseInt(opts.leftOffset, 10);
    10581      // vertical measurement variables
    106       var tipHeight, wHeight;
    107       var defHeight = isNaN(parseInt(opts.height, 10)) ? 'auto' : (/\D/g).test(opts.height) ? opts.height : opts.height + 'px';
     82      var tipHeight, wHeight,
     83          defHeight = isNaN(parseInt(opts.height, 10)) ? 'auto' : (/\D/g).test(opts.height) ? opts.height : opts.height + 'px';
    10884      var sTop, linkTop, posY, tipY, mouseY, baseline;
    10985      // horizontal measurement variables
    110       var tipInnerWidth = isNaN(parseInt(opts.width, 10)) ? 275 : parseInt(opts.width, 10);
    111       var tipWidth = tipInnerWidth + (parseInt($cluetip.css('paddingLeft'))||0) + (parseInt($cluetip.css('paddingRight'))||0) + dropShadowSteps;
    112       var linkWidth = this.offsetWidth;
    113       var linkLeft, posX, tipX, mouseX, winWidth;
     86      var tipInnerWidth = parseInt(opts.width, 10) || 275,
     87          tipWidth = tipInnerWidth + (parseInt($cluetip.css('paddingLeft'),10)||0) + (parseInt($cluetip.css('paddingRight'),10)||0) + dropShadowSteps,
     88          linkWidth = this.offsetWidth,
     89          linkLeft, posX, tipX, mouseX, winWidth;
    11490           
    11591      // parse the title
     
    11793      var tipTitle = (opts.attribute != 'title') ? $this.attr(opts.titleAttribute) : '';
    11894      if (opts.splitTitle) {
    119         if(tipTitle == undefined) {tipTitle = '';}
     95        if (tipTitle == undefined) {tipTitle = '';}
    12096        tipParts = tipTitle.split(opts.splitTitle);
    12197        tipTitle = tipParts.shift();
    12298      }
     99      if (opts.escapeTitle) {
     100        tipTitle = tipTitle.replace(/&/g,'&amp;').replace(/>/g,'&gt;').replace(/</g,'&lt;');
     101      }
     102     
    123103      var localContent;
     104      function returnFalse() { return false; }
    124105
    125106/***************************************     
     
    137118        $this.css('cursor', opts.cursor);
    138119      }
    139       $this.attr('title','');
    140120      if (opts.hoverClass) {
    141121        $this.addClass(opts.hoverClass);
     
    145125      mouseX = event.pageX;
    146126      mouseY = event.pageY;
    147       if ($this[0].tagName.toLowerCase() != 'area') {
     127      if (link.tagName.toLowerCase() != 'area') {
    148128        sTop = $(document).scrollTop();
    149129        winWidth = $(window).width();
     
    158138          ? linkLeft - tipWidth - lOffset
    159139          : linkWidth + linkLeft + lOffset;
    160         if ($this[0].tagName.toLowerCase() == 'area' || opts.positionBy == 'mouse' || linkWidth + tipWidth > winWidth) { // position by mouse
     140        if (link.tagName.toLowerCase() == 'area' || opts.positionBy == 'mouse' || linkWidth + tipWidth > winWidth) { // position by mouse
    161141          if (mouseX + 20 + tipWidth > winWidth) { 
    162142            $cluetip.addClass(' cluetip-' + ctClass);
     
    167147        }
    168148        var pY = posX < 0 ? event.pageY + tOffset : event.pageY;
    169         $cluetip.css({left: (posX > 0 && opts.positionBy != 'bottomTop') ? posX : (mouseX + (tipWidth/2) > winWidth) ? winWidth/2 - tipWidth/2 : Math.max(mouseX - (tipWidth/2),0)});
     149        $cluetip.css({
     150          left: (posX > 0 && opts.positionBy != 'bottomTop') ? posX : (mouseX + (tipWidth/2) > winWidth) ? winWidth/2 - tipWidth/2 : Math.max(mouseX - (tipWidth/2),0),
     151          zIndex: $this.data('thisInfo').zIndex
     152        });
     153        $cluetipArrows.css({zIndex: $this.data('thisInfo').zIndex+1});
    170154      }
    171155        wHeight = $(window).height();
     
    175159***************************************/
    176160      if (js) {
     161        if (typeof js == 'function') {
     162          js = js.call(link);
     163        }
    177164        $cluetipInner.html(js);
    178165        cluetipShow(pY);
     
    186173      else if (tipParts) {
    187174        var tpl = tipParts.length;
    188         for (var i=0; i < tpl; i++){
    189           if (i == 0) {
    190             $cluetipInner.html(tipParts[i]);
    191           } else {
     175        $cluetipInner.html(tpl ? tipParts[0] : '');
     176        if (tpl > 1) {
     177          for (var i=1; i < tpl; i++){
    192178            $cluetipInner.append('<div class="split-body">' + tipParts[i] + '</div>');
    193           }           
    194         };
     179          }         
     180        }
    195181        cluetipShow(pY);
    196182      }
     
    199185***************************************/
    200186
    201       else if (!opts.local && tipAttribute.indexOf('#') != 0) {
    202         if (cluetipContents && opts.ajaxCache) {
     187      else if (!opts.local && tipAttribute.indexOf('#') !== 0) {
     188        if (/\.(jpe?g|tiff?|gif|png)$/i.test(tipAttribute)) {
     189          $cluetipInner.html('<img src="' + tipAttribute + '" alt="' + tipTitle + '" />');
     190          cluetipShow(pY);
     191        } else if (cluetipContents && opts.ajaxCache) {
    203192          $cluetipInner.html(cluetipContents);
    204193          cluetipShow(pY);
    205         }
    206         else {
    207           var ajaxSettings = opts.ajaxSettings;
    208           ajaxSettings.url = tipAttribute;
    209           ajaxSettings.beforeSend = function() {
    210             $cluetipOuter.children().empty();
    211             if (opts.waitImage) {
    212               $('#cluetip-waitimage')
    213               .css({top: mouseY+20, left: mouseX+20})
    214               .show();
     194        } else {
     195          var optionBeforeSend = opts.ajaxSettings.beforeSend,
     196              optionError = opts.ajaxSettings.error,
     197              optionSuccess = opts.ajaxSettings.success,
     198              optionComplete = opts.ajaxSettings.complete;
     199          var ajaxSettings = {
     200            cache: false, // force requested page not to be cached by browser
     201            url: tipAttribute,
     202            beforeSend: function(xhr) {
     203              if (optionBeforeSend) {optionBeforeSend.call(link, xhr, $cluetip, $cluetipInner);}
     204              $cluetipOuter.children().empty();
     205              if (opts.waitImage) {
     206                $cluetipWait
     207                .css({top: mouseY+20, left: mouseX+20, zIndex: $this.data('thisInfo').zIndex-1})
     208                .show();
     209              }
     210            },
     211            error: function(xhr, textStatus) {
     212              if (isActive) {
     213                if (optionError) {
     214                  optionError.call(link, xhr, textStatus, $cluetip, $cluetipInner);
     215                } else {
     216                  $cluetipInner.html('<i>sorry, the contents could not be loaded</i>'); 
     217                }
     218              }
     219            },
     220            success: function(data, textStatus) {       
     221              cluetipContents = opts.ajaxProcess.call(link, data);
     222              if (isActive) {
     223                if (optionSuccess) {optionSuccess.call(link, data, textStatus, $cluetip, $cluetipInner);}
     224                $cluetipInner.html(cluetipContents);
     225              }
     226            },
     227            complete: function(xhr, textStatus) {
     228              if (optionComplete) {optionComplete.call(link, xhr, textStatus, $cluetip, $cluetipInner);}
     229              var imgs = $cluetipInner[0].getElementsByTagName('img');
     230              imgCount = imgs.length;
     231              for (var i=0, l = imgs.length; i < l; i++) {
     232                if (imgs[i].complete) {
     233                  imgCount--;
     234                }
     235              }
     236              if (imgCount && !$.browser.opera) {
     237                $(imgs).bind('load error', function() {
     238                  imgCount--;
     239                  if (imgCount<1) {
     240                    $cluetipWait.hide();
     241                    if (isActive) { cluetipShow(pY); }
     242                  }
     243                });
     244              } else {
     245                $cluetipWait.hide();
     246                if (isActive) { cluetipShow(pY); }
     247              }
    215248            }
    216249          };
    217          ajaxSettings.error = function() {
    218             if (isActive) {
    219               $cluetipInner.html('<i>sorry, the contents could not be loaded</i>');
    220             }
    221           };
    222           ajaxSettings.success = function(data) {
    223             cluetipContents = opts.ajaxProcess(data);
    224             if (isActive) {
    225               $cluetipInner.html(cluetipContents);
    226             }
    227           };
    228           ajaxSettings.complete = function() {
    229                 imgCount = $('#cluetip-inner img').length;
    230                         if (imgCount && !$.browser.opera) {
    231                           $('#cluetip-inner img').load(function() {
    232                                 imgCount--;
    233                                 if (imgCount<1) {
    234                                         $('#cluetip-waitimage').hide();
    235                                   if (isActive) cluetipShow(pY);
    236                                 }
    237                           });
    238                         } else {
    239                                 $('#cluetip-waitimage').hide();
    240                           if (isActive) cluetipShow(pY);   
    241                         }
    242           };
    243           $.ajax(ajaxSettings);
     250          var ajaxMergedSettings = $.extend(true, {}, opts.ajaxSettings, ajaxSettings);
     251         
     252          $.ajax(ajaxMergedSettings);
    244253        }
    245254
     
    247256* load an element from the same page
    248257***************************************/
    249       } else if (opts.local){
    250         var $localContent = $(tipAttribute + ':first');
    251         var localCluetip = $.fn.wrapInner ? $localContent.wrapInner('<div></div>').children().clone(true) : $localContent.html();
    252         $.fn.wrapInner ? $cluetipInner.empty().append(localCluetip) : $cluetipInner.html(localCluetip);
     258      } else if (opts.local) {
     259       
     260        var $localContent = $(tipAttribute + (/#\S+$/.test(tipAttribute) ? '' : ':eq(' + index + ')')).clone(true).show();
     261        $cluetipInner.html($localContent);
    253262        cluetipShow(pY);
    254263      }
     
    258267    var cluetipShow = function(bpY) {
    259268      $cluetip.addClass('cluetip-' + ctClass);
    260      
    261269      if (opts.truncate) {
    262270        var $truncloaded = $cluetipInner.text().slice(0,opts.truncate) + '...';
     
    268276        var $closeLink = $('<div id="cluetip-close"><a href="#">' + opts.closeText + '</a></div>');
    269277        (opts.closePosition == 'bottom') ? $closeLink.appendTo($cluetipInner) : (opts.closePosition == 'title') ? $closeLink.prependTo($cluetipTitle) : $closeLink.prependTo($cluetipInner);
    270         $closeLink.click(function() {
     278        $closeLink.bind('click.cluetip', function() {
    271279          cluetipClose();
    272280          return false;
    273281        });
    274282        if (opts.mouseOutClose) {
    275           if ($.fn.hoverIntent && opts.hoverIntent) {
    276             $cluetip.hoverIntent({
    277               over: doNothing,
    278               timeout: opts.hoverIntent.timeout, 
    279               out: function() { $closeLink.trigger('click'); }
    280             });
    281           } else {
    282             $cluetip.hover(doNothing,
    283             function() {$closeLink.trigger('click'); });
    284           }
     283          $cluetip.bind('mouseleave.cluetip', function() {
     284            cluetipClose();
     285          });
    285286        } else {
    286           $cluetip.unbind('mouseout');
     287          $cluetip.unbind('mouseleave.cluetip');
    287288        }
    288289      }
    289290// now that content is loaded, finish the positioning
    290291      var direction = '';
    291       $cluetipOuter.css({overflow: defHeight == 'auto' ? 'visible' : 'auto', height: defHeight});
     292      $cluetipOuter.css({zIndex: $this.data('thisInfo').zIndex, overflow: defHeight == 'auto' ? 'visible' : 'auto', height: defHeight});
    292293      tipHeight = defHeight == 'auto' ? Math.max($cluetip.outerHeight(),$cluetip.height()) : parseInt(defHeight,10);   
    293294      tipY = posY;
     
    305306      } else if ( posY + tipHeight + tOffset > baseline ) {
    306307        tipY = (tipHeight >= wHeight) ? sTop : baseline - tipHeight - tOffset;
    307       } else if ($this.css('display') == 'block' || $this[0].tagName.toLowerCase() == 'area' || opts.positionBy == "mouse") {
     308      } else if ($this.css('display') == 'block' || link.tagName.toLowerCase() == 'area' || opts.positionBy == "mouse") {
    308309        tipY = bpY - tOffset;
    309310      } else {
     
    323324// (first hide, then) ***SHOW THE CLUETIP***
    324325      $dropShadow.hide();
    325       $cluetip.hide()[opts.fx.open](opts.fx.open != 'show' && opts.fx.openSpeed);
    326       if (opts.dropShadow) $dropShadow.css({height: tipHeight, width: tipInnerWidth}).show();
     326      $cluetip.hide()[opts.fx.open](opts.fx.openSpeed || 0);
     327      if (opts.dropShadow) { $dropShadow.css({height: tipHeight, width: tipInnerWidth, zIndex: $this.data('thisInfo').zIndex-1}).show(); }
    327328      if ($.fn.bgiframe) { $cluetip.bgiframe(); }
    328       // trigger the optional onShow function
     329      // delayed close (not fully tested)
    329330      if (opts.delayedClose > 0) {
    330331        closeOnDelay = setTimeout(cluetipClose, opts.delayedClose);
    331332      }
    332       opts.onShow($cluetip, $cluetipInner);
    333      
     333      // trigger the optional onShow function
     334      opts.onShow.call(link, $cluetip, $cluetipInner);
    334335    };
    335336
     
    337338   =INACTIVATION
    338339-------------------------------------- */
    339     var inactivate = function() {
     340    var inactivate = function(event) {
    340341      isActive = false;
    341       $('#cluetip-waitimage').hide();
     342      $cluetipWait.hide();
    342343      if (!opts.sticky || (/click|toggle/).test(opts.activation) ) {
    343344        cluetipClose();
    344 clearTimeout(closeOnDelay);       
    345       };
     345        clearTimeout(closeOnDelay);       
     346      }
    346347      if (opts.hoverClass) {
    347348        $this.removeClass(opts.hoverClass);
    348349      }
    349       $('.cluetip-clicked').removeClass('cluetip-clicked');
    350350    };
    351351// close cluetip and reset some things
    352352    var cluetipClose = function() {
    353353      $cluetipOuter
    354       .parent().hide().removeClass().end()
    355       .children().empty();
     354      .parent().hide().removeClass();
     355      opts.onHide.call(link, $cluetip, $cluetipInner);
     356      $this.removeClass('cluetip-clicked');
    356357      if (tipTitle) {
    357358        $this.attr(opts.titleAttribute, tipTitle);
    358359      }
    359360      $this.css('cursor','');
    360       if (opts.arrows) $cluetipArrows.css({top: ''});
     361      if (opts.arrows) {
     362        $cluetipArrows.css({top: ''});
     363      }
    361364    };
    362365
     366    $(document).bind('hideCluetip', function(e) {
     367      cluetipClose();
     368    });
    363369/***************************************
    364370   =BIND EVENTS
     
    366372  // activate by click
    367373      if ( (/click|toggle/).test(opts.activation) ) {
    368         $this.click(function(event) {
     374        $this.bind('click.cluetip', function(event) {
    369375          if ($cluetip.is(':hidden') || !$this.is('.cluetip-clicked')) {
    370376            activate(event);
    371377            $('.cluetip-clicked').removeClass('cluetip-clicked');
    372378            $this.addClass('cluetip-clicked');
    373 
    374379          } else {
    375380            inactivate(event);
    376 
    377381          }
    378382          this.blur();
     
    381385  // activate by focus; inactivate by blur   
    382386      } else if (opts.activation == 'focus') {
    383         $this.focus(function(event) {
     387        $this.bind('focus.cluetip', function(event) {
    384388          activate(event);
    385389        });
    386         $this.blur(function(event) {
     390        $this.bind('blur.cluetip', function(event) {
    387391          inactivate(event);
    388392        });
    389393  // activate by hover
    390     // clicking is returned false if cluetip url is same as href url
    391394      } else {
    392         $this.click(function() {
    393           if ($this.attr('href') && $this.attr('href') == tipAttribute && !opts.clickThrough) {
    394             return false;
    395           }
    396         });
     395        // clicking is returned false if clickThrough option is set to false
     396        $this[opts.clickThrough ? 'unbind' : 'bind']('click', returnFalse);
    397397        //set up mouse tracking
    398398        var mouseTracks = function(evt) {
     
    400400            var trackX = posX - evt.pageX;
    401401            var trackY = tipY ? tipY - evt.pageY : posY - evt.pageY;
    402             $this.mousemove(function(evt) {
     402            $this.bind('mousemove.cluetip', function(evt) {
    403403              $cluetip.css({left: evt.pageX + trackX, top: evt.pageY + trackY });
    404404            });
     
    406406        };
    407407        if ($.fn.hoverIntent && opts.hoverIntent) {
    408           $this.mouseover(function() {$this.attr('title',''); })
    409           .hoverIntent({
     408          $this.hoverIntent({
    410409            sensitivity: opts.hoverIntent.sensitivity,
    411410            interval: opts.hoverIntent.interval, 
     
    415414            },
    416415            timeout: opts.hoverIntent.timeout, 
    417             out: function(event) {inactivate(event); $this.unbind('mousemove');}
     416            out: function(event) {inactivate(event); $this.unbind('mousemove.cluetip');}
    418417          });           
    419418        } else {
    420           $this.hover(function(event) {
     419          $this.bind('mouseenter.cluetip', function(event) {
    421420            activate(event);
    422421            mouseTracks(event);
    423           }, function(event) {
     422          })
     423          .bind('mouseleave.cluetip', function(event) {
    424424            inactivate(event);
    425             $this.unbind('mousemove');
     425            $this.unbind('mousemove.cluetip');
    426426          });
    427427        }
     428        $this.bind('mouseover.cluetip', function(event) {
     429          $this.attr('title','');
     430        }).bind('mouseleave.cluetip', function(event) {
     431          $this.attr('title', $this.data('thisInfo').title);
     432        });
    428433      }
    429434    });
     
    451456    leftOffset:       15,       // Number of px to offset clueTip from left of invoking element
    452457    local:            false,    // Whether to use content from the same page for the clueTip's body
     458    localPrefix:      null,       // string to be prepended to the tip attribute if local is true
    453459    hideLocal:        true,     // If local option is set to true, this determines whether local content
    454460                                // to be shown in clueTip should be hidden at its original location
     
    457463    splitTitle:       '',       // A character used to split the title attribute into the clueTip title and divs
    458464                                // within the clueTip body. more info below [6]
     465    escapeTitle:      false,    // whether to html escape the title attribute
    459466    showTitle:        true,     // show title bar of the clueTip, even if title attribute not set
    460467    cluetipClass:     'default',// class added to outermost clueTip div in the form of 'cluetip-' + clueTipClass.
     
    476483    closeText:        'Close',  // text (or HTML) to to be clicked to close sticky clueTips
    477484    truncate:         0,        // number of characters to truncate clueTip's contents. if 0, no truncation occurs
    478 
     485   
    479486    // effect and speed for opening clueTips
    480487    fx: {             
     
    490497    },
    491498
    492     // function to run just before clueTip is shown.         
     499    // short-circuit function to run just before clueTip is shown.
    493500    onActivate:       function(e) {return true;},
    494 
    495     // function to run just after clueTip is shown.
    496     onShow:           function(ct, c){},
    497    
     501    // function to run just after clueTip is shown.
     502    onShow:           function(ct, ci){},
     503    // function to run just after clueTip is hidden.
     504    onHide:           function(ct, ci){},
    498505    // whether to cache results of ajax request to avoid unnecessary hits to server   
    499506    ajaxCache:        true, 
     
    501508    // process data retrieved via xhr before it's displayed
    502509    ajaxProcess:      function(data) {
    503                         data = data.replace(/<s(cript|tyle)(.|\s)*?\/s(cript|tyle)>/g, '').replace(/<(link|title)(.|\s)*?\/(link|title)>/g,'');
     510                        data = data.replace(/<(script|style|title)[^<]+<\/(script|style|title)>/gm, '').replace(/<(link|meta)[^>]+>/g,'');
    504511                        return data;
    505512    },               
    506513
    507     // can pass in standard $.ajax() parameters, not including error, complete, success, and url
    508     ajaxSettings: {   
     514    // can pass in standard $.ajax() parameters. Callback functions, such as beforeSend,
     515    // will be queued first within the default callbacks.
     516    // The only exception is error, which overrides the default
     517    ajaxSettings: {
     518                      // error: function(ct, ci) { /* override default error callback */ }
     519                      // beforeSend: function(ct, ci) { /* called first within default beforeSend callback }
    509520                      dataType: 'html'
    510521    },
     
    531542   
    532543  var insertionType = 'appendTo', insertionElement = 'body';
    533   $.cluetip = {};
     544
    534545  $.cluetip.setup = function(options) {
    535546    if (options && options.insertionType && (options.insertionType).match(/appendTo|prependTo|insertBefore|insertAfter/)) {
Note: See TracChangeset for help on using the changeset viewer.