diff options
Diffstat (limited to 'themes/default/js/plugins')
-rw-r--r-- | themes/default/js/plugins/jquery.cluetip.js | 373 | ||||
-rw-r--r-- | themes/default/js/plugins/jquery.cluetip.packed.js | 1 |
2 files changed, 192 insertions, 182 deletions
diff --git a/themes/default/js/plugins/jquery.cluetip.js b/themes/default/js/plugins/jquery.cluetip.js index 83727910c..d1e3989e7 100644 --- a/themes/default/js/plugins/jquery.cluetip.js +++ b/themes/default/js/plugins/jquery.cluetip.js @@ -1,126 +1,107 @@ /* * jQuery clueTip plugin - * Version 0.9.8 (05/22/2008) - * @requires jQuery v1.1.4+ - * @requires Dimensions plugin (for jQuery versions < 1.2.5) + * Version 1.0.7 (January 28, 2010) + * @requires jQuery v1.3+ * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * */ -;(function($) { + /* - * @name clueTip - * @type jQuery - * @cat Plugins/tooltip - * @return jQuery - * @author Karl Swedberg * - * @credit Inspired by Cody Lindley's jTip (http://www.codylindley.com) - * @credit Thanks to the following people for their many and varied contributions: - Shelane Enos, Glen Lipka, Hector Santos, Torben Schreiter, Dan G. Switzer, Jörn Zaefferer - * @credit Thanks to Jonathan Chaffer, as always, for help with the hard parts. :-) - */ - - /** - * - * Displays a highly customizable tooltip when the user hovers (default) or clicks (optional) the matched element. - * By default, the clueTip plugin loads a page indicated by the "rel" attribute via ajax and displays its contents. - * If a "title" attribute is specified, its value is used as the clueTip's heading. - * The attribute to be used for both the body and the heading of the clueTip is user-configurable. - * Optionally, the clueTip's body can display content from an element on the same page. - * * Just indicate the element's id (e.g. "#some-id") in the rel attribute. - * Optionally, the clueTip's body can display content from the title attribute, when a delimiter is indicated. - * * The string before the first instance of the delimiter is set as the clueTip's heading. - * * All subsequent strings are wrapped in separate DIVs and placed in the clueTip's body. - * The clueTip plugin allows for many, many more options. Pleasee see the examples and the option descriptions below... - * - * - * @example $('#tip).cluetip(); - * @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. + * Full list of options/settings can be found at the bottom of this file and at http://plugins.learningjquery.com/cluetip/ * + * Examples can be found at http://plugins.learningjquery.com/cluetip/demo/ * - * @example $('a.clue').cluetip({ - * hoverClass: 'highlight', - * sticky: true, - * closePosition: 'bottom', - * closeText: '<img src="cross.png" alt="close" />', - * truncate: 60, - * ajaxSettings: { - * type: 'POST' - * } - * }); - * @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." - * - * More examples can be found at http://plugins.learningjquery.com/cluetip/demo/ - * - * Full list of options/settings can be found at the bottom of this file and at http://plugins.learningjquery.com/cluetip/ - */ +*/ - var $cluetip, $cluetipInner, $cluetipOuter, $cluetipTitle, $cluetipArrows, $dropShadow, imgCount; +;(function($) { + $.cluetip = {version: '1.0.6'}; + var $cluetip, $cluetipInner, $cluetipOuter, $cluetipTitle, $cluetipArrows, $cluetipWait, $dropShadow, imgCount; + $.fn.cluetip = function(js, options) { if (typeof js == 'object') { options = js; js = null; } + if (js == 'destroy') { + return this.removeData('thisInfo').unbind('.cluetip'); + } return this.each(function(index) { - var $this = $(this); + var link = this, $this = $(this); // support metadata plugin (v1.0 and 2.0) - var opts = $.extend(false, {}, $.fn.cluetip.defaults, options || {}, $.metadata ? $this.metadata() : $.meta ? $this.data() : {}); + var opts = $.extend(true, {}, $.fn.cluetip.defaults, options || {}, $.metadata ? $this.metadata() : $.meta ? $this.data() : {}); // start out with no contents (for ajax activation) var cluetipContents = false; - var cluezIndex = parseInt(opts.cluezIndex, 10)-1; + var cluezIndex = +opts.cluezIndex; + $this.data('thisInfo', {title: link.title, zIndex: cluezIndex}); var isActive = false, closeOnDelay = 0; // create the cluetip divs if (!$('#cluetip').length) { - $cluetipInner = $('<div id="cluetip-inner"></div>'); - $cluetipTitle = $('<h3 id="cluetip-title"></h3>'); - $cluetipOuter = $('<div id="cluetip-outer"></div>').append($cluetipInner).prepend($cluetipTitle); - $cluetip = $('<div id="cluetip"></div>').css({zIndex: opts.cluezIndex}) - .append($cluetipOuter).append('<div id="cluetip-extra"></div>')[insertionType](insertionElement).hide(); - $('<div id="cluetip-waitimage"></div>').css({position: 'absolute', zIndex: cluezIndex-1}) - .insertBefore('#cluetip').hide(); - $cluetip.css({position: 'absolute', zIndex: cluezIndex}); - $cluetipOuter.css({position: 'relative', zIndex: cluezIndex+1}); - $cluetipArrows = $('<div id="cluetip-arrows" class="cluetip-arrows"></div>').css({zIndex: cluezIndex+1}).appendTo('#cluetip'); + $(['<div id="cluetip">', + '<div id="cluetip-outer">', + '<h3 id="cluetip-title"></h3>', + '<div id="cluetip-inner"></div>', + '</div>', + '<div id="cluetip-extra"></div>', + '<div id="cluetip-arrows" class="cluetip-arrows"></div>', + '</div>'].join('')) + [insertionType](insertionElement).hide(); + + $cluetip = $('#cluetip').css({position: 'absolute'}); + $cluetipOuter = $('#cluetip-outer').css({position: 'relative', zIndex: cluezIndex}); + $cluetipInner = $('#cluetip-inner'); + $cluetipTitle = $('#cluetip-title'); + $cluetipArrows = $('#cluetip-arrows'); + $cluetipWait = $('<div id="cluetip-waitimage"></div>') + .css({position: 'absolute'}).insertBefore($cluetip).hide(); } var dropShadowSteps = (opts.dropShadow) ? +opts.dropShadowSteps : 0; if (!$dropShadow) { $dropShadow = $([]); for (var i=0; i < dropShadowSteps; i++) { - $dropShadow = $dropShadow.add($('<div></div>').css({zIndex: cluezIndex-i-1, opacity:.1, top: 1+i, left: 1+i})); - }; + $dropShadow = $dropShadow.add($('<div></div>').css({zIndex: cluezIndex-1, opacity:.1, top: 1+i, left: 1+i})); + } $dropShadow.css({position: 'absolute', backgroundColor: '#000'}) .prependTo($cluetip); } var tipAttribute = $this.attr(opts.attribute), ctClass = opts.cluetipClass; - if (!tipAttribute && !opts.splitTitle && !js) return true; - // if hideLocal is set to true, on DOM ready hide the local content that will be displayed in the clueTip + if (!tipAttribute && !opts.splitTitle && !js) { + return true; + } + // if hideLocal is set to true, on DOM ready hide the local content that will be displayed in the clueTip + if (opts.local && opts.localPrefix) {tipAttribute = opts.localPrefix + tipAttribute;} if (opts.local && opts.hideLocal) { $(tipAttribute + ':first').hide(); } var tOffset = parseInt(opts.topOffset, 10), lOffset = parseInt(opts.leftOffset, 10); // vertical measurement variables - var tipHeight, wHeight; - var defHeight = isNaN(parseInt(opts.height, 10)) ? 'auto' : (/\D/g).test(opts.height) ? opts.height : opts.height + 'px'; + var tipHeight, wHeight, + defHeight = isNaN(parseInt(opts.height, 10)) ? 'auto' : (/\D/g).test(opts.height) ? opts.height : opts.height + 'px'; var sTop, linkTop, posY, tipY, mouseY, baseline; // horizontal measurement variables - var tipInnerWidth = isNaN(parseInt(opts.width, 10)) ? 275 : parseInt(opts.width, 10); - var tipWidth = tipInnerWidth + (parseInt($cluetip.css('paddingLeft'))||0) + (parseInt($cluetip.css('paddingRight'))||0) + dropShadowSteps; - var linkWidth = this.offsetWidth; - var linkLeft, posX, tipX, mouseX, winWidth; + var tipInnerWidth = parseInt(opts.width, 10) || 275, + tipWidth = tipInnerWidth + (parseInt($cluetip.css('paddingLeft'),10)||0) + (parseInt($cluetip.css('paddingRight'),10)||0) + dropShadowSteps, + linkWidth = this.offsetWidth, + linkLeft, posX, tipX, mouseX, winWidth; // parse the title var tipParts; var tipTitle = (opts.attribute != 'title') ? $this.attr(opts.titleAttribute) : ''; if (opts.splitTitle) { - if(tipTitle == undefined) {tipTitle = '';} + if (tipTitle == undefined) {tipTitle = '';} tipParts = tipTitle.split(opts.splitTitle); tipTitle = tipParts.shift(); } + if (opts.escapeTitle) { + tipTitle = tipTitle.replace(/&/g,'&').replace(/>/g,'>').replace(/</g,'<'); + } + var localContent; + function returnFalse() { return false; } /*************************************** * ACTIVATION @@ -136,7 +117,6 @@ if (tipAttribute == $this.attr('href')) { $this.css('cursor', opts.cursor); } - $this.attr('title',''); if (opts.hoverClass) { $this.addClass(opts.hoverClass); } @@ -144,7 +124,7 @@ linkLeft = $this.offset().left; mouseX = event.pageX; mouseY = event.pageY; - if ($this[0].tagName.toLowerCase() != 'area') { + if (link.tagName.toLowerCase() != 'area') { sTop = $(document).scrollTop(); winWidth = $(window).width(); } @@ -157,7 +137,7 @@ || linkLeft + linkWidth + tipWidth + lOffset > winWidth ? linkLeft - tipWidth - lOffset : linkWidth + linkLeft + lOffset; - if ($this[0].tagName.toLowerCase() == 'area' || opts.positionBy == 'mouse' || linkWidth + tipWidth > winWidth) { // position by mouse + if (link.tagName.toLowerCase() == 'area' || opts.positionBy == 'mouse' || linkWidth + tipWidth > winWidth) { // position by mouse if (mouseX + 20 + tipWidth > winWidth) { $cluetip.addClass(' cluetip-' + ctClass); posX = (mouseX - tipWidth - lOffset) >= 0 ? mouseX - tipWidth - lOffset - parseInt($cluetip.css('marginLeft'),10) + parseInt($cluetipInner.css('marginRight'),10) : mouseX - (tipWidth/2); @@ -166,7 +146,11 @@ } } var pY = posX < 0 ? event.pageY + tOffset : event.pageY; - $cluetip.css({left: (posX > 0 && opts.positionBy != 'bottomTop') ? posX : (mouseX + (tipWidth/2) > winWidth) ? winWidth/2 - tipWidth/2 : Math.max(mouseX - (tipWidth/2),0)}); + $cluetip.css({ + left: (posX > 0 && opts.positionBy != 'bottomTop') ? posX : (mouseX + (tipWidth/2) > winWidth) ? winWidth/2 - tipWidth/2 : Math.max(mouseX - (tipWidth/2),0), + zIndex: $this.data('thisInfo').zIndex + }); + $cluetipArrows.css({zIndex: $this.data('thisInfo').zIndex+1}); } wHeight = $(window).height(); @@ -174,6 +158,9 @@ * load a string from cluetip method's first argument ***************************************/ if (js) { + if (typeof js == 'function') { + js = js.call(link); + } $cluetipInner.html(js); cluetipShow(pY); } @@ -185,71 +172,93 @@ else if (tipParts) { var tpl = tipParts.length; - for (var i=0; i < tpl; i++){ - if (i == 0) { - $cluetipInner.html(tipParts[i]); - } else { + $cluetipInner.html(tpl ? tipParts[0] : ''); + if (tpl > 1) { + for (var i=1; i < tpl; i++){ $cluetipInner.append('<div class="split-body">' + tipParts[i] + '</div>'); - } - }; + } + } cluetipShow(pY); } /*************************************** * load external file via ajax ***************************************/ - else if (!opts.local && tipAttribute.indexOf('#') != 0) { - if (cluetipContents && opts.ajaxCache) { + else if (!opts.local && tipAttribute.indexOf('#') !== 0) { + if (/\.(jpe?g|tiff?|gif|png)$/i.test(tipAttribute)) { + $cluetipInner.html('<img src="' + tipAttribute + '" alt="' + tipTitle + '" />'); + cluetipShow(pY); + } else if (cluetipContents && opts.ajaxCache) { $cluetipInner.html(cluetipContents); cluetipShow(pY); - } - else { - var ajaxSettings = opts.ajaxSettings; - ajaxSettings.url = tipAttribute; - ajaxSettings.beforeSend = function() { - $cluetipOuter.children().empty(); - if (opts.waitImage) { - $('#cluetip-waitimage') - .css({top: mouseY+20, left: mouseX+20}) - .show(); - } - }; - ajaxSettings.error = function() { - if (isActive) { - $cluetipInner.html('<i>sorry, the contents could not be loaded</i>'); - } - }; - ajaxSettings.success = function(data) { - cluetipContents = opts.ajaxProcess(data); - if (isActive) { - $cluetipInner.html(cluetipContents); + } else { + var optionBeforeSend = opts.ajaxSettings.beforeSend, + optionError = opts.ajaxSettings.error, + optionSuccess = opts.ajaxSettings.success, + optionComplete = opts.ajaxSettings.complete; + var ajaxSettings = { + cache: false, // force requested page not to be cached by browser + url: tipAttribute, + beforeSend: function(xhr) { + if (optionBeforeSend) {optionBeforeSend.call(link, xhr, $cluetip, $cluetipInner);} + $cluetipOuter.children().empty(); + if (opts.waitImage) { + $cluetipWait + .css({top: mouseY+20, left: mouseX+20, zIndex: $this.data('thisInfo').zIndex-1}) + .show(); + } + }, + error: function(xhr, textStatus) { + if (isActive) { + if (optionError) { + optionError.call(link, xhr, textStatus, $cluetip, $cluetipInner); + } else { + $cluetipInner.html('<i>sorry, the contents could not be loaded</i>'); + } + } + }, + success: function(data, textStatus) { + cluetipContents = opts.ajaxProcess.call(link, data); + if (isActive) { + if (optionSuccess) {optionSuccess.call(link, data, textStatus, $cluetip, $cluetipInner);} + $cluetipInner.html(cluetipContents); + } + }, + complete: function(xhr, textStatus) { + if (optionComplete) {optionComplete.call(link, xhr, textStatus, $cluetip, $cluetipInner);} + var imgs = $cluetipInner[0].getElementsByTagName('img'); + imgCount = imgs.length; + for (var i=0, l = imgs.length; i < l; i++) { + if (imgs[i].complete) { + imgCount--; + } + } + if (imgCount && !$.browser.opera) { + $(imgs).bind('load error', function() { + imgCount--; + if (imgCount<1) { + $cluetipWait.hide(); + if (isActive) { cluetipShow(pY); } + } + }); + } else { + $cluetipWait.hide(); + if (isActive) { cluetipShow(pY); } + } } }; - ajaxSettings.complete = function() { - imgCount = $('#cluetip-inner img').length; - if (imgCount && !$.browser.opera) { - $('#cluetip-inner img').load(function() { - imgCount--; - if (imgCount<1) { - $('#cluetip-waitimage').hide(); - if (isActive) cluetipShow(pY); - } - }); - } else { - $('#cluetip-waitimage').hide(); - if (isActive) cluetipShow(pY); - } - }; - $.ajax(ajaxSettings); + var ajaxMergedSettings = $.extend(true, {}, opts.ajaxSettings, ajaxSettings); + + $.ajax(ajaxMergedSettings); } /*************************************** * load an element from the same page ***************************************/ - } else if (opts.local){ - var $localContent = $(tipAttribute + ':first'); - var localCluetip = $.fn.wrapInner ? $localContent.wrapInner('<div></div>').children().clone(true) : $localContent.html(); - $.fn.wrapInner ? $cluetipInner.empty().append(localCluetip) : $cluetipInner.html(localCluetip); + } else if (opts.local) { + + var $localContent = $(tipAttribute + (/#\S+$/.test(tipAttribute) ? '' : ':eq(' + index + ')')).clone(true).show(); + $cluetipInner.html($localContent); cluetipShow(pY); } }; @@ -257,7 +266,6 @@ // get dimensions and options for cluetip and prepare it to be shown var cluetipShow = function(bpY) { $cluetip.addClass('cluetip-' + ctClass); - if (opts.truncate) { var $truncloaded = $cluetipInner.text().slice(0,opts.truncate) + '...'; $cluetipInner.html($truncloaded); @@ -267,28 +275,21 @@ if (opts.sticky) { var $closeLink = $('<div id="cluetip-close"><a href="#">' + opts.closeText + '</a></div>'); (opts.closePosition == 'bottom') ? $closeLink.appendTo($cluetipInner) : (opts.closePosition == 'title') ? $closeLink.prependTo($cluetipTitle) : $closeLink.prependTo($cluetipInner); - $closeLink.click(function() { + $closeLink.bind('click.cluetip', function() { cluetipClose(); return false; }); if (opts.mouseOutClose) { - if ($.fn.hoverIntent && opts.hoverIntent) { - $cluetip.hoverIntent({ - over: doNothing, - timeout: opts.hoverIntent.timeout, - out: function() { $closeLink.trigger('click'); } - }); - } else { - $cluetip.hover(doNothing, - function() {$closeLink.trigger('click'); }); - } + $cluetip.bind('mouseleave.cluetip', function() { + cluetipClose(); + }); } else { - $cluetip.unbind('mouseout'); + $cluetip.unbind('mouseleave.cluetip'); } } // now that content is loaded, finish the positioning var direction = ''; - $cluetipOuter.css({overflow: defHeight == 'auto' ? 'visible' : 'auto', height: defHeight}); + $cluetipOuter.css({zIndex: $this.data('thisInfo').zIndex, overflow: defHeight == 'auto' ? 'visible' : 'auto', height: defHeight}); tipHeight = defHeight == 'auto' ? Math.max($cluetip.outerHeight(),$cluetip.height()) : parseInt(defHeight,10); tipY = posY; baseline = sTop + wHeight; @@ -304,7 +305,7 @@ } } else if ( posY + tipHeight + tOffset > baseline ) { tipY = (tipHeight >= wHeight) ? sTop : baseline - tipHeight - tOffset; - } else if ($this.css('display') == 'block' || $this[0].tagName.toLowerCase() == 'area' || opts.positionBy == "mouse") { + } else if ($this.css('display') == 'block' || link.tagName.toLowerCase() == 'area' || opts.positionBy == "mouse") { tipY = bpY - tOffset; } else { tipY = posY - opts.dropShadowSteps; @@ -322,91 +323,89 @@ // (first hide, then) ***SHOW THE CLUETIP*** $dropShadow.hide(); - $cluetip.hide()[opts.fx.open](opts.fx.open != 'show' && opts.fx.openSpeed); - if (opts.dropShadow) $dropShadow.css({height: tipHeight, width: tipInnerWidth}).show(); + $cluetip.hide()[opts.fx.open](opts.fx.openSpeed || 0); + if (opts.dropShadow) { $dropShadow.css({height: tipHeight, width: tipInnerWidth, zIndex: $this.data('thisInfo').zIndex-1}).show(); } if ($.fn.bgiframe) { $cluetip.bgiframe(); } - // trigger the optional onShow function + // delayed close (not fully tested) if (opts.delayedClose > 0) { closeOnDelay = setTimeout(cluetipClose, opts.delayedClose); } - opts.onShow($cluetip, $cluetipInner); - + // trigger the optional onShow function + opts.onShow.call(link, $cluetip, $cluetipInner); }; /*************************************** =INACTIVATION -------------------------------------- */ - var inactivate = function() { + var inactivate = function(event) { isActive = false; - $('#cluetip-waitimage').hide(); + $cluetipWait.hide(); if (!opts.sticky || (/click|toggle/).test(opts.activation) ) { cluetipClose(); -clearTimeout(closeOnDelay); - }; + clearTimeout(closeOnDelay); + } if (opts.hoverClass) { $this.removeClass(opts.hoverClass); } - $('.cluetip-clicked').removeClass('cluetip-clicked'); }; // close cluetip and reset some things var cluetipClose = function() { $cluetipOuter - .parent().hide().removeClass().end() - .children().empty(); + .parent().hide().removeClass(); + opts.onHide.call(link, $cluetip, $cluetipInner); + $this.removeClass('cluetip-clicked'); if (tipTitle) { $this.attr(opts.titleAttribute, tipTitle); } $this.css('cursor',''); - if (opts.arrows) $cluetipArrows.css({top: ''}); + if (opts.arrows) { + $cluetipArrows.css({top: ''}); + } }; + $(document).bind('hideCluetip', function(e) { + cluetipClose(); + }); /*************************************** =BIND EVENTS -------------------------------------- */ // activate by click if ( (/click|toggle/).test(opts.activation) ) { - $this.click(function(event) { + $this.bind('click.cluetip', function(event) { if ($cluetip.is(':hidden') || !$this.is('.cluetip-clicked')) { activate(event); $('.cluetip-clicked').removeClass('cluetip-clicked'); $this.addClass('cluetip-clicked'); - } else { inactivate(event); - } this.blur(); return false; }); // activate by focus; inactivate by blur } else if (opts.activation == 'focus') { - $this.focus(function(event) { + $this.bind('focus.cluetip', function(event) { activate(event); }); - $this.blur(function(event) { + $this.bind('blur.cluetip', function(event) { inactivate(event); }); // activate by hover - // clicking is returned false if cluetip url is same as href url } else { - $this.click(function() { - if ($this.attr('href') && $this.attr('href') == tipAttribute && !opts.clickThrough) { - return false; - } - }); + // clicking is returned false if clickThrough option is set to false + $this[opts.clickThrough ? 'unbind' : 'bind']('click', returnFalse); //set up mouse tracking var mouseTracks = function(evt) { if (opts.tracking == true) { var trackX = posX - evt.pageX; var trackY = tipY ? tipY - evt.pageY : posY - evt.pageY; - $this.mousemove(function(evt) { + $this.bind('mousemove.cluetip', function(evt) { $cluetip.css({left: evt.pageX + trackX, top: evt.pageY + trackY }); }); } }; if ($.fn.hoverIntent && opts.hoverIntent) { - $this.mouseover(function() {$this.attr('title',''); }) - .hoverIntent({ + $this.hoverIntent({ sensitivity: opts.hoverIntent.sensitivity, interval: opts.hoverIntent.interval, over: function(event) { @@ -414,17 +413,23 @@ clearTimeout(closeOnDelay); mouseTracks(event); }, timeout: opts.hoverIntent.timeout, - out: function(event) {inactivate(event); $this.unbind('mousemove');} + out: function(event) {inactivate(event); $this.unbind('mousemove.cluetip');} }); } else { - $this.hover(function(event) { + $this.bind('mouseenter.cluetip', function(event) { activate(event); mouseTracks(event); - }, function(event) { + }) + .bind('mouseleave.cluetip', function(event) { inactivate(event); - $this.unbind('mousemove'); + $this.unbind('mousemove.cluetip'); }); } + $this.bind('mouseover.cluetip', function(event) { + $this.attr('title',''); + }).bind('mouseleave.cluetip', function(event) { + $this.attr('title', $this.data('thisInfo').title); + }); } }); }; @@ -450,12 +455,14 @@ clearTimeout(closeOnDelay); topOffset: 15, // Number of px to offset clueTip from top of invoking element leftOffset: 15, // Number of px to offset clueTip from left of invoking element local: false, // Whether to use content from the same page for the clueTip's body + localPrefix: null, // string to be prepended to the tip attribute if local is true hideLocal: true, // If local option is set to true, this determines whether local content // to be shown in clueTip should be hidden at its original location attribute: 'rel', // the attribute to be used for fetching the clueTip's body content titleAttribute: 'title', // the attribute to be used for fetching the clueTip's title splitTitle: '', // A character used to split the title attribute into the clueTip title and divs // within the clueTip body. more info below [6] + escapeTitle: false, // whether to html escape the title attribute showTitle: true, // show title bar of the clueTip, even if title attribute not set cluetipClass: 'default',// class added to outermost clueTip div in the form of 'cluetip-' + clueTipClass. hoverClass: '', // class applied to the invoking element onmouseover and removed onmouseout @@ -475,7 +482,7 @@ clearTimeout(closeOnDelay); closePosition: 'top', // location of close text for sticky cluetips; can be 'top' or 'bottom' or 'title' closeText: 'Close', // text (or HTML) to to be clicked to close sticky clueTips truncate: 0, // number of characters to truncate clueTip's contents. if 0, no truncation occurs - + // effect and speed for opening clueTips fx: { open: 'show', // can be 'show' or 'slideDown' or 'fadeIn' @@ -489,23 +496,27 @@ clearTimeout(closeOnDelay); timeout: 0 }, - // function to run just before clueTip is shown. + // short-circuit function to run just before clueTip is shown. onActivate: function(e) {return true;}, - - // function to run just after clueTip is shown. - onShow: function(ct, c){}, - + // function to run just after clueTip is shown. + onShow: function(ct, ci){}, + // function to run just after clueTip is hidden. + onHide: function(ct, ci){}, // whether to cache results of ajax request to avoid unnecessary hits to server ajaxCache: true, // process data retrieved via xhr before it's displayed ajaxProcess: function(data) { - data = data.replace(/<s(cript|tyle)(.|\s)*?\/s(cript|tyle)>/g, '').replace(/<(link|title)(.|\s)*?\/(link|title)>/g,''); + data = data.replace(/<(script|style|title)[^<]+<\/(script|style|title)>/gm, '').replace(/<(link|meta)[^>]+>/g,''); return data; }, - // can pass in standard $.ajax() parameters, not including error, complete, success, and url - ajaxSettings: { + // can pass in standard $.ajax() parameters. Callback functions, such as beforeSend, + // will be queued first within the default callbacks. + // The only exception is error, which overrides the default + ajaxSettings: { + // error: function(ct, ci) { /* override default error callback */ } + // beforeSend: function(ct, ci) { /* called first within default beforeSend callback } dataType: 'html' }, debug: false @@ -530,7 +541,7 @@ clearTimeout(closeOnDelay); */ var insertionType = 'appendTo', insertionElement = 'body'; - $.cluetip = {}; + $.cluetip.setup = function(options) { if (options && options.insertionType && (options.insertionType).match(/appendTo|prependTo|insertBefore|insertAfter/)) { insertionType = options.insertionType; diff --git a/themes/default/js/plugins/jquery.cluetip.packed.js b/themes/default/js/plugins/jquery.cluetip.packed.js deleted file mode 100644 index 99b15f30c..000000000 --- a/themes/default/js/plugins/jquery.cluetip.packed.js +++ /dev/null @@ -1 +0,0 @@ -;(function($){var $cluetip,$cluetipInner,$cluetipOuter,$cluetipTitle,$cluetipArrows,$dropShadow,imgCount;$.fn.cluetip=function(js,options){if(typeof js=='object'){options=js;js=null}return this.each(function(index){var $this=$(this);var opts=$.extend(false,{},$.fn.cluetip.defaults,options||{},$.metadata?$this.metadata():$.meta?$this.data():{});var cluetipContents=false;var cluezIndex=parseInt(opts.cluezIndex,10)-1;var isActive=false,closeOnDelay=0;if(!$('#cluetip').length){$cluetipInner=$('<div id="cluetip-inner"></div>');$cluetipTitle=$('<h3 id="cluetip-title"></h3>');$cluetipOuter=$('<div id="cluetip-outer"></div>').append($cluetipInner).prepend($cluetipTitle);$cluetip=$('<div id="cluetip"></div>').css({zIndex:opts.cluezIndex}).append($cluetipOuter).append('<div id="cluetip-extra"></div>')[insertionType](insertionElement).hide();$('<div id="cluetip-waitimage"></div>').css({position:'absolute',zIndex:cluezIndex-1}).insertBefore('#cluetip').hide();$cluetip.css({position:'absolute',zIndex:cluezIndex});$cluetipOuter.css({position:'relative',zIndex:cluezIndex+1});$cluetipArrows=$('<div id="cluetip-arrows" class="cluetip-arrows"></div>').css({zIndex:cluezIndex+1}).appendTo('#cluetip')}var dropShadowSteps=(opts.dropShadow)?+opts.dropShadowSteps:0;if(!$dropShadow){$dropShadow=$([]);for(var i=0;i<dropShadowSteps;i++){$dropShadow=$dropShadow.add($('<div></div>').css({zIndex:cluezIndex-i-1,opacity:.1,top:1+i,left:1+i}))};$dropShadow.css({position:'absolute',backgroundColor:'#000'}).prependTo($cluetip)}var tipAttribute=$this.attr(opts.attribute),ctClass=opts.cluetipClass;if(!tipAttribute&&!opts.splitTitle&&!js)return true;if(opts.local&&opts.hideLocal){$(tipAttribute+':first').hide()}var tOffset=parseInt(opts.topOffset,10),lOffset=parseInt(opts.leftOffset,10);var tipHeight,wHeight;var defHeight=isNaN(parseInt(opts.height,10))?'auto':(/\D/g).test(opts.height)?opts.height:opts.height+'px';var sTop,linkTop,posY,tipY,mouseY,baseline;var tipInnerWidth=isNaN(parseInt(opts.width,10))?275:parseInt(opts.width,10);var tipWidth=tipInnerWidth+(parseInt($cluetip.css('paddingLeft'))||0)+(parseInt($cluetip.css('paddingRight'))||0)+dropShadowSteps;var linkWidth=this.offsetWidth;var linkLeft,posX,tipX,mouseX,winWidth;var tipParts;var tipTitle=(opts.attribute!='title')?$this.attr(opts.titleAttribute):'';if(opts.splitTitle){if(tipTitle==undefined){tipTitle=''}tipParts=tipTitle.split(opts.splitTitle);tipTitle=tipParts.shift()}var localContent;var activate=function(event){if(!opts.onActivate($this)){return false}isActive=true;$cluetip.removeClass().css({width:tipInnerWidth});if(tipAttribute==$this.attr('href')){$this.css('cursor',opts.cursor)}$this.attr('title','');if(opts.hoverClass){$this.addClass(opts.hoverClass)}linkTop=posY=$this.offset().top;linkLeft=$this.offset().left;mouseX=event.pageX;mouseY=event.pageY;if($this[0].tagName.toLowerCase()!='area'){sTop=$(document).scrollTop();winWidth=$(window).width()}if(opts.positionBy=='fixed'){posX=linkWidth+linkLeft+lOffset;$cluetip.css({left:posX})}else{posX=(linkWidth>linkLeft&&linkLeft>tipWidth)||linkLeft+linkWidth+tipWidth+lOffset>winWidth?linkLeft-tipWidth-lOffset:linkWidth+linkLeft+lOffset;if($this[0].tagName.toLowerCase()=='area'||opts.positionBy=='mouse'||linkWidth+tipWidth>winWidth){if(mouseX+20+tipWidth>winWidth){$cluetip.addClass(' cluetip-'+ctClass);posX=(mouseX-tipWidth-lOffset)>=0?mouseX-tipWidth-lOffset-parseInt($cluetip.css('marginLeft'),10)+parseInt($cluetipInner.css('marginRight'),10):mouseX-(tipWidth/2)}else{posX=mouseX+lOffset}}var pY=posX<0?event.pageY+tOffset:event.pageY;$cluetip.css({left:(posX>0&&opts.positionBy!='bottomTop')?posX:(mouseX+(tipWidth/2)>winWidth)?winWidth/2-tipWidth/2:Math.max(mouseX-(tipWidth/2),0)})}wHeight=$(window).height();if(js){$cluetipInner.html(js);cluetipShow(pY)}else if(tipParts){var tpl=tipParts.length;for(var i=0;i<tpl;i++){if(i==0){$cluetipInner.html(tipParts[i])}else{$cluetipInner.append('<div class="split-body">'+tipParts[i]+'</div>')}};cluetipShow(pY)}else if(!opts.local&&tipAttribute.indexOf('#')!=0){if(cluetipContents&&opts.ajaxCache){$cluetipInner.html(cluetipContents);cluetipShow(pY)}else{var ajaxSettings=opts.ajaxSettings;ajaxSettings.url=tipAttribute;ajaxSettings.beforeSend=function(){$cluetipOuter.children().empty();if(opts.waitImage){$('#cluetip-waitimage').css({top:mouseY+20,left:mouseX+20}).show()}};ajaxSettings.error=function(){if(isActive){$cluetipInner.html('<i>sorry, the contents could not be loaded</i>')}};ajaxSettings.success=function(data){cluetipContents=opts.ajaxProcess(data);if(isActive){$cluetipInner.html(cluetipContents)}};ajaxSettings.complete=function(){imgCount=$('#cluetip-inner img').length;if(imgCount&&!$.browser.opera){$('#cluetip-inner img').load(function(){imgCount--;if(imgCount<1){$('#cluetip-waitimage').hide();if(isActive)cluetipShow(pY)}})}else{$('#cluetip-waitimage').hide();if(isActive)cluetipShow(pY)}};$.ajax(ajaxSettings)}}else if(opts.local){var $localContent=$(tipAttribute+':first');var localCluetip=$.fn.wrapInner?$localContent.wrapInner('<div></div>').children().clone(true):$localContent.html();$.fn.wrapInner?$cluetipInner.empty().append(localCluetip):$cluetipInner.html(localCluetip);cluetipShow(pY)}};var cluetipShow=function(bpY){$cluetip.addClass('cluetip-'+ctClass);if(opts.truncate){var $truncloaded=$cluetipInner.text().slice(0,opts.truncate)+'...';$cluetipInner.html($truncloaded)}function doNothing(){};tipTitle?$cluetipTitle.show().html(tipTitle):(opts.showTitle)?$cluetipTitle.show().html(' '):$cluetipTitle.hide();if(opts.sticky){var $closeLink=$('<div id="cluetip-close"><a href="#">'+opts.closeText+'</a></div>');(opts.closePosition=='bottom')?$closeLink.appendTo($cluetipInner):(opts.closePosition=='title')?$closeLink.prependTo($cluetipTitle):$closeLink.prependTo($cluetipInner);$closeLink.click(function(){cluetipClose();return false});if(opts.mouseOutClose){if($.fn.hoverIntent&&opts.hoverIntent){$cluetip.hoverIntent({over:doNothing,timeout:opts.hoverIntent.timeout,out:function(){$closeLink.trigger('click')}})}else{$cluetip.hover(doNothing,function(){$closeLink.trigger('click')})}}else{$cluetip.unbind('mouseout')}}var direction='';$cluetipOuter.css({overflow:defHeight=='auto'?'visible':'auto',height:defHeight});tipHeight=defHeight=='auto'?Math.max($cluetip.outerHeight(),$cluetip.height()):parseInt(defHeight,10);tipY=posY;baseline=sTop+wHeight;if(opts.positionBy=='fixed'){tipY=posY-opts.dropShadowSteps+tOffset}else if((posX<mouseX&&Math.max(posX,0)+tipWidth>mouseX)||opts.positionBy=='bottomTop'){if(posY+tipHeight+tOffset>baseline&&mouseY-sTop>tipHeight+tOffset){tipY=mouseY-tipHeight-tOffset;direction='top'}else{tipY=mouseY+tOffset;direction='bottom'}}else if(posY+tipHeight+tOffset>baseline){tipY=(tipHeight>=wHeight)?sTop:baseline-tipHeight-tOffset}else if($this.css('display')=='block'||$this[0].tagName.toLowerCase()=='area'||opts.positionBy=="mouse"){tipY=bpY-tOffset}else{tipY=posY-opts.dropShadowSteps}if(direction==''){posX<linkLeft?direction='left':direction='right'}$cluetip.css({top:tipY+'px'}).removeClass().addClass('clue-'+direction+'-'+ctClass).addClass(' cluetip-'+ctClass);if(opts.arrows){var bgY=(posY-tipY-opts.dropShadowSteps);$cluetipArrows.css({top:(/(left|right)/.test(direction)&&posX>=0&&bgY>0)?bgY+'px':/(left|right)/.test(direction)?0:''}).show()}else{$cluetipArrows.hide()}$dropShadow.hide();$cluetip.hide()[opts.fx.open](opts.fx.open!='show'&&opts.fx.openSpeed);if(opts.dropShadow)$dropShadow.css({height:tipHeight,width:tipInnerWidth}).show();if($.fn.bgiframe){$cluetip.bgiframe()}if(opts.delayedClose>0){closeOnDelay=setTimeout(cluetipClose,opts.delayedClose)}opts.onShow($cluetip,$cluetipInner)};var inactivate=function(){isActive=false;$('#cluetip-waitimage').hide();if(!opts.sticky||(/click|toggle/).test(opts.activation)){cluetipClose();clearTimeout(closeOnDelay)};if(opts.hoverClass){$this.removeClass(opts.hoverClass)}$('.cluetip-clicked').removeClass('cluetip-clicked')};var cluetipClose=function(){$cluetipOuter.parent().hide().removeClass().end().children().empty();if(tipTitle){$this.attr(opts.titleAttribute,tipTitle)}$this.css('cursor','');if(opts.arrows)$cluetipArrows.css({top:''})};if((/click|toggle/).test(opts.activation)){$this.click(function(event){if($cluetip.is(':hidden')||!$this.is('.cluetip-clicked')){activate(event);$('.cluetip-clicked').removeClass('cluetip-clicked');$this.addClass('cluetip-clicked')}else{inactivate(event)}this.blur();return false})}else if(opts.activation=='focus'){$this.focus(function(event){activate(event)});$this.blur(function(event){inactivate(event)})}else{$this.click(function(){if($this.attr('href')&&$this.attr('href')==tipAttribute&&!opts.clickThrough){return false}});var mouseTracks=function(evt){if(opts.tracking==true){var trackX=posX-evt.pageX;var trackY=tipY?tipY-evt.pageY:posY-evt.pageY;$this.mousemove(function(evt){$cluetip.css({left:evt.pageX+trackX,top:evt.pageY+trackY})})}};if($.fn.hoverIntent&&opts.hoverIntent){$this.mouseover(function(){$this.attr('title','')}).hoverIntent({sensitivity:opts.hoverIntent.sensitivity,interval:opts.hoverIntent.interval,over:function(event){activate(event);mouseTracks(event)},timeout:opts.hoverIntent.timeout,out:function(event){inactivate(event);$this.unbind('mousemove')}})}else{$this.hover(function(event){activate(event);mouseTracks(event)},function(event){inactivate(event);$this.unbind('mousemove')})}}})};$.fn.cluetip.defaults={width:275,height:'auto',cluezIndex:97,positionBy:'auto',topOffset:15,leftOffset:15,local:false,hideLocal:true,attribute:'rel',titleAttribute:'title',splitTitle:'',showTitle:true,cluetipClass:'default',hoverClass:'',waitImage:true,cursor:'help',arrows:false,dropShadow:true,dropShadowSteps:6,sticky:false,mouseOutClose:false,activation:'hover',clickThrough:false,tracking:false,delayedClose:0,closePosition:'top',closeText:'Close',truncate:0,fx:{open:'show',openSpeed:''},hoverIntent:{sensitivity:3,interval:50,timeout:0},onActivate:function(e){return true},onShow:function(ct,c){},ajaxCache:true,ajaxProcess:function(data){data=data.replace(/<s(cript|tyle)(.|\s)*?\/s(cript|tyle)>/g,'').replace(/<(link|title)(.|\s)*?\/(link|title)>/g,'');return data},ajaxSettings:{dataType:'html'},debug:false};var insertionType='appendTo',insertionElement='body';$.cluetip={};$.cluetip.setup=function(options){if(options&&options.insertionType&&(options.insertionType).match(/appendTo|prependTo|insertBefore|insertAfter/)){insertionType=options.insertionType}if(options&&options.insertionElement){insertionElement=options.insertionElement}}})(jQuery);
\ No newline at end of file |