extranet/public/libs/qtip/jquery.qtip.js

2 lines
38 KiB
JavaScript
Raw Normal View History

/*! qTip2 v2.0.0 | http://craigsworks.com/projects/qtip2/ | Licensed MIT, GPL */
(function(e,t,n){(function(e){"use strict";typeof define=="function"&&define.amd?define(["jquery"],e):jQuery&&!jQuery.fn.qtip&&e(jQuery)})(function(r){function P(e){var t=function(e){return e===o||"object"!=typeof e},n=function(e){return!r.isFunction(e)&&(!e&&!e.attr||e.length<1||"object"==typeof e&&!e.jquery)};if(!e||"object"!=typeof e)return s;t(e.metadata)&&(e.metadata={type:e.metadata});if("content"in e){if(t(e.content)||e.content.jquery)e.content={text:e.content};n(e.content.text||s)&&(e.content.text=s),"title"in e.content&&(t(e.content.title)&&(e.content.title={text:e.content.title}),n(e.content.title.text||s)&&(e.content.title.text=s))}return"position"in e&&t(e.position)&&(e.position={my:e.position,at:e.position}),"show"in e&&t(e.show)&&(e.show=e.show.jquery?{target:e.show}:{event:e.show}),"hide"in e&&t(e.hide)&&(e.hide=e.hide.jquery?{target:e.hide}:{event:e.hide}),"style"in e&&t(e.style)&&(e.style={classes:e.style}),r.each(w,function(){this.sanitize&&this.sanitize(e)}),e}function H(u,a,m,g){function U(e){var t=0,n,r=a,i=e.split(".");while(r=r[i[t++]])t<i.length&&(n=r);return[n||a,i.pop()]}function z(e,t,n){var i=r.Event("tooltip"+e);return i.originalEvent=(n?r.extend({},n):o)||R.event||o,F.trigger(i,[y].concat(t||[])),!i.isDefaultPrevented()}function W(){var e=a.style.widget;F.toggleClass("ui-helper-reset "+T,e).toggleClass(k,a.style.def&&!e),q.content&&q.content.toggleClass(T+"-content",e),q.titlebar&&q.titlebar.toggleClass(T+"-header",e),q.button&&q.button.toggleClass(x+"-icon",!e)}function X(e){q.title&&(q.titlebar.remove(),q.titlebar=q.title=q.button=o,e!==s&&y.reposition())}function V(){var e=a.content.title.button,t=typeof e=="string",n=t?e:"Close tooltip";q.button&&q.button.remove(),e.jquery?q.button=e:q.button=r("<a />",{"class":"ui-state-default ui-tooltip-close "+(a.style.widget?"":x+"-icon"),title:n,"aria-label":n}).prepend(r("<span />",{"class":"ui-icon ui-icon-close",html:"&times;"})),q.button.appendTo(q.titlebar).attr("role","button").click(function(e){return F.hasClass(N)||y.hide(e),s}),y.redraw()}function J(){var e=H+"-title";q.titlebar&&X(),q.titlebar=r("<div />",{"class":x+"-titlebar "+(a.style.widget?"ui-widget-header":"")}).append(q.title=r("<div />",{id:e,"class":x+"-title","aria-atomic":i})).insertBefore(q.content).delegate(".ui-tooltip-close","mousedown keydown mouseup keyup mouseout",function(e){r(this).toggleClass("ui-state-active ui-state-focus",e.type.substr(-4)==="down")}).delegate(".ui-tooltip-close","mouseover mouseout",function(e){r(this).toggleClass("ui-state-hover",e.type==="mouseover")}),a.content.title.button?V():y.rendered&&y.redraw()}function K(e){var t=q.button,n=q.title;if(!y.rendered)return s;e?(n||J(),V()):t.remove()}function Q(e,t){var n=q.title;if(!y.rendered||!e)return s;r.isFunction(e)&&(e=e.call(u,R.event,y));if(e===s||!e&&e!=="")return X(s);e.jquery&&e.length>0?n.empty().append(e.css({display:"block"})):n.html(e),y.redraw(),t!==s&&y.rendered&&F[0].offsetWidth>0&&y.reposition(R.event)}function G(e,t){function o(e){function a(n){n&&(delete u[n.src],clearTimeout(y.timers.img[n.src]),r(n).unbind(I)),r.isEmptyObject(u)&&(y.redraw(),t!==s&&y.reposition(R.event),e())}var o,u={};if((o=i.find("img[src]:not([height]):not([width])")).length===0)return a();o.each(function(e,t){if(u[t.src]!==n)return;var i=0,s=3;(function o(){if(t.height||t.width||i>s)return a(t);i+=1,y.timers.img[t.src]=setTimeout(o,700)})(),r(t).bind("error"+I+" load"+I,function(){a(this)}),u[t.src]=t})}var i=q.content;return!y.rendered||!e?s:(r.isFunction(e)&&(e=e.call(u,R.event,y)||""),e.jquery&&e.length>0?i.empty().append(e.css({display:"block"})):i.html(e),y.rendered<0?F.queue("fx",o):(j=0,o(r.noop)),y)}function Y(){function c(e){if(F.hasClass(N))return s;clearTimeout(y.timers.show),clearTimeout(y.timers.hide);var t=function(){y.toggle(i,e)};a.show.delay>0?y.timers.show=setTimeout(t,a.show.delay):t()}function h(e){if(F.hasClass(N)||B||j)return s;var t=r(e.relatedTarget||e.target),i=t.closest(C)[0]===F[0],u=t[0]===o.show[0];clearTimeout(y.timers.show),clearTimeout(y.timers.hide);if(n.target==="mouse"&&i||a.