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

2 lines
39 KiB
JavaScript
Raw Normal View History

2012-11-19 11:15:30 +00:00
/*! qTip2 v2.0.0rc1 | 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 D(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&&!e.then)};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 P(u,a,f,l){function I(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 q(){var e=a.style.widget;H.toggleClass("ui-helper-reset "+T,e).toggleClass(k,a.style.def&&!e),j.content&&j.content.toggleClass(T+"-content",e),j.titlebar&&j.titlebar.toggleClass(T+"-header",e),j.button&&j.button.toggleClass(x+"-icon",!e)}function R(e){j.title&&(j.titlebar.remove(),j.titlebar=j.title=j.button=o,e!==s&&m.reposition())}function U(){var e=a.content.title.button,t=typeof e=="string",n=t?e:"Close tooltip";j.button&&j.button.remove(),e.jquery?j.button=e:j.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;"})),j.button.appendTo(j.titlebar||H).attr("role","button").click(function(e){return H.hasClass(N)||m.hide(e),s})}function z(){var e=y+"-title";j.titlebar&&R(),j.titlebar=r("<div />",{"class":x+"-titlebar "+(a.style.widget?"ui-widget-header":"")}).append(j.title=r("<div />",{id:e,"class":x+"-title","aria-atomic":i})).insertBefore(j.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&&U()}function W(e){var t=j.button;if(!m.rendered)return s;e?U():t.remove()}function X(e,t){var n=j.title;if(!m.rendered||!e)return s;r.isFunction(e)&&(e=e.call(u,F.event,m));if(e===s||!e&&e!=="")return R(s);e.jquery&&e.length>0?n.empty().append(e.css({display:"block"})):n.html(e),t!==s&&m.rendered&&H[0].offsetWidth>0&&m.reposition(F.event)}function V(e){e&&r.isFunction(e.done)&&e.done(function(e){J(e,null,s)})}function J(e,t,i){function f(e){function a(n){n&&(delete u[n.src],clearTimeout(m.timers.img[n.src]),r(n).unbind(B)),r.isEmptyObject(u)&&(t!==s&&m.reposition(F.event),e())}var i,u={};if((i=o.find("img[src]:not([height]):not([width])")).length===0)return a();i.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,m.timers.img[t.src]=setTimeout(o,700)})(),r(t).bind("error"+B+" load"+B,function(){a(this)}),u[t.src]=t})}var o=j.content;return!m.rendered||!e?s:(r.isFunction(e)&&(e=e.call(u,F.event,m)||""),i!==s&&V(a.content.deferred),e.jquery&&e.length>0?o.empty().append(e.css({display:"block"})):o.html(e),m.rendered<0?H.queue("fx",f):(P=0,f(r.noop)),m)}function K(){function h(e){if(H.hasClass(N))return s;clearTimeout(m.timers.show),clearTimeout(m.timers.hide);var t=function(){m.toggle(i,e)};a.show.delay>0?m.timers.show=setTimeout(t,a.show.delay):t()}function p(e){if(H.hasClass(N)||O||P)return s;var t=r(e.relatedTarget||e.target),i=t.closest(C)[0]===H[0],u=t[0]===o.show[0];clearTimeout(m.timers.show),clearTimeout(m.timers.hide);if(n.target==="mouse"&&i||a.hide.fixed&&/mouse(out|leave|move)/.test(e.type)&&(i||u)){try{e.preventDefault(),e.stopImmediatePropagation()}catch