jquery-qtip2-wrapper-rails 3.0.2 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a61a3fdb1cb95a45e3411755e4b1c0aad66e38df
4
- data.tar.gz: e2fcae0b12b1b6e3b5c9f6a4db9abc9a73eba8ba
3
+ metadata.gz: 4c350dbea40bd56811d3468c178066bec5eecab4
4
+ data.tar.gz: bb94f53f25bb1ee76b65a33bed3afac1a6647abd
5
5
  SHA512:
6
- metadata.gz: b51bd123183588268d1f09cd6cf1de156810734a35873114220516c102a99e86be03edc7dda456837cedf92a0e23f7b2cfc43df9aae2234285a26609d4fa3a45
7
- data.tar.gz: 1e86a0b3815b59e61e6ae67a71720aa14bdb8e3d4cc0baa676f9084bc10bd792c818e3dbe342b45e0f4836ccc113989e4ba9da5cbca8da6b9a19f23f469ffa75
6
+ metadata.gz: 9a90aff49c9f3556f065050df0d649fca34d437404808a83ad724aa9e2a14d76aaf31dbd2f7a18120528f7ef867f833a773f9bb89a824f6ed5cc8e32dcbba8a2
7
+ data.tar.gz: 5514865f3967fb336682d0d1a965df090eecb3775243f6e53a8f71fe166fa2bba4b614c415703676194f8625a4e006fecd085ba36c50240b5eb9283c41fc7fa6
@@ -2,7 +2,7 @@ module Jquery
2
2
  module Qtip2
3
3
  module Wrapper
4
4
  module Rails
5
- VERSION = "3.0.2"
5
+ VERSION = "3.0.3"
6
6
  end
7
7
  end
8
8
  end
@@ -1,5 +1,5 @@
1
- /* qtip2 v3.0.2 | Plugins: tips modal viewport svg imagemap ie6 | Styles: core basic css3 | qtip2.com | Licensed MIT | Tue Dec 08 2015 19:16:07 */
1
+ /* qtip2 v3.0.3 | Plugins: tips modal viewport svg imagemap ie6 | Styles: core basic css3 | qtip2.com | Licensed MIT | Wed May 11 2016 22:31:31 */
2
2
 
3
- !function(a,b,c){!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):jQuery&&!jQuery.fn.qtip&&a(jQuery)}(function(d){"use strict";function e(a,b,c,e){this.id=c,this.target=a,this.tooltip=F,this.elements={target:a},this._id=S+"-"+c,this.timers={img:{}},this.options=b,this.plugins={},this.cache={event:{},target:d(),disabled:E,attr:e,onTooltip:E,lastClass:""},this.rendered=this.destroyed=this.disabled=this.waiting=this.hiddenDuringWait=this.positioning=this.triggering=E}function f(a){return a===F||"object"!==d.type(a)}function g(a){return!(d.isFunction(a)||a&&a.attr)||a.length||"object"===d.type(a)&&(a.jquery||a.then)}function h(a){var b,c,e,h;return f(a)?E:(f(a.metadata)&&(a.metadata={type:a.metadata}),"content"in a&&(b=a.content,f(b)||b.jquery||b.done?(c=g(b)?E:b,b=a.content={text:c}):c=b.text,"ajax"in b&&(e=b.ajax,h=e&&e.once!==E,delete b.ajax,b.text=function(a,b){var f=c||d(this).attr(b.options.content.attr)||"Loading...",g=d.ajax(d.extend({},e,{context:b})).then(e.success,F,e.error).then(function(a){return a&&h&&b.set("content.text",a),a},function(a,c,d){b.destroyed||0===a.status||b.set("content.text",c+": "+d)});return h?f:(b.set("content.text",f),g)}),"title"in b&&(d.isPlainObject(b.title)&&(b.button=b.title.button,b.title=b.title.text),g(b.title||E)&&(b.title=E))),"position"in a&&f(a.position)&&(a.position={my:a.position,at:a.position}),"show"in a&&f(a.show)&&(a.show=a.show.jquery?{target:a.show}:a.show===D?{ready:D}:{event:a.show}),"hide"in a&&f(a.hide)&&(a.hide=a.hide.jquery?{target:a.hide}:{event:a.hide}),"style"in a&&f(a.style)&&(a.style={classes:a.style}),d.each(R,function(){this.sanitize&&this.sanitize(a)}),a)}function i(a,b){for(var c,d=0,e=a,f=b.split(".");e=e[f[d++]];)d<f.length&&(c=e);return[c||a,f.pop()]}function j(a,b){var c,d,e;for(c in this.checks)if(this.checks.hasOwnProperty(c))for(d in this.checks[c])this.checks[c].hasOwnProperty(d)&&(e=new RegExp(d,"i").exec(a))&&(b.push(e),("builtin"===c||this.plugins[c])&&this.checks[c][d].apply(this.plugins[c]||this,b))}function k(a){return V.concat("").join(a?"-"+a+" ":" ")}function l(a,b){return b>0?setTimeout(d.proxy(a,this),b):void a.call(this)}function m(a){this.tooltip.hasClass(aa)||(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this.timers.show=l.call(this,function(){this.toggle(D,a)},this.options.show.delay))}function n(a){if(!this.tooltip.hasClass(aa)&&!this.destroyed){var b=d(a.relatedTarget),c=b.closest(W)[0]===this.tooltip[0],e=b[0]===this.options.show.target[0];if(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this!==b[0]&&"mouse"===this.options.position.target&&c||this.options.hide.fixed&&/mouse(out|leave|move)/.test(a.type)&&(c||e))try{a.preventDefault(),a.stopImmediatePropagation()}catch(f){}else this.timers.hide=l.call(this,function(){this.toggle(E,a)},this.options.hide.delay,this)}}function o(a){!this.tooltip.hasClass(aa)&&this.options.hide.inactive&&(clearTimeout(this.timers.inactive),this.timers.inactive=l.call(this,function(){this.hide(a)},this.options.hide.inactive))}function p(a){this.rendered&&this.tooltip[0].offsetWidth>0&&this.reposition(a)}function q(a,c,e){d(b.body).delegate(a,(c.split?c:c.join("."+S+" "))+"."+S,function(){var a=y.api[d.attr(this,U)];a&&!a.disabled&&e.apply(a,arguments)})}function r(a,c,f){var g,i,j,k,l,m=d(b.body),n=a[0]===b?m:a,o=a.metadata?a.metadata(f.metadata):F,p="html5"===f.metadata.type&&o?o[f.metadata.name]:F,q=a.data(f.metadata.name||"qtipopts");try{q="string"==typeof q?d.parseJSON(q):q}catch(r){}if(k=d.extend(D,{},y.defaults,f,"object"==typeof q?h(q):F,h(p||o)),i=k.position,k.id=c,"boolean"==typeof k.content.text){if(j=a.attr(k.content.attr),k.content.attr===E||!j)return E;k.content.text=j}if(i.container.length||(i.container=m),i.target===E&&(i.target=n),k.show.target===E&&(k.show.target=n),k.show.solo===D&&(k.show.solo=i.container.closest("body")),k.hide.target===E&&(k.hide.target=n),k.position.viewport===D&&(k.position.viewport=i.container),i.container=i.container.eq(0),i.at=new A(i.at,D),i.my=new A(i.my),a.data(S))if(k.overwrite)a.qtip("destroy",!0);else if(k.overwrite===E)return E;return a.attr(T,c),k.suppress&&(l=a.attr("title"))&&a.removeAttr("title").attr(ca,l).attr("title",""),g=new e(a,k,c,!!j),a.data(S,g),g}function s(a){return a.charAt(0).toUpperCase()+a.slice(1)}function t(a,b){var d,e,f=b.charAt(0).toUpperCase()+b.slice(1),g=(b+" "+va.join(f+" ")+f).split(" "),h=0;if(ua[b])return a.css(ua[b]);for(;d=g[h++];)if((e=a.css(d))!==c)return ua[b]=d,e}function u(a,b){return Math.ceil(parseFloat(t(a,b)))}function v(a,b){this._ns="tip",this.options=b,this.offset=b.offset,this.size=[b.width,b.height],this.qtip=a,this.init(a)}function w(a,b){this.options=b,this._ns="-modal",this.qtip=a,this.init(a)}function x(a){this._ns="ie6",this.qtip=a,this.init(a)}var y,z,A,B,C,D=!0,E=!1,F=null,G="x",H="y",I="width",J="height",K="top",L="left",M="bottom",N="right",O="center",P="flipinvert",Q="shift",R={},S="qtip",T="data-hasqtip",U="data-qtip-id",V=["ui-widget","ui-tooltip"],W="."+S,X="click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" "),Y=S+"-fixed",Z=S+"-default",$=S+"-focus",_=S+"-hover",aa=S+"-disabled",ba="_replacedByqTip",ca="oldtitle",da={ie:function(){var a,c;for(a=4,c=b.createElement("div");(c.innerHTML="<!--[if gt IE "+a+"]><i></i><![endif]-->")&&c.getElementsByTagName("i")[0];a+=1);return a>4?a:NaN}(),iOS:parseFloat((""+(/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))||E};z=e.prototype,z._when=function(a){return d.when.apply(d,a)},z.render=function(a){if(this.rendered||this.destroyed)return this;var b=this,c=this.options,e=this.cache,f=this.elements,g=c.content.text,h=c.content.title,i=c.content.button,j=c.position,k=[];return d.attr(this.target[0],"aria-describedby",this._id),e.posClass=this._createPosClass((this.position={my:j.my,at:j.at}).my),this.tooltip=f.tooltip=d("<div/>",{id:this._id,"class":[S,Z,c.style.classes,e.posClass].join(" "),width:c.style.width||"",height:c.style.height||"",tracking:"mouse"===j.target&&j.adjust.mouse,role:"alert","aria-live":"polite","aria-atomic":E,"aria-describedby":this._id+"-content","aria-hidden":D}).toggleClass(aa,this.disabled).attr(U,this.id).data(S,this).appendTo(j.container).append(f.content=d("<div />",{"class":S+"-content",id:this._id+"-content","aria-atomic":D})),this.rendered=-1,this.positioning=D,h&&(this._createTitle(),d.isFunction(h)||k.push(this._updateTitle(h,E))),i&&this._createButton(),d.isFunction(g)||k.push(this._updateContent(g,E)),this.rendered=D,this._setWidget(),d.each(R,function(a){var c;"render"===this.initialize&&(c=this(b))&&(b.plugins[a]=c)}),this._unassignEvents(),this._assignEvents(),this._when(k).then(function(){b._trigger("render"),b.positioning=E,b.hiddenDuringWait||!c.show.ready&&!a||b.toggle(D,e.event,E),b.hiddenDuringWait=E}),y.api[this.id]=this,this},z.destroy=function(a){function b(){if(!this.destroyed){this.destroyed=D;var a,b=this.target,c=b.attr(ca);this.rendered&&this.tooltip.stop(1,0).find("*").remove().end().remove(),d.each(this.plugins,function(){this.destroy&&this.destroy()});for(a in this.timers)this.timers.hasOwnProperty(a)&&clearTimeout(this.timers[a]);b.removeData(S).removeAttr(U).removeAttr(T).removeAttr("aria-describedby"),this.options.suppress&&c&&b.attr("title",c).removeAttr(ca),this._unassignEvents(),this.options=this.elements=this.cache=this.timers=this.plugins=this.mouse=F,delete y.api[this.id]}}return this.destroyed?this.target:(a===D&&"hide"!==this.triggering||!this.rendered?b.call(this):(this.tooltip.one("tooltiphidden",d.proxy(b,this)),!this.triggering&&this.hide()),this.target)},B=z.checks={builtin:{"^id$":function(a,b,c,e){var f=c===D?y.nextid:c,g=S+"-"+f;f!==E&&f.length>0&&!d("#"+g).length?(this._id=g,this.rendered&&(this.tooltip[0].id=this._id,this.elements.content[0].id=this._id+"-content",this.elements.title[0].id=this._id+"-title")):a[b]=e},"^prerender":function(a,b,c){c&&!this.rendered&&this.render(this.options.show.ready)},"^content.text$":function(a,b,c){this._updateContent(c)},"^content.attr$":function(a,b,c,d){this.options.content.text===this.target.attr(d)&&this._updateContent(this.target.attr(c))},"^content.title$":function(a,b,c){return c?(c&&!this.elements.title&&this._createTitle(),void this._updateTitle(c)):this._removeTitle()},"^content.button$":function(a,b,c){this._updateButton(c)},"^content.title.(text|button)$":function(a,b,c){this.set("content."+b,c)},"^position.(my|at)$":function(a,b,c){"string"==typeof c&&(this.position[b]=a[b]=new A(c,"at"===b))},"^position.container$":function(a,b,c){this.rendered&&this.tooltip.appendTo(c)},"^show.ready$":function(a,b,c){c&&(!this.rendered&&this.render(D)||this.toggle(D))},"^style.classes$":function(a,b,c,d){this.rendered&&this.tooltip.removeClass(d).addClass(c)},"^style.(width|height)":function(a,b,c){this.rendered&&this.tooltip.css(b,c)},"^style.widget|content.title":function(){this.rendered&&this._setWidget()},"^style.def":function(a,b,c){this.rendered&&this.tooltip.toggleClass(Z,!!c)},"^events.(render|show|move|hide|focus|blur)$":function(a,b,c){this.rendered&&this.tooltip[(d.isFunction(c)?"":"un")+"bind"]("tooltip"+b,c)},"^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)":function(){if(this.rendered){var a=this.options.position;this.tooltip.attr("tracking","mouse"===a.target&&a.adjust.mouse),this._unassignEvents(),this._assignEvents()}}}},z.get=function(a){if(this.destroyed)return this;var b=i(this.options,a.toLowerCase()),c=b[0][b[1]];return c.precedance?c.string():c};var ea=/^position\.(my|at|adjust|target|container|viewport)|style|content|show\.ready/i,fa=/^prerender|show\.ready/i;z.set=function(a,b){if(this.destroyed)return this;var c,e=this.rendered,f=E,g=this.options;return"string"==typeof a?(c=a,a={},a[c]=b):a=d.extend({},a),d.each(a,function(b,c){if(e&&fa.test(b))return void delete a[b];var h,j=i(g,b.toLowerCase());h=j[0][j[1]],j[0][j[1]]=c&&c.nodeType?d(c):c,f=ea.test(b)||f,a[b]=[j[0],j[1],c,h]}),h(g),this.positioning=D,d.each(a,d.proxy(j,this)),this.positioning=E,this.rendered&&this.tooltip[0].offsetWidth>0&&f&&this.reposition("mouse"===g.position.target?F:this.cache.event),this},z._update=function(a,b){var c=this,e=this.cache;return this.rendered&&a?(d.isFunction(a)&&(a=a.call(this.elements.target,e.event,this)||""),d.isFunction(a.then)?(e.waiting=D,a.then(function(a){return e.waiting=E,c._update(a,b)},F,function(a){return c._update(a,b)})):a===E||!a&&""!==a?E:(a.jquery&&a.length>0?b.empty().append(a.css({display:"block",visibility:"visible"})):b.html(a),this._waitForContent(b).then(function(a){c.rendered&&c.tooltip[0].offsetWidth>0&&c.reposition(e.event,!a.length)}))):E},z._waitForContent=function(a){var b=this.cache;return b.waiting=D,(d.fn.imagesLoaded?a.imagesLoaded():(new d.Deferred).resolve([])).done(function(){b.waiting=E}).promise()},z._updateContent=function(a,b){this._update(a,this.elements.content,b)},z._updateTitle=function(a,b){this._update(a,this.elements.title,b)===E&&this._removeTitle(E)},z._createTitle=function(){var a=this.elements,b=this._id+"-title";a.titlebar&&this._removeTitle(),a.titlebar=d("<div />",{"class":S+"-titlebar "+(this.options.style.widget?k("header"):"")}).append(a.title=d("<div />",{id:b,"class":S+"-title","aria-atomic":D})).insertBefore(a.content).delegate(".qtip-close","mousedown keydown mouseup keyup mouseout",function(a){d(this).toggleClass("ui-state-active ui-state-focus","down"===a.type.substr(-4))}).delegate(".qtip-close","mouseover mouseout",function(a){d(this).toggleClass("ui-state-hover","mouseover"===a.type)}),this.options.content.button&&this._createButton()},z._removeTitle=function(a){var b=this.elements;b.title&&(b.titlebar.remove(),b.titlebar=b.title=b.button=F,a!==E&&this.reposition())},z._createPosClass=function(a){return S+"-pos-"+(a||this.options.position.my).abbrev()},z.reposition=function(c,e){if(!this.rendered||this.positioning||this.destroyed)return this;this.positioning=D;var f,g,h,i,j=this.cache,k=this.tooltip,l=this.options.position,m=l.target,n=l.my,o=l.at,p=l.viewport,q=l.container,r=l.adjust,s=r.method.split(" "),t=k.outerWidth(E),u=k.outerHeight(E),v=0,w=0,x=k.css("position"),y={left:0,top:0},z=k[0].offsetWidth>0,A=c&&"scroll"===c.type,B=d(a),C=q[0].ownerDocument,F=this.mouse;if(d.isArray(m)&&2===m.length)o={x:L,y:K},y={left:m[0],top:m[1]};else if("mouse"===m)o={x:L,y:K},(!r.mouse||this.options.hide.distance)&&j.origin&&j.origin.pageX?c=j.origin:!c||c&&("resize"===c.type||"scroll"===c.type)?c=j.event:F&&F.pageX&&(c=F),"static"!==x&&(y=q.offset()),C.body.offsetWidth!==(a.innerWidth||C.documentElement.clientWidth)&&(g=d(b.body).offset()),y={left:c.pageX-y.left+(g&&g.left||0),top:c.pageY-y.top+(g&&g.top||0)},r.mouse&&A&&F&&(y.left-=(F.scrollX||0)-B.scrollLeft(),y.top-=(F.scrollY||0)-B.scrollTop());else{if("event"===m?c&&c.target&&"scroll"!==c.type&&"resize"!==c.type?j.target=d(c.target):c.target||(j.target=this.elements.target):"event"!==m&&(j.target=d(m.jquery?m:this.elements.target)),m=j.target,m=d(m).eq(0),0===m.length)return this;m[0]===b||m[0]===a?(v=da.iOS?a.innerWidth:m.width(),w=da.iOS?a.innerHeight:m.height(),m[0]===a&&(y={top:(p||m).scrollTop(),left:(p||m).scrollLeft()})):R.imagemap&&m.is("area")?f=R.imagemap(this,m,o,R.viewport?s:E):R.svg&&m&&m[0].ownerSVGElement?f=R.svg(this,m,o,R.viewport?s:E):(v=m.outerWidth(E),w=m.outerHeight(E),y=m.offset()),f&&(v=f.width,w=f.height,g=f.offset,y=f.position),y=this.reposition.offset(m,y,q),(da.iOS>3.1&&da.iOS<4.1||da.iOS>=4.3&&da.iOS<4.33||!da.iOS&&"fixed"===x)&&(y.left-=B.scrollLeft(),y.top-=B.scrollTop()),(!f||f&&f.adjustable!==E)&&(y.left+=o.x===N?v:o.x===O?v/2:0,y.top+=o.y===M?w:o.y===O?w/2:0)}return y.left+=r.x+(n.x===N?-t:n.x===O?-t/2:0),y.top+=r.y+(n.y===M?-u:n.y===O?-u/2:0),R.viewport?(h=y.adjusted=R.viewport(this,y,l,v,w,t,u),g&&h.left&&(y.left+=g.left),g&&h.top&&(y.top+=g.top),h.my&&(this.position.my=h.my)):y.adjusted={left:0,top:0},j.posClass!==(i=this._createPosClass(this.position.my))&&(j.posClass=i,k.removeClass(j.posClass).addClass(i)),this._trigger("move",[y,p.elem||p],c)?(delete y.adjusted,e===E||!z||isNaN(y.left)||isNaN(y.top)||"mouse"===m||!d.isFunction(l.effect)?k.css(y):d.isFunction(l.effect)&&(l.effect.call(k,this,d.extend({},y)),k.queue(function(a){d(this).css({opacity:"",height:""}),da.ie&&this.style.removeAttribute("filter"),a()})),this.positioning=E,this):this},z.reposition.offset=function(a,c,e){function f(a,b){c.left+=b*a.scrollLeft(),c.top+=b*a.scrollTop()}if(!e[0])return c;var g,h,i,j,k=d(a[0].ownerDocument),l=!!da.ie&&"CSS1Compat"!==b.compatMode,m=e[0];do"static"!==(h=d.css(m,"position"))&&("fixed"===h?(i=m.getBoundingClientRect(),f(k,-1)):(i=d(m).position(),i.left+=parseFloat(d.css(m,"borderLeftWidth"))||0,i.top+=parseFloat(d.css(m,"borderTopWidth"))||0),c.left-=i.left+(parseFloat(d.css(m,"marginLeft"))||0),c.top-=i.top+(parseFloat(d.css(m,"marginTop"))||0),g||"hidden"===(j=d.css(m,"overflow"))||"visible"===j||(g=d(m)));while(m=m.offsetParent);return g&&(g[0]!==k[0]||l)&&f(g,1),c};var ga=(A=z.reposition.Corner=function(a,b){a=(""+a).replace(/([A-Z])/," $1").replace(/middle/gi,O).toLowerCase(),this.x=(a.match(/left|right/i)||a.match(/center/)||["inherit"])[0].toLowerCase(),this.y=(a.match(/top|bottom|center/i)||["inherit"])[0].toLowerCase(),this.forceY=!!b;var c=a.charAt(0);this.precedance="t"===c||"b"===c?H:G}).prototype;ga.invert=function(a,b){this[a]=this[a]===L?N:this[a]===N?L:b||this[a]},ga.string=function(a){var b=this.x,c=this.y,d=b!==c?"center"===b||"center"!==c&&(this.precedance===H||this.forceY)?[c,b]:[b,c]:[b];return a!==!1?d.join(" "):d},ga.abbrev=function(){var a=this.string(!1);return a[0].charAt(0)+(a[1]&&a[1].charAt(0)||"")},ga.clone=function(){return new A(this.string(),this.forceY)},z.toggle=function(a,c){var e=this.cache,f=this.options,g=this.tooltip;if(c){if(/over|enter/.test(c.type)&&e.event&&/out|leave/.test(e.event.type)&&f.show.target.add(c.target).length===f.show.target.length&&g.has(c.relatedTarget).length)return this;e.event=d.event.fix(c)}if(this.waiting&&!a&&(this.hiddenDuringWait=D),!this.rendered)return a?this.render(1):this;if(this.destroyed||this.disabled)return this;var h,i,j,k=a?"show":"hide",l=this.options[k],m=this.options.position,n=this.options.content,o=this.tooltip.css("width"),p=this.tooltip.is(":visible"),q=a||1===l.target.length,r=!c||l.target.length<2||e.target[0]===c.target;return(typeof a).search("boolean|number")&&(a=!p),h=!g.is(":animated")&&p===a&&r,i=h?F:!!this._trigger(k,[90]),this.destroyed?this:(i!==E&&a&&this.focus(c),!i||h?this:(d.attr(g[0],"aria-hidden",!a),a?(this.mouse&&(e.origin=d.event.fix(this.mouse)),d.isFunction(n.text)&&this._updateContent(n.text,E),d.isFunction(n.title)&&this._updateTitle(n.title,E),!C&&"mouse"===m.target&&m.adjust.mouse&&(d(b).bind("mousemove."+S,this._storeMouse),C=D),o||g.css("width",g.outerWidth(E)),this.reposition(c,arguments[2]),o||g.css("width",""),l.solo&&("string"==typeof l.solo?d(l.solo):d(W,l.solo)).not(g).not(l.target).qtip("hide",new d.Event("tooltipsolo"))):(clearTimeout(this.timers.show),delete e.origin,C&&!d(W+'[tracking="true"]:visible',l.solo).not(g).length&&(d(b).unbind("mousemove."+S),C=E),this.blur(c)),j=d.proxy(function(){a?(da.ie&&g[0].style.removeAttribute("filter"),g.css("overflow",""),"string"==typeof l.autofocus&&d(this.options.show.autofocus,g).focus(),this.options.show.target.trigger("qtip-"+this.id+"-inactive")):g.css({display:"",visibility:"",opacity:"",left:"",top:""}),this._trigger(a?"visible":"hidden")},this),l.effect===E||q===E?(g[k](),j()):d.isFunction(l.effect)?(g.stop(1,1),l.effect.call(g,this),g.queue("fx",function(a){j(),a()})):g.fadeTo(90,a?1:0,j),a&&l.target.trigger("qtip-"+this.id+"-inactive"),this))},z.show=function(a){return this.toggle(D,a)},z.hide=function(a){return this.toggle(E,a)},z.focus=function(a){if(!this.rendered||this.destroyed)return this;var b=d(W),c=this.tooltip,e=parseInt(c[0].style.zIndex,10),f=y.zindex+b.length;return c.hasClass($)||this._trigger("focus",[f],a)&&(e!==f&&(b.each(function(){this.style.zIndex>e&&(this.style.zIndex=this.style.zIndex-1)}),b.filter("."+$).qtip("blur",a)),c.addClass($)[0].style.zIndex=f),this},z.blur=function(a){return!this.rendered||this.destroyed?this:(this.tooltip.removeClass($),this._trigger("blur",[this.tooltip.css("zIndex")],a),this)},z.disable=function(a){return this.destroyed?this:("toggle"===a?a=!(this.rendered?this.tooltip.hasClass(aa):this.disabled):"boolean"!=typeof a&&(a=D),this.rendered&&this.tooltip.toggleClass(aa,a).attr("aria-disabled",a),this.disabled=!!a,this)},z.enable=function(){return this.disable(E)},z._createButton=function(){var a=this,b=this.elements,c=b.tooltip,e=this.options.content.button,f="string"==typeof e,g=f?e:"Close tooltip";b.button&&b.button.remove(),e.jquery?b.button=e:b.button=d("<a />",{"class":"qtip-close "+(this.options.style.widget?"":S+"-icon"),title:g,"aria-label":g}).prepend(d("<span />",{"class":"ui-icon ui-icon-close",html:"&times;"})),b.button.appendTo(b.titlebar||c).attr("role","button").click(function(b){return c.hasClass(aa)||a.hide(b),E})},z._updateButton=function(a){if(!this.rendered)return E;var b=this.elements.button;a?this._createButton():b.remove()},z._setWidget=function(){var a=this.options.style.widget,b=this.elements,c=b.tooltip,d=c.hasClass(aa);c.removeClass(aa),aa=a?"ui-state-disabled":"qtip-disabled",c.toggleClass(aa,d),c.toggleClass("ui-helper-reset "+k(),a).toggleClass(Z,this.options.style.def&&!a),b.content&&b.content.toggleClass(k("content"),a),b.titlebar&&b.titlebar.toggleClass(k("header"),a),b.button&&b.button.toggleClass(S+"-icon",!a)},z._storeMouse=function(a){return(this.mouse=d.event.fix(a)).type="mousemove",this},z._bind=function(a,b,c,e,f){if(a&&c&&b.length){var g="."+this._id+(e?"-"+e:"");return d(a).bind((b.split?b:b.join(g+" "))+g,d.proxy(c,f||this)),this}},z._unbind=function(a,b){return a&&d(a).unbind("."+this._id+(b?"-"+b:"")),this},z._trigger=function(a,b,c){var e=new d.Event("tooltip"+a);return e.originalEvent=c&&d.extend({},c)||this.cache.event||F,this.triggering=a,this.tooltip.trigger(e,[this].concat(b||[])),this.triggering=E,!e.isDefaultPrevented()},z._bindEvents=function(a,b,c,e,f,g){var h=c.filter(e).add(e.filter(c)),i=[];h.length&&(d.each(b,function(b,c){var e=d.inArray(c,a);e>-1&&i.push(a.splice(e,1)[0])}),i.length&&(this._bind(h,i,function(a){var b=this.rendered?this.tooltip[0].offsetWidth>0:!1;(b?g:f).call(this,a)}),c=c.not(h),e=e.not(h))),this._bind(c,a,f),this._bind(e,b,g)},z._assignInitialEvents=function(a){function b(a){return this.disabled||this.destroyed?E:(this.cache.event=a&&d.event.fix(a),this.cache.target=a&&d(a.target),clearTimeout(this.timers.show),void(this.timers.show=l.call(this,function(){this.render("object"==typeof a||c.show.ready)},c.prerender?0:c.show.delay)))}var c=this.options,e=c.show.target,f=c.hide.target,g=c.show.event?d.trim(""+c.show.event).split(" "):[],h=c.hide.event?d.trim(""+c.hide.event).split(" "):[];this._bind(this.elements.target,["remove","removeqtip"],function(){this.destroy(!0)},"destroy"),/mouse(over|enter)/i.test(c.show.event)&&!/mouse(out|leave)/i.test(c.hide.event)&&h.push("mouseleave"),this._bind(e,"mousemove",function(a){this._storeMouse(a),this.cache.onTarget=D}),this._bindEvents(g,h,e,f,b,function(){return this.timers?void clearTimeout(this.timers.show):E}),(c.show.ready||c.prerender)&&b.call(this,a)},z._assignEvents=function(){var c=this,e=this.options,f=e.position,g=this.tooltip,h=e.show.target,i=e.hide.target,j=f.container,k=f.viewport,l=d(b),q=d(a),r=e.show.event?d.trim(""+e.show.event).split(" "):[],s=e.hide.event?d.trim(""+e.hide.event).split(" "):[];d.each(e.events,function(a,b){c._bind(g,"toggle"===a?["tooltipshow","tooltiphide"]:["tooltip"+a],b,null,g)}),/mouse(out|leave)/i.test(e.hide.event)&&"window"===e.hide.leave&&this._bind(l,["mouseout","blur"],function(a){/select|option/.test(a.target.nodeName)||a.relatedTarget||this.hide(a)}),e.hide.fixed?i=i.add(g.addClass(Y)):/mouse(over|enter)/i.test(e.show.event)&&this._bind(i,"mouseleave",function(){clearTimeout(this.timers.show)}),(""+e.hide.event).indexOf("unfocus")>-1&&this._bind(j.closest("html"),["mousedown","touchstart"],function(a){var b=d(a.target),c=this.rendered&&!this.tooltip.hasClass(aa)&&this.tooltip[0].offsetWidth>0,e=b.parents(W).filter(this.tooltip[0]).length>0;b[0]===this.target[0]||b[0]===this.tooltip[0]||e||this.target.has(b[0]).length||!c||this.hide(a)}),"number"==typeof e.hide.inactive&&(this._bind(h,"qtip-"+this.id+"-inactive",o,"inactive"),this._bind(i.add(g),y.inactiveEvents,o)),this._bindEvents(r,s,h,i,m,n),this._bind(h.add(g),"mousemove",function(a){if("number"==typeof e.hide.distance){var b=this.cache.origin||{},c=this.options.hide.distance,d=Math.abs;(d(a.pageX-b.pageX)>=c||d(a.pageY-b.pageY)>=c)&&this.hide(a)}this._storeMouse(a)}),"mouse"===f.target&&f.adjust.mouse&&(e.hide.event&&this._bind(h,["mouseenter","mouseleave"],function(a){return this.cache?void(this.cache.onTarget="mouseenter"===a.type):E}),this._bind(l,"mousemove",function(a){this.rendered&&this.cache.onTarget&&!this.tooltip.hasClass(aa)&&this.tooltip[0].offsetWidth>0&&this.reposition(a)})),(f.adjust.resize||k.length)&&this._bind(d.event.special.resize?k:q,"resize",p),f.adjust.scroll&&this._bind(q.add(f.container),"scroll",p)},z._unassignEvents=function(){var c=this.options,e=c.show.target,f=c.hide.target,g=d.grep([this.elements.target[0],this.rendered&&this.tooltip[0],c.position.container[0],c.position.viewport[0],c.position.container.closest("html")[0],a,b],function(a){return"object"==typeof a});e&&e.toArray&&(g=g.concat(e.toArray())),f&&f.toArray&&(g=g.concat(f.toArray())),this._unbind(g)._unbind(g,"destroy")._unbind(g,"inactive")},d(function(){q(W,["mouseenter","mouseleave"],function(a){var b="mouseenter"===a.type,c=d(a.currentTarget),e=d(a.relatedTarget||a.target),f=this.options;b?(this.focus(a),c.hasClass(Y)&&!c.hasClass(aa)&&clearTimeout(this.timers.hide)):"mouse"===f.position.target&&f.position.adjust.mouse&&f.hide.event&&f.show.target&&!e.closest(f.show.target[0]).length&&this.hide(a),c.toggleClass(_,b)}),q("["+U+"]",X,o)}),y=d.fn.qtip=function(a,b,e){var f=(""+a).toLowerCase(),g=F,i=d.makeArray(arguments).slice(1),j=i[i.length-1],k=this[0]?d.data(this[0],S):F;return!arguments.length&&k||"api"===f?k:"string"==typeof a?(this.each(function(){var a=d.data(this,S);if(!a)return D;if(j&&j.timeStamp&&(a.cache.event=j),!b||"option"!==f&&"options"!==f)a[f]&&a[f].apply(a,i);else{if(e===c&&!d.isPlainObject(b))return g=a.get(b),E;a.set(b,e)}}),g!==F?g:this):"object"!=typeof a&&arguments.length?void 0:(k=h(d.extend(D,{},a)),this.each(function(a){var b,c;return c=d.isArray(k.id)?k.id[a]:k.id,c=!c||c===E||c.length<1||y.api[c]?y.nextid++:c,b=r(d(this),c,k),b===E?D:(y.api[c]=b,d.each(R,function(){"initialize"===this.initialize&&this(b)}),void b._assignInitialEvents(j))}))},d.qtip=e,y.api={},d.each({attr:function(a,b){if(this.length){var c=this[0],e="title",f=d.data(c,"qtip");if(a===e&&f&&f.options&&"object"==typeof f&&"object"==typeof f.options&&f.options.suppress)return arguments.length<2?d.attr(c,ca):(f&&f.options.content.attr===e&&f.cache.attr&&f.set("content.text",b),this.attr(ca,b))}return d.fn["attr"+ba].apply(this,arguments)},clone:function(a){var b=d.fn["clone"+ba].apply(this,arguments);return a||b.filter("["+ca+"]").attr("title",function(){return d.attr(this,ca)}).removeAttr(ca),b}},function(a,b){if(!b||d.fn[a+ba])return D;var c=d.fn[a+ba]=d.fn[a];d.fn[a]=function(){return b.apply(this,arguments)||c.apply(this,arguments)}}),d.ui||(d["cleanData"+ba]=d.cleanData,d.cleanData=function(a){for(var b,c=0;(b=d(a[c])).length;c++)if(b.attr(T))try{b.triggerHandler("removeqtip")}catch(e){}d["cleanData"+ba].apply(this,arguments)}),y.version="3.0.2",y.nextid=0,y.inactiveEvents=X,y.zindex=15e3,y.defaults={prerender:E,id:E,overwrite:D,suppress:D,content:{text:D,attr:"title",title:E,button:E},position:{my:"top left",at:"bottom right",target:E,container:E,viewport:E,adjust:{x:0,y:0,mouse:D,scroll:D,resize:D,method:"flipinvert flipinvert"},effect:function(a,b){d(this).animate(b,{duration:200,queue:E})}},show:{target:E,event:"mouseenter",effect:D,delay:90,solo:E,ready:E,autofocus:E},hide:{target:E,event:"mouseleave",effect:D,delay:0,fixed:E,inactive:E,leave:"window",distance:E},style:{classes:"",widget:E,width:E,height:E,def:D},events:{render:F,move:F,show:F,hide:F,toggle:F,visible:F,hidden:F,focus:F,blur:F}};var ha,ia,ja,ka,la,ma="margin",na="border",oa="color",pa="background-color",qa="transparent",ra=" !important",sa=!!b.createElement("canvas").getContext,ta=/rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i,ua={},va=["Webkit","O","Moz","ms"];sa?(ka=a.devicePixelRatio||1,la=function(){var a=b.createElement("canvas").getContext("2d");return a.backingStorePixelRatio||a.webkitBackingStorePixelRatio||a.mozBackingStorePixelRatio||a.msBackingStorePixelRatio||a.oBackingStorePixelRatio||1}(),ja=ka/la):ia=function(a,b,c){return"<qtipvml:"+a+' xmlns="urn:schemas-microsoft.com:vml" class="qtip-vml" '+(b||"")+' style="behavior: url(#default#VML); '+(c||"")+'" />'},d.extend(v.prototype,{init:function(a){var b,c;c=this.element=a.elements.tip=d("<div />",{"class":S+"-tip"}).prependTo(a.tooltip),sa?(b=d("<canvas />").appendTo(this.element)[0].getContext("2d"),b.lineJoin="miter",b.miterLimit=1e5,b.save()):(b=ia("shape",'coordorigin="0,0"',"position:absolute;"),this.element.html(b+b),a._bind(d("*",c).add(c),["click","mousedown"],function(a){a.stopPropagation()},this._ns)),a._bind(a.tooltip,"tooltipmove",this.reposition,this._ns,this),this.create()},_swapDimensions:function(){this.size[0]=this.options.height,this.size[1]=this.options.width},_resetDimensions:function(){this.size[0]=this.options.width,this.size[1]=this.options.height},_useTitle:function(a){var b=this.qtip.elements.titlebar;return b&&(a.y===K||a.y===O&&this.element.position().top+this.size[1]/2+this.options.offset<b.outerHeight(D))},_parseCorner:function(a){var b=this.qtip.options.position.my;return a===E||b===E?a=E:a===D?a=new A(b.string()):a.string||(a=new A(a),a.fixed=D),a},_parseWidth:function(a,b,c){var d=this.qtip.elements,e=na+s(b)+"Width";return(c?u(c,e):u(d.content,e)||u(this._useTitle(a)&&d.titlebar||d.content,e)||u(d.tooltip,e))||0},_parseRadius:function(a){var b=this.qtip.elements,c=na+s(a.y)+s(a.x)+"Radius";return da.ie<9?0:u(this._useTitle(a)&&b.titlebar||b.content,c)||u(b.tooltip,c)||0},_invalidColour:function(a,b,c){var d=a.css(b);return!d||c&&d===a.css(c)||ta.test(d)?E:d},_parseColours:function(a){var b=this.qtip.elements,c=this.element.css("cssText",""),e=na+s(a[a.precedance])+s(oa),f=this._useTitle(a)&&b.titlebar||b.content,g=this._invalidColour,h=[];return h[0]=g(c,pa)||g(f,pa)||g(b.content,pa)||g(b.tooltip,pa)||c.css(pa),h[1]=g(c,e,oa)||g(f,e,oa)||g(b.content,e,oa)||g(b.tooltip,e,oa)||b.tooltip.css(e),d("*",c).add(c).css("cssText",pa+":"+qa+ra+";"+na+":0"+ra+";"),h},_calculateSize:function(a){var b,c,d,e=a.precedance===H,f=this.options.width,g=this.options.height,h="c"===a.abbrev(),i=(e?f:g)*(h?.5:1),j=Math.pow,k=Math.round,l=Math.sqrt(j(i,2)+j(g,2)),m=[this.border/i*l,this.border/g*l];return m[2]=Math.sqrt(j(m[0],2)-j(this.border,2)),m[3]=Math.sqrt(j(m[1],2)-j(this.border,2)),b=l+m[2]+m[3]+(h?0:m[0]),c=b/l,d=[k(c*f),k(c*g)],e?d:d.reverse()},_calculateTip:function(a,b,c){c=c||1,b=b||this.size;var d=b[0]*c,e=b[1]*c,f=Math.ceil(d/2),g=Math.ceil(e/2),h={br:[0,0,d,e,d,0],bl:[0,0,d,0,0,e],tr:[0,e,d,0,d,e],tl:[0,0,0,e,d,e],tc:[0,e,f,0,d,e],bc:[0,0,d,0,f,e],rc:[0,0,d,g,0,e],lc:[d,0,d,e,0,g]};return h.lt=h.br,h.rt=h.bl,h.lb=h.tr,h.rb=h.tl,h[a.abbrev()]},_drawCoords:function(a,b){a.beginPath(),a.moveTo(b[0],b[1]),a.lineTo(b[2],b[3]),a.lineTo(b[4],b[5]),a.closePath()},create:function(){var a=this.corner=(sa||da.ie)&&this._parseCorner(this.options.corner);return this.enabled=!!this.corner&&"c"!==this.corner.abbrev(),this.enabled&&(this.qtip.cache.corner=a.clone(),this.update()),this.element.toggle(this.enabled),this.corner},update:function(b,c){if(!this.enabled)return this;var e,f,g,h,i,j,k,l,m=this.qtip.elements,n=this.element,o=n.children(),p=this.options,q=this.size,r=p.mimic,s=Math.round;b||(b=this.qtip.cache.corner||this.corner),r===E?r=b:(r=new A(r),r.precedance=b.precedance,"inherit"===r.x?r.x=b.x:"inherit"===r.y?r.y=b.y:r.x===r.y&&(r[b.precedance]=b[b.precedance])),f=r.precedance,b.precedance===G?this._swapDimensions():this._resetDimensions(),e=this.color=this._parseColours(b),e[1]!==qa?(l=this.border=this._parseWidth(b,b[b.precedance]),p.border&&1>l&&!ta.test(e[1])&&(e[0]=e[1]),this.border=l=p.border!==D?p.border:l):this.border=l=0,k=this.size=this._calculateSize(b),n.css({width:k[0],height:k[1],lineHeight:k[1]+"px"}),j=b.precedance===H?[s(r.x===L?l:r.x===N?k[0]-q[0]-l:(k[0]-q[0])/2),s(r.y===K?k[1]-q[1]:0)]:[s(r.x===L?k[0]-q[0]:0),s(r.y===K?l:r.y===M?k[1]-q[1]-l:(k[1]-q[1])/2)],sa?(g=o[0].getContext("2d"),g.restore(),g.save(),g.clearRect(0,0,6e3,6e3),h=this._calculateTip(r,q,ja),i=this._calculateTip(r,this.size,ja),o.attr(I,k[0]*ja).attr(J,k[1]*ja),o.css(I,k[0]).css(J,k[1]),this._drawCoords(g,i),g.fillStyle=e[1],g.fill(),g.translate(j[0]*ja,j[1]*ja),this._drawCoords(g,h),g.fillStyle=e[0],g.fill()):(h=this._calculateTip(r),h="m"+h[0]+","+h[1]+" l"+h[2]+","+h[3]+" "+h[4]+","+h[5]+" xe",j[2]=l&&/^(r|b)/i.test(b.string())?8===da.ie?2:1:0,o.css({coordsize:k[0]+l+" "+k[1]+l,antialias:""+(r.string().indexOf(O)>-1),left:j[0]-j[2]*Number(f===G),top:j[1]-j[2]*Number(f===H),width:k[0]+l,height:k[1]+l}).each(function(a){var b=d(this);b[b.prop?"prop":"attr"]({coordsize:k[0]+l+" "+k[1]+l,path:h,fillcolor:e[0],filled:!!a,stroked:!a}).toggle(!(!l&&!a)),!a&&b.html(ia("stroke",'weight="'+2*l+'px" color="'+e[1]+'" miterlimit="1000" joinstyle="miter"'))})),a.opera&&setTimeout(function(){m.tip.css({display:"inline-block",visibility:"visible"})},1),c!==E&&this.calculate(b,k)},calculate:function(a,b){if(!this.enabled)return E;var c,e,f=this,g=this.qtip.elements,h=this.element,i=this.options.offset,j={};
4
- return a=a||this.corner,c=a.precedance,b=b||this._calculateSize(a),e=[a.x,a.y],c===G&&e.reverse(),d.each(e,function(d,e){var h,k,l;e===O?(h=c===H?L:K,j[h]="50%",j[ma+"-"+h]=-Math.round(b[c===H?0:1]/2)+i):(h=f._parseWidth(a,e,g.tooltip),k=f._parseWidth(a,e,g.content),l=f._parseRadius(a),j[e]=Math.max(-f.border,d?k:i+(l>h?l:-h)))}),j[a[c]]-=b[c===G?0:1],h.css({margin:"",top:"",bottom:"",left:"",right:""}).css(j),j},reposition:function(a,b,d){function e(a,b,c,d,e){a===Q&&j.precedance===b&&k[d]&&j[c]!==O?j.precedance=j.precedance===G?H:G:a!==Q&&k[d]&&(j[b]=j[b]===O?k[d]>0?d:e:j[b]===d?e:d)}function f(a,b,e){j[a]===O?p[ma+"-"+b]=o[a]=g[ma+"-"+b]-k[b]:(h=g[e]!==c?[k[b],-g[b]]:[-k[b],g[b]],(o[a]=Math.max(h[0],h[1]))>h[0]&&(d[b]-=k[b],o[b]=E),p[g[e]!==c?e:b]=o[a])}if(this.enabled){var g,h,i=b.cache,j=this.corner.clone(),k=d.adjusted,l=b.options.position.adjust.method.split(" "),m=l[0],n=l[1]||l[0],o={left:E,top:E,x:0,y:0},p={};this.corner.fixed!==D&&(e(m,G,H,L,N),e(n,H,G,K,M),(j.string()!==i.corner.string()||i.cornerTop!==k.top||i.cornerLeft!==k.left)&&this.update(j,E)),g=this.calculate(j),g.right!==c&&(g.left=-g.right),g.bottom!==c&&(g.top=-g.bottom),g.user=this.offset,o.left=m===Q&&!!k.left,o.left&&f(G,L,N),o.top=n===Q&&!!k.top,o.top&&f(H,K,M),this.element.css(p).toggle(!(o.x&&o.y||j.x===O&&o.y||j.y===O&&o.x)),d.left-=g.left.charAt?g.user:m!==Q||o.top||!o.left&&!o.top?g.left+this.border:0,d.top-=g.top.charAt?g.user:n!==Q||o.left||!o.left&&!o.top?g.top+this.border:0,i.cornerLeft=k.left,i.cornerTop=k.top,i.corner=j.clone()}},destroy:function(){this.qtip._unbind(this.qtip.tooltip,this._ns),this.qtip.elements.tip&&this.qtip.elements.tip.find("*").remove().end().remove()}}),ha=R.tip=function(a){return new v(a,a.options.style.tip)},ha.initialize="render",ha.sanitize=function(a){if(a.style&&"tip"in a.style){var b=a.style.tip;"object"!=typeof b&&(b=a.style.tip={corner:b}),/string|boolean/i.test(typeof b.corner)||(b.corner=D)}},B.tip={"^position.my|style.tip.(corner|mimic|border)$":function(){this.create(),this.qtip.reposition()},"^style.tip.(height|width)$":function(a){this.size=[a.width,a.height],this.update(),this.qtip.reposition()},"^content.title|style.(classes|widget)$":function(){this.update()}},d.extend(D,y.defaults,{style:{tip:{corner:D,mimic:E,width:6,height:6,border:D,offset:0}}});var wa,xa,ya="qtip-modal",za="."+ya;xa=function(){function a(a){if(d.expr[":"].focusable)return d.expr[":"].focusable;var b,c,e,f=!isNaN(d.attr(a,"tabindex")),g=a.nodeName&&a.nodeName.toLowerCase();return"area"===g?(b=a.parentNode,c=b.name,a.href&&c&&"map"===b.nodeName.toLowerCase()?(e=d("img[usemap=#"+c+"]")[0],!!e&&e.is(":visible")):!1):/input|select|textarea|button|object/.test(g)?!a.disabled:"a"===g?a.href||f:f}function c(a){j.length<1&&a.length?a.not("body").blur():j.first().focus()}function e(a){if(h.is(":visible")){var b,e=d(a.target),g=f.tooltip,i=e.closest(W);b=i.length<1?E:parseInt(i[0].style.zIndex,10)>parseInt(g[0].style.zIndex,10),b||e.closest(W)[0]===g[0]||c(e)}}var f,g,h,i=this,j={};d.extend(i,{init:function(){return h=i.elem=d("<div />",{id:"qtip-overlay",html:"<div></div>",mousedown:function(){return E}}).hide(),d(b.body).bind("focusin"+za,e),d(b).bind("keydown"+za,function(a){f&&f.options.show.modal.escape&&27===a.keyCode&&f.hide(a)}),h.bind("click"+za,function(a){f&&f.options.show.modal.blur&&f.hide(a)}),i},update:function(b){f=b,j=b.options.show.modal.stealfocus!==E?b.tooltip.find("*").filter(function(){return a(this)}):[]},toggle:function(a,e,j){var k=a.tooltip,l=a.options.show.modal,m=l.effect,n=e?"show":"hide",o=h.is(":visible"),p=d(za).filter(":visible:not(:animated)").not(k);return i.update(a),e&&l.stealfocus!==E&&c(d(":focus")),h.toggleClass("blurs",l.blur),e&&h.appendTo(b.body),h.is(":animated")&&o===e&&g!==E||!e&&p.length?i:(h.stop(D,E),d.isFunction(m)?m.call(h,e):m===E?h[n]():h.fadeTo(parseInt(j,10)||90,e?1:0,function(){e||h.hide()}),e||h.queue(function(a){h.css({left:"",top:""}),d(za).length||h.detach(),a()}),g=e,f.destroyed&&(f=F),i)}}),i.init()},xa=new xa,d.extend(w.prototype,{init:function(a){var b=a.tooltip;return this.options.on?(a.elements.overlay=xa.elem,b.addClass(ya).css("z-index",y.modal_zindex+d(za).length),a._bind(b,["tooltipshow","tooltiphide"],function(a,c,e){var f=a.originalEvent;if(a.target===b[0])if(f&&"tooltiphide"===a.type&&/mouse(leave|enter)/.test(f.type)&&d(f.relatedTarget).closest(xa.elem[0]).length)try{a.preventDefault()}catch(g){}else(!f||f&&"tooltipsolo"!==f.type)&&this.toggle(a,"tooltipshow"===a.type,e)},this._ns,this),a._bind(b,"tooltipfocus",function(a,c){if(!a.isDefaultPrevented()&&a.target===b[0]){var e=d(za),f=y.modal_zindex+e.length,g=parseInt(b[0].style.zIndex,10);xa.elem[0].style.zIndex=f-1,e.each(function(){this.style.zIndex>g&&(this.style.zIndex-=1)}),e.filter("."+$).qtip("blur",a.originalEvent),b.addClass($)[0].style.zIndex=f,xa.update(c);try{a.preventDefault()}catch(h){}}},this._ns,this),void a._bind(b,"tooltiphide",function(a){a.target===b[0]&&d(za).filter(":visible").not(b).last().qtip("focus",a)},this._ns,this)):this},toggle:function(a,b,c){return a&&a.isDefaultPrevented()?this:void xa.toggle(this.qtip,!!b,c)},destroy:function(){this.qtip.tooltip.removeClass(ya),this.qtip._unbind(this.qtip.tooltip,this._ns),xa.toggle(this.qtip,E),delete this.qtip.elements.overlay}}),wa=R.modal=function(a){return new w(a,a.options.show.modal)},wa.sanitize=function(a){a.show&&("object"!=typeof a.show.modal?a.show.modal={on:!!a.show.modal}:"undefined"==typeof a.show.modal.on&&(a.show.modal.on=D))},y.modal_zindex=y.zindex-200,wa.initialize="render",B.modal={"^show.modal.(on|blur)$":function(){this.destroy(),this.init(),this.qtip.elems.overlay.toggle(this.qtip.tooltip[0].offsetWidth>0)}},d.extend(D,y.defaults,{show:{modal:{on:E,effect:D,blur:D,stealfocus:D,escape:D}}}),R.viewport=function(c,d,e,f,g,h,i){function j(a,b,c,e,f,g,h,i,j){var k=d[f],s=u[a],t=v[a],w=c===Q,x=s===f?j:s===g?-j:-j/2,y=t===f?i:t===g?-i:-i/2,z=q[f]+r[f]-(n?0:m[f]),A=z-k,B=k+j-(h===I?o:p)-z,C=x-(u.precedance===a||s===u[b]?y:0)-(t===O?i/2:0);return w?(C=(s===f?1:-1)*x,d[f]+=A>0?A:B>0?-B:0,d[f]=Math.max(-m[f]+r[f],k-C,Math.min(Math.max(-m[f]+r[f]+(h===I?o:p),k+C),d[f],"center"===s?k-x:1e9))):(e*=c===P?2:0,A>0&&(s!==f||B>0)?(d[f]-=C+e,l.invert(a,f)):B>0&&(s!==g||A>0)&&(d[f]-=(s===O?-C:C)+e,l.invert(a,g)),d[f]<q[f]&&-d[f]>B&&(d[f]=k,l=u.clone())),d[f]-k}var k,l,m,n,o,p,q,r,s=e.target,t=c.elements.tooltip,u=e.my,v=e.at,w=e.adjust,x=w.method.split(" "),y=x[0],z=x[1]||x[0],A=e.viewport,B=e.container,C={left:0,top:0};return A.jquery&&s[0]!==a&&s[0]!==b.body&&"none"!==w.method?(m=B.offset()||C,n="static"===B.css("position"),k="fixed"===t.css("position"),o=A[0]===a?A.width():A.outerWidth(E),p=A[0]===a?A.height():A.outerHeight(E),q={left:k?0:A.scrollLeft(),top:k?0:A.scrollTop()},r=A.offset()||C,("shift"!==y||"shift"!==z)&&(l=u.clone()),C={left:"none"!==y?j(G,H,y,w.x,L,N,I,f,h):0,top:"none"!==z?j(H,G,z,w.y,K,M,J,g,i):0,my:l}):C},R.polys={polygon:function(a,b){var c,d,e,f={width:0,height:0,position:{top:1e10,right:0,bottom:0,left:1e10},adjustable:E},g=0,h=[],i=1,j=1,k=0,l=0;for(g=a.length;g--;)c=[parseInt(a[--g],10),parseInt(a[g+1],10)],c[0]>f.position.right&&(f.position.right=c[0]),c[0]<f.position.left&&(f.position.left=c[0]),c[1]>f.position.bottom&&(f.position.bottom=c[1]),c[1]<f.position.top&&(f.position.top=c[1]),h.push(c);if(d=f.width=Math.abs(f.position.right-f.position.left),e=f.height=Math.abs(f.position.bottom-f.position.top),"c"===b.abbrev())f.position={left:f.position.left+f.width/2,top:f.position.top+f.height/2};else{for(;d>0&&e>0&&i>0&&j>0;)for(d=Math.floor(d/2),e=Math.floor(e/2),b.x===L?i=d:b.x===N?i=f.width-d:i+=Math.floor(d/2),b.y===K?j=e:b.y===M?j=f.height-e:j+=Math.floor(e/2),g=h.length;g--&&!(h.length<2);)k=h[g][0]-f.position.left,l=h[g][1]-f.position.top,(b.x===L&&k>=i||b.x===N&&i>=k||b.x===O&&(i>k||k>f.width-i)||b.y===K&&l>=j||b.y===M&&j>=l||b.y===O&&(j>l||l>f.height-j))&&h.splice(g,1);f.position={left:h[0][0],top:h[0][1]}}return f},rect:function(a,b,c,d){return{width:Math.abs(c-a),height:Math.abs(d-b),position:{left:Math.min(a,c),top:Math.min(b,d)}}},_angles:{tc:1.5,tr:7/4,tl:5/4,bc:.5,br:.25,bl:.75,rc:2,lc:1,c:0},ellipse:function(a,b,c,d,e){var f=R.polys._angles[e.abbrev()],g=0===f?0:c*Math.cos(f*Math.PI),h=d*Math.sin(f*Math.PI);return{width:2*c-Math.abs(g),height:2*d-Math.abs(h),position:{left:a+g,top:b+h},adjustable:E}},circle:function(a,b,c,d){return R.polys.ellipse(a,b,c,c,d)}},R.svg=function(a,c,e){for(var f,g,h,i,j,k,l,m,n,o=c[0],p=d(o.ownerSVGElement),q=o.ownerDocument,r=(parseInt(c.css("stroke-width"),10)||0)/2;!o.getBBox;)o=o.parentNode;if(!o.getBBox||!o.parentNode)return E;switch(o.nodeName){case"ellipse":case"circle":m=R.polys.ellipse(o.cx.baseVal.value,o.cy.baseVal.value,(o.rx||o.r).baseVal.value+r,(o.ry||o.r).baseVal.value+r,e);break;case"line":case"polygon":case"polyline":for(l=o.points||[{x:o.x1.baseVal.value,y:o.y1.baseVal.value},{x:o.x2.baseVal.value,y:o.y2.baseVal.value}],m=[],k=-1,i=l.numberOfItems||l.length;++k<i;)j=l.getItem?l.getItem(k):l[k],m.push.apply(m,[j.x,j.y]);m=R.polys.polygon(m,e);break;default:m=o.getBBox(),m={width:m.width,height:m.height,position:{left:m.x,top:m.y}}}return n=m.position,p=p[0],p.createSVGPoint&&(g=o.getScreenCTM(),l=p.createSVGPoint(),l.x=n.left,l.y=n.top,h=l.matrixTransform(g),n.left=h.x,n.top=h.y),q!==b&&"mouse"!==a.position.target&&(f=d((q.defaultView||q.parentWindow).frameElement).offset(),f&&(n.left+=f.left,n.top+=f.top)),q=d(q),n.left+=q.scrollLeft(),n.top+=q.scrollTop(),m},R.imagemap=function(a,b,c){b.jquery||(b=d(b));var e,f,g,h,i,j=(b.attr("shape")||"rect").toLowerCase().replace("poly","polygon"),k=d('img[usemap="#'+b.parent("map").attr("name")+'"]'),l=d.trim(b.attr("coords")),m=l.replace(/,$/,"").split(",");if(!k.length)return E;if("polygon"===j)h=R.polys.polygon(m,c);else{if(!R.polys[j])return E;for(g=-1,i=m.length,f=[];++g<i;)f.push(parseInt(m[g],10));h=R.polys[j].apply(this,f.concat(c))}return e=k.offset(),e.left+=Math.ceil((k.outerWidth(E)-k.width())/2),e.top+=Math.ceil((k.outerHeight(E)-k.height())/2),h.position.left+=e.left,h.position.top+=e.top,h};var Aa,Ba='<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:\'\';" style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=0); -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";"></iframe>';d.extend(x.prototype,{_scroll:function(){var b=this.qtip.elements.overlay;b&&(b[0].style.top=d(a).scrollTop()+"px")},init:function(c){var e=c.tooltip;d("select, object").length<1&&(this.bgiframe=c.elements.bgiframe=d(Ba).appendTo(e),c._bind(e,"tooltipmove",this.adjustBGIFrame,this._ns,this)),this.redrawContainer=d("<div/>",{id:S+"-rcontainer"}).appendTo(b.body),c.elements.overlay&&c.elements.overlay.addClass("qtipmodal-ie6fix")&&(c._bind(a,["scroll","resize"],this._scroll,this._ns,this),c._bind(e,["tooltipshow"],this._scroll,this._ns,this)),this.redraw()},adjustBGIFrame:function(){var a,b,c=this.qtip.tooltip,d={height:c.outerHeight(E),width:c.outerWidth(E)},e=this.qtip.plugins.tip,f=this.qtip.elements.tip;b=parseInt(c.css("borderLeftWidth"),10)||0,b={left:-b,top:-b},e&&f&&(a="x"===e.corner.precedance?[I,L]:[J,K],b[a[1]]-=f[a[0]]()),this.bgiframe.css(b).css(d)},redraw:function(){if(this.qtip.rendered<1||this.drawing)return this;var a,b,c,d,e=this.qtip.tooltip,f=this.qtip.options.style,g=this.qtip.options.position.container;return this.qtip.drawing=1,f.height&&e.css(J,f.height),f.width?e.css(I,f.width):(e.css(I,"").appendTo(this.redrawContainer),b=e.width(),1>b%2&&(b+=1),c=e.css("maxWidth")||"",d=e.css("minWidth")||"",a=(c+d).indexOf("%")>-1?g.width()/100:0,c=(c.indexOf("%")>-1?a:1*parseInt(c,10))||b,d=(d.indexOf("%")>-1?a:1*parseInt(d,10))||0,b=c+d?Math.min(Math.max(b,d),c):b,e.css(I,Math.round(b)).appendTo(g)),this.drawing=0,this},destroy:function(){this.bgiframe&&this.bgiframe.remove(),this.qtip._unbind([a,this.qtip.tooltip],this._ns)}}),Aa=R.ie6=function(a){return 6===da.ie?new x(a):E},Aa.initialize="render",B.ie6={"^content|style$":function(){this.redraw()}}})}(window,document);
3
+ !function(a,b,c){!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):jQuery&&!jQuery.fn.qtip&&a(jQuery)}(function(d){"use strict";function e(a,b,c,e){this.id=c,this.target=a,this.tooltip=F,this.elements={target:a},this._id=S+"-"+c,this.timers={img:{}},this.options=b,this.plugins={},this.cache={event:{},target:d(),disabled:E,attr:e,onTooltip:E,lastClass:""},this.rendered=this.destroyed=this.disabled=this.waiting=this.hiddenDuringWait=this.positioning=this.triggering=E}function f(a){return a===F||"object"!==d.type(a)}function g(a){return!(d.isFunction(a)||a&&a.attr||a.length||"object"===d.type(a)&&(a.jquery||a.then))}function h(a){var b,c,e,h;return f(a)?E:(f(a.metadata)&&(a.metadata={type:a.metadata}),"content"in a&&(b=a.content,f(b)||b.jquery||b.done?(c=g(b)?E:b,b=a.content={text:c}):c=b.text,"ajax"in b&&(e=b.ajax,h=e&&e.once!==E,delete b.ajax,b.text=function(a,b){var f=c||d(this).attr(b.options.content.attr)||"Loading...",g=d.ajax(d.extend({},e,{context:b})).then(e.success,F,e.error).then(function(a){return a&&h&&b.set("content.text",a),a},function(a,c,d){b.destroyed||0===a.status||b.set("content.text",c+": "+d)});return h?f:(b.set("content.text",f),g)}),"title"in b&&(d.isPlainObject(b.title)&&(b.button=b.title.button,b.title=b.title.text),g(b.title||E)&&(b.title=E))),"position"in a&&f(a.position)&&(a.position={my:a.position,at:a.position}),"show"in a&&f(a.show)&&(a.show=a.show.jquery?{target:a.show}:a.show===D?{ready:D}:{event:a.show}),"hide"in a&&f(a.hide)&&(a.hide=a.hide.jquery?{target:a.hide}:{event:a.hide}),"style"in a&&f(a.style)&&(a.style={classes:a.style}),d.each(R,function(){this.sanitize&&this.sanitize(a)}),a)}function i(a,b){for(var c,d=0,e=a,f=b.split(".");e=e[f[d++]];)d<f.length&&(c=e);return[c||a,f.pop()]}function j(a,b){var c,d,e;for(c in this.checks)if(this.checks.hasOwnProperty(c))for(d in this.checks[c])this.checks[c].hasOwnProperty(d)&&(e=new RegExp(d,"i").exec(a))&&(b.push(e),("builtin"===c||this.plugins[c])&&this.checks[c][d].apply(this.plugins[c]||this,b))}function k(a){return V.concat("").join(a?"-"+a+" ":" ")}function l(a,b){return b>0?setTimeout(d.proxy(a,this),b):void a.call(this)}function m(a){this.tooltip.hasClass(aa)||(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this.timers.show=l.call(this,function(){this.toggle(D,a)},this.options.show.delay))}function n(a){if(!this.tooltip.hasClass(aa)&&!this.destroyed){var b=d(a.relatedTarget),c=b.closest(W)[0]===this.tooltip[0],e=b[0]===this.options.show.target[0];if(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this!==b[0]&&"mouse"===this.options.position.target&&c||this.options.hide.fixed&&/mouse(out|leave|move)/.test(a.type)&&(c||e))try{a.preventDefault(),a.stopImmediatePropagation()}catch(f){}else this.timers.hide=l.call(this,function(){this.toggle(E,a)},this.options.hide.delay,this)}}function o(a){!this.tooltip.hasClass(aa)&&this.options.hide.inactive&&(clearTimeout(this.timers.inactive),this.timers.inactive=l.call(this,function(){this.hide(a)},this.options.hide.inactive))}function p(a){this.rendered&&this.tooltip[0].offsetWidth>0&&this.reposition(a)}function q(a,c,e){d(b.body).delegate(a,(c.split?c:c.join("."+S+" "))+"."+S,function(){var a=y.api[d.attr(this,U)];a&&!a.disabled&&e.apply(a,arguments)})}function r(a,c,f){var g,i,j,k,l,m=d(b.body),n=a[0]===b?m:a,o=a.metadata?a.metadata(f.metadata):F,p="html5"===f.metadata.type&&o?o[f.metadata.name]:F,q=a.data(f.metadata.name||"qtipopts");try{q="string"==typeof q?d.parseJSON(q):q}catch(r){}if(k=d.extend(D,{},y.defaults,f,"object"==typeof q?h(q):F,h(p||o)),i=k.position,k.id=c,"boolean"==typeof k.content.text){if(j=a.attr(k.content.attr),k.content.attr===E||!j)return E;k.content.text=j}if(i.container.length||(i.container=m),i.target===E&&(i.target=n),k.show.target===E&&(k.show.target=n),k.show.solo===D&&(k.show.solo=i.container.closest("body")),k.hide.target===E&&(k.hide.target=n),k.position.viewport===D&&(k.position.viewport=i.container),i.container=i.container.eq(0),i.at=new A(i.at,D),i.my=new A(i.my),a.data(S))if(k.overwrite)a.qtip("destroy",!0);else if(k.overwrite===E)return E;return a.attr(T,c),k.suppress&&(l=a.attr("title"))&&a.removeAttr("title").attr(ca,l).attr("title",""),g=new e(a,k,c,!!j),a.data(S,g),g}function s(a){return a.charAt(0).toUpperCase()+a.slice(1)}function t(a,b){var d,e,f=b.charAt(0).toUpperCase()+b.slice(1),g=(b+" "+va.join(f+" ")+f).split(" "),h=0;if(ua[b])return a.css(ua[b]);for(;d=g[h++];)if((e=a.css(d))!==c)return ua[b]=d,e}function u(a,b){return Math.ceil(parseFloat(t(a,b)))}function v(a,b){this._ns="tip",this.options=b,this.offset=b.offset,this.size=[b.width,b.height],this.qtip=a,this.init(a)}function w(a,b){this.options=b,this._ns="-modal",this.qtip=a,this.init(a)}function x(a){this._ns="ie6",this.qtip=a,this.init(a)}var y,z,A,B,C,D=!0,E=!1,F=null,G="x",H="y",I="width",J="height",K="top",L="left",M="bottom",N="right",O="center",P="flipinvert",Q="shift",R={},S="qtip",T="data-hasqtip",U="data-qtip-id",V=["ui-widget","ui-tooltip"],W="."+S,X="click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" "),Y=S+"-fixed",Z=S+"-default",$=S+"-focus",_=S+"-hover",aa=S+"-disabled",ba="_replacedByqTip",ca="oldtitle",da={ie:function(){var a,c;for(a=4,c=b.createElement("div");(c.innerHTML="<!--[if gt IE "+a+"]><i></i><![endif]-->")&&c.getElementsByTagName("i")[0];a+=1);return a>4?a:NaN}(),iOS:parseFloat((""+(/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))||E};z=e.prototype,z._when=function(a){return d.when.apply(d,a)},z.render=function(a){if(this.rendered||this.destroyed)return this;var b=this,c=this.options,e=this.cache,f=this.elements,g=c.content.text,h=c.content.title,i=c.content.button,j=c.position,k=[];return d.attr(this.target[0],"aria-describedby",this._id),e.posClass=this._createPosClass((this.position={my:j.my,at:j.at}).my),this.tooltip=f.tooltip=d("<div/>",{id:this._id,"class":[S,Z,c.style.classes,e.posClass].join(" "),width:c.style.width||"",height:c.style.height||"",tracking:"mouse"===j.target&&j.adjust.mouse,role:"alert","aria-live":"polite","aria-atomic":E,"aria-describedby":this._id+"-content","aria-hidden":D}).toggleClass(aa,this.disabled).attr(U,this.id).data(S,this).appendTo(j.container).append(f.content=d("<div />",{"class":S+"-content",id:this._id+"-content","aria-atomic":D})),this.rendered=-1,this.positioning=D,h&&(this._createTitle(),d.isFunction(h)||k.push(this._updateTitle(h,E))),i&&this._createButton(),d.isFunction(g)||k.push(this._updateContent(g,E)),this.rendered=D,this._setWidget(),d.each(R,function(a){var c;"render"===this.initialize&&(c=this(b))&&(b.plugins[a]=c)}),this._unassignEvents(),this._assignEvents(),this._when(k).then(function(){b._trigger("render"),b.positioning=E,b.hiddenDuringWait||!c.show.ready&&!a||b.toggle(D,e.event,E),b.hiddenDuringWait=E}),y.api[this.id]=this,this},z.destroy=function(a){function b(){if(!this.destroyed){this.destroyed=D;var a,b=this.target,c=b.attr(ca);this.rendered&&this.tooltip.stop(1,0).find("*").remove().end().remove(),d.each(this.plugins,function(){this.destroy&&this.destroy()});for(a in this.timers)this.timers.hasOwnProperty(a)&&clearTimeout(this.timers[a]);b.removeData(S).removeAttr(U).removeAttr(T).removeAttr("aria-describedby"),this.options.suppress&&c&&b.attr("title",c).removeAttr(ca),this._unassignEvents(),this.options=this.elements=this.cache=this.timers=this.plugins=this.mouse=F,delete y.api[this.id]}}return this.destroyed?this.target:(a===D&&"hide"!==this.triggering||!this.rendered?b.call(this):(this.tooltip.one("tooltiphidden",d.proxy(b,this)),!this.triggering&&this.hide()),this.target)},B=z.checks={builtin:{"^id$":function(a,b,c,e){var f=c===D?y.nextid:c,g=S+"-"+f;f!==E&&f.length>0&&!d("#"+g).length?(this._id=g,this.rendered&&(this.tooltip[0].id=this._id,this.elements.content[0].id=this._id+"-content",this.elements.title[0].id=this._id+"-title")):a[b]=e},"^prerender":function(a,b,c){c&&!this.rendered&&this.render(this.options.show.ready)},"^content.text$":function(a,b,c){this._updateContent(c)},"^content.attr$":function(a,b,c,d){this.options.content.text===this.target.attr(d)&&this._updateContent(this.target.attr(c))},"^content.title$":function(a,b,c){return c?(c&&!this.elements.title&&this._createTitle(),void this._updateTitle(c)):this._removeTitle()},"^content.button$":function(a,b,c){this._updateButton(c)},"^content.title.(text|button)$":function(a,b,c){this.set("content."+b,c)},"^position.(my|at)$":function(a,b,c){"string"==typeof c&&(this.position[b]=a[b]=new A(c,"at"===b))},"^position.container$":function(a,b,c){this.rendered&&this.tooltip.appendTo(c)},"^show.ready$":function(a,b,c){c&&(!this.rendered&&this.render(D)||this.toggle(D))},"^style.classes$":function(a,b,c,d){this.rendered&&this.tooltip.removeClass(d).addClass(c)},"^style.(width|height)":function(a,b,c){this.rendered&&this.tooltip.css(b,c)},"^style.widget|content.title":function(){this.rendered&&this._setWidget()},"^style.def":function(a,b,c){this.rendered&&this.tooltip.toggleClass(Z,!!c)},"^events.(render|show|move|hide|focus|blur)$":function(a,b,c){this.rendered&&this.tooltip[(d.isFunction(c)?"":"un")+"bind"]("tooltip"+b,c)},"^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)":function(){if(this.rendered){var a=this.options.position;this.tooltip.attr("tracking","mouse"===a.target&&a.adjust.mouse),this._unassignEvents(),this._assignEvents()}}}},z.get=function(a){if(this.destroyed)return this;var b=i(this.options,a.toLowerCase()),c=b[0][b[1]];return c.precedance?c.string():c};var ea=/^position\.(my|at|adjust|target|container|viewport)|style|content|show\.ready/i,fa=/^prerender|show\.ready/i;z.set=function(a,b){if(this.destroyed)return this;var c,e=this.rendered,f=E,g=this.options;return"string"==typeof a?(c=a,a={},a[c]=b):a=d.extend({},a),d.each(a,function(b,c){if(e&&fa.test(b))return void delete a[b];var h,j=i(g,b.toLowerCase());h=j[0][j[1]],j[0][j[1]]=c&&c.nodeType?d(c):c,f=ea.test(b)||f,a[b]=[j[0],j[1],c,h]}),h(g),this.positioning=D,d.each(a,d.proxy(j,this)),this.positioning=E,this.rendered&&this.tooltip[0].offsetWidth>0&&f&&this.reposition("mouse"===g.position.target?F:this.cache.event),this},z._update=function(a,b){var c=this,e=this.cache;return this.rendered&&a?(d.isFunction(a)&&(a=a.call(this.elements.target,e.event,this)||""),d.isFunction(a.then)?(e.waiting=D,a.then(function(a){return e.waiting=E,c._update(a,b)},F,function(a){return c._update(a,b)})):a===E||!a&&""!==a?E:(a.jquery&&a.length>0?b.empty().append(a.css({display:"block",visibility:"visible"})):b.html(a),this._waitForContent(b).then(function(a){c.rendered&&c.tooltip[0].offsetWidth>0&&c.reposition(e.event,!a.length)}))):E},z._waitForContent=function(a){var b=this.cache;return b.waiting=D,(d.fn.imagesLoaded?a.imagesLoaded():(new d.Deferred).resolve([])).done(function(){b.waiting=E}).promise()},z._updateContent=function(a,b){this._update(a,this.elements.content,b)},z._updateTitle=function(a,b){this._update(a,this.elements.title,b)===E&&this._removeTitle(E)},z._createTitle=function(){var a=this.elements,b=this._id+"-title";a.titlebar&&this._removeTitle(),a.titlebar=d("<div />",{"class":S+"-titlebar "+(this.options.style.widget?k("header"):"")}).append(a.title=d("<div />",{id:b,"class":S+"-title","aria-atomic":D})).insertBefore(a.content).delegate(".qtip-close","mousedown keydown mouseup keyup mouseout",function(a){d(this).toggleClass("ui-state-active ui-state-focus","down"===a.type.substr(-4))}).delegate(".qtip-close","mouseover mouseout",function(a){d(this).toggleClass("ui-state-hover","mouseover"===a.type)}),this.options.content.button&&this._createButton()},z._removeTitle=function(a){var b=this.elements;b.title&&(b.titlebar.remove(),b.titlebar=b.title=b.button=F,a!==E&&this.reposition())},z._createPosClass=function(a){return S+"-pos-"+(a||this.options.position.my).abbrev()},z.reposition=function(c,e){if(!this.rendered||this.positioning||this.destroyed)return this;this.positioning=D;var f,g,h,i,j=this.cache,k=this.tooltip,l=this.options.position,m=l.target,n=l.my,o=l.at,p=l.viewport,q=l.container,r=l.adjust,s=r.method.split(" "),t=k.outerWidth(E),u=k.outerHeight(E),v=0,w=0,x=k.css("position"),y={left:0,top:0},z=k[0].offsetWidth>0,A=c&&"scroll"===c.type,B=d(a),C=q[0].ownerDocument,F=this.mouse;if(d.isArray(m)&&2===m.length)o={x:L,y:K},y={left:m[0],top:m[1]};else if("mouse"===m)o={x:L,y:K},(!r.mouse||this.options.hide.distance)&&j.origin&&j.origin.pageX?c=j.origin:!c||c&&("resize"===c.type||"scroll"===c.type)?c=j.event:F&&F.pageX&&(c=F),"static"!==x&&(y=q.offset()),C.body.offsetWidth!==(a.innerWidth||C.documentElement.clientWidth)&&(g=d(b.body).offset()),y={left:c.pageX-y.left+(g&&g.left||0),top:c.pageY-y.top+(g&&g.top||0)},r.mouse&&A&&F&&(y.left-=(F.scrollX||0)-B.scrollLeft(),y.top-=(F.scrollY||0)-B.scrollTop());else{if("event"===m?c&&c.target&&"scroll"!==c.type&&"resize"!==c.type?j.target=d(c.target):c.target||(j.target=this.elements.target):"event"!==m&&(j.target=d(m.jquery?m:this.elements.target)),m=j.target,m=d(m).eq(0),0===m.length)return this;m[0]===b||m[0]===a?(v=da.iOS?a.innerWidth:m.width(),w=da.iOS?a.innerHeight:m.height(),m[0]===a&&(y={top:(p||m).scrollTop(),left:(p||m).scrollLeft()})):R.imagemap&&m.is("area")?f=R.imagemap(this,m,o,R.viewport?s:E):R.svg&&m&&m[0].ownerSVGElement?f=R.svg(this,m,o,R.viewport?s:E):(v=m.outerWidth(E),w=m.outerHeight(E),y=m.offset()),f&&(v=f.width,w=f.height,g=f.offset,y=f.position),y=this.reposition.offset(m,y,q),(da.iOS>3.1&&da.iOS<4.1||da.iOS>=4.3&&da.iOS<4.33||!da.iOS&&"fixed"===x)&&(y.left-=B.scrollLeft(),y.top-=B.scrollTop()),(!f||f&&f.adjustable!==E)&&(y.left+=o.x===N?v:o.x===O?v/2:0,y.top+=o.y===M?w:o.y===O?w/2:0)}return y.left+=r.x+(n.x===N?-t:n.x===O?-t/2:0),y.top+=r.y+(n.y===M?-u:n.y===O?-u/2:0),R.viewport?(h=y.adjusted=R.viewport(this,y,l,v,w,t,u),g&&h.left&&(y.left+=g.left),g&&h.top&&(y.top+=g.top),h.my&&(this.position.my=h.my)):y.adjusted={left:0,top:0},j.posClass!==(i=this._createPosClass(this.position.my))&&(j.posClass=i,k.removeClass(j.posClass).addClass(i)),this._trigger("move",[y,p.elem||p],c)?(delete y.adjusted,e===E||!z||isNaN(y.left)||isNaN(y.top)||"mouse"===m||!d.isFunction(l.effect)?k.css(y):d.isFunction(l.effect)&&(l.effect.call(k,this,d.extend({},y)),k.queue(function(a){d(this).css({opacity:"",height:""}),da.ie&&this.style.removeAttribute("filter"),a()})),this.positioning=E,this):this},z.reposition.offset=function(a,c,e){function f(a,b){c.left+=b*a.scrollLeft(),c.top+=b*a.scrollTop()}if(!e[0])return c;var g,h,i,j,k=d(a[0].ownerDocument),l=!!da.ie&&"CSS1Compat"!==b.compatMode,m=e[0];do"static"!==(h=d.css(m,"position"))&&("fixed"===h?(i=m.getBoundingClientRect(),f(k,-1)):(i=d(m).position(),i.left+=parseFloat(d.css(m,"borderLeftWidth"))||0,i.top+=parseFloat(d.css(m,"borderTopWidth"))||0),c.left-=i.left+(parseFloat(d.css(m,"marginLeft"))||0),c.top-=i.top+(parseFloat(d.css(m,"marginTop"))||0),g||"hidden"===(j=d.css(m,"overflow"))||"visible"===j||(g=d(m)));while(m=m.offsetParent);return g&&(g[0]!==k[0]||l)&&f(g,1),c};var ga=(A=z.reposition.Corner=function(a,b){a=(""+a).replace(/([A-Z])/," $1").replace(/middle/gi,O).toLowerCase(),this.x=(a.match(/left|right/i)||a.match(/center/)||["inherit"])[0].toLowerCase(),this.y=(a.match(/top|bottom|center/i)||["inherit"])[0].toLowerCase(),this.forceY=!!b;var c=a.charAt(0);this.precedance="t"===c||"b"===c?H:G}).prototype;ga.invert=function(a,b){this[a]=this[a]===L?N:this[a]===N?L:b||this[a]},ga.string=function(a){var b=this.x,c=this.y,d=b!==c?"center"===b||"center"!==c&&(this.precedance===H||this.forceY)?[c,b]:[b,c]:[b];return a!==!1?d.join(" "):d},ga.abbrev=function(){var a=this.string(!1);return a[0].charAt(0)+(a[1]&&a[1].charAt(0)||"")},ga.clone=function(){return new A(this.string(),this.forceY)},z.toggle=function(a,c){var e=this.cache,f=this.options,g=this.tooltip;if(c){if(/over|enter/.test(c.type)&&e.event&&/out|leave/.test(e.event.type)&&f.show.target.add(c.target).length===f.show.target.length&&g.has(c.relatedTarget).length)return this;e.event=d.event.fix(c)}if(this.waiting&&!a&&(this.hiddenDuringWait=D),!this.rendered)return a?this.render(1):this;if(this.destroyed||this.disabled)return this;var h,i,j,k=a?"show":"hide",l=this.options[k],m=this.options.position,n=this.options.content,o=this.tooltip.css("width"),p=this.tooltip.is(":visible"),q=a||1===l.target.length,r=!c||l.target.length<2||e.target[0]===c.target;return(typeof a).search("boolean|number")&&(a=!p),h=!g.is(":animated")&&p===a&&r,i=h?F:!!this._trigger(k,[90]),this.destroyed?this:(i!==E&&a&&this.focus(c),!i||h?this:(d.attr(g[0],"aria-hidden",!a),a?(this.mouse&&(e.origin=d.event.fix(this.mouse)),d.isFunction(n.text)&&this._updateContent(n.text,E),d.isFunction(n.title)&&this._updateTitle(n.title,E),!C&&"mouse"===m.target&&m.adjust.mouse&&(d(b).bind("mousemove."+S,this._storeMouse),C=D),o||g.css("width",g.outerWidth(E)),this.reposition(c,arguments[2]),o||g.css("width",""),l.solo&&("string"==typeof l.solo?d(l.solo):d(W,l.solo)).not(g).not(l.target).qtip("hide",new d.Event("tooltipsolo"))):(clearTimeout(this.timers.show),delete e.origin,C&&!d(W+'[tracking="true"]:visible',l.solo).not(g).length&&(d(b).unbind("mousemove."+S),C=E),this.blur(c)),j=d.proxy(function(){a?(da.ie&&g[0].style.removeAttribute("filter"),g.css("overflow",""),"string"==typeof l.autofocus&&d(this.options.show.autofocus,g).focus(),this.options.show.target.trigger("qtip-"+this.id+"-inactive")):g.css({display:"",visibility:"",opacity:"",left:"",top:""}),this._trigger(a?"visible":"hidden")},this),l.effect===E||q===E?(g[k](),j()):d.isFunction(l.effect)?(g.stop(1,1),l.effect.call(g,this),g.queue("fx",function(a){j(),a()})):g.fadeTo(90,a?1:0,j),a&&l.target.trigger("qtip-"+this.id+"-inactive"),this))},z.show=function(a){return this.toggle(D,a)},z.hide=function(a){return this.toggle(E,a)},z.focus=function(a){if(!this.rendered||this.destroyed)return this;var b=d(W),c=this.tooltip,e=parseInt(c[0].style.zIndex,10),f=y.zindex+b.length;return c.hasClass($)||this._trigger("focus",[f],a)&&(e!==f&&(b.each(function(){this.style.zIndex>e&&(this.style.zIndex=this.style.zIndex-1)}),b.filter("."+$).qtip("blur",a)),c.addClass($)[0].style.zIndex=f),this},z.blur=function(a){return!this.rendered||this.destroyed?this:(this.tooltip.removeClass($),this._trigger("blur",[this.tooltip.css("zIndex")],a),this)},z.disable=function(a){return this.destroyed?this:("toggle"===a?a=!(this.rendered?this.tooltip.hasClass(aa):this.disabled):"boolean"!=typeof a&&(a=D),this.rendered&&this.tooltip.toggleClass(aa,a).attr("aria-disabled",a),this.disabled=!!a,this)},z.enable=function(){return this.disable(E)},z._createButton=function(){var a=this,b=this.elements,c=b.tooltip,e=this.options.content.button,f="string"==typeof e,g=f?e:"Close tooltip";b.button&&b.button.remove(),e.jquery?b.button=e:b.button=d("<a />",{"class":"qtip-close "+(this.options.style.widget?"":S+"-icon"),title:g,"aria-label":g}).prepend(d("<span />",{"class":"ui-icon ui-icon-close",html:"&times;"})),b.button.appendTo(b.titlebar||c).attr("role","button").click(function(b){return c.hasClass(aa)||a.hide(b),E})},z._updateButton=function(a){if(!this.rendered)return E;var b=this.elements.button;a?this._createButton():b.remove()},z._setWidget=function(){var a=this.options.style.widget,b=this.elements,c=b.tooltip,d=c.hasClass(aa);c.removeClass(aa),aa=a?"ui-state-disabled":"qtip-disabled",c.toggleClass(aa,d),c.toggleClass("ui-helper-reset "+k(),a).toggleClass(Z,this.options.style.def&&!a),b.content&&b.content.toggleClass(k("content"),a),b.titlebar&&b.titlebar.toggleClass(k("header"),a),b.button&&b.button.toggleClass(S+"-icon",!a)},z._storeMouse=function(a){return(this.mouse=d.event.fix(a)).type="mousemove",this},z._bind=function(a,b,c,e,f){if(a&&c&&b.length){var g="."+this._id+(e?"-"+e:"");return d(a).bind((b.split?b:b.join(g+" "))+g,d.proxy(c,f||this)),this}},z._unbind=function(a,b){return a&&d(a).unbind("."+this._id+(b?"-"+b:"")),this},z._trigger=function(a,b,c){var e=new d.Event("tooltip"+a);return e.originalEvent=c&&d.extend({},c)||this.cache.event||F,this.triggering=a,this.tooltip.trigger(e,[this].concat(b||[])),this.triggering=E,!e.isDefaultPrevented()},z._bindEvents=function(a,b,c,e,f,g){var h=c.filter(e).add(e.filter(c)),i=[];h.length&&(d.each(b,function(b,c){var e=d.inArray(c,a);e>-1&&i.push(a.splice(e,1)[0])}),i.length&&(this._bind(h,i,function(a){var b=this.rendered?this.tooltip[0].offsetWidth>0:!1;(b?g:f).call(this,a)}),c=c.not(h),e=e.not(h))),this._bind(c,a,f),this._bind(e,b,g)},z._assignInitialEvents=function(a){function b(a){return this.disabled||this.destroyed?E:(this.cache.event=a&&d.event.fix(a),this.cache.target=a&&d(a.target),clearTimeout(this.timers.show),void(this.timers.show=l.call(this,function(){this.render("object"==typeof a||c.show.ready)},c.prerender?0:c.show.delay)))}var c=this.options,e=c.show.target,f=c.hide.target,g=c.show.event?d.trim(""+c.show.event).split(" "):[],h=c.hide.event?d.trim(""+c.hide.event).split(" "):[];this._bind(this.elements.target,["remove","removeqtip"],function(){this.destroy(!0)},"destroy"),/mouse(over|enter)/i.test(c.show.event)&&!/mouse(out|leave)/i.test(c.hide.event)&&h.push("mouseleave"),this._bind(e,"mousemove",function(a){this._storeMouse(a),this.cache.onTarget=D}),this._bindEvents(g,h,e,f,b,function(){return this.timers?void clearTimeout(this.timers.show):E}),(c.show.ready||c.prerender)&&b.call(this,a)},z._assignEvents=function(){var c=this,e=this.options,f=e.position,g=this.tooltip,h=e.show.target,i=e.hide.target,j=f.container,k=f.viewport,l=d(b),q=d(a),r=e.show.event?d.trim(""+e.show.event).split(" "):[],s=e.hide.event?d.trim(""+e.hide.event).split(" "):[];d.each(e.events,function(a,b){c._bind(g,"toggle"===a?["tooltipshow","tooltiphide"]:["tooltip"+a],b,null,g)}),/mouse(out|leave)/i.test(e.hide.event)&&"window"===e.hide.leave&&this._bind(l,["mouseout","blur"],function(a){/select|option/.test(a.target.nodeName)||a.relatedTarget||this.hide(a)}),e.hide.fixed?i=i.add(g.addClass(Y)):/mouse(over|enter)/i.test(e.show.event)&&this._bind(i,"mouseleave",function(){clearTimeout(this.timers.show)}),(""+e.hide.event).indexOf("unfocus")>-1&&this._bind(j.closest("html"),["mousedown","touchstart"],function(a){var b=d(a.target),c=this.rendered&&!this.tooltip.hasClass(aa)&&this.tooltip[0].offsetWidth>0,e=b.parents(W).filter(this.tooltip[0]).length>0;b[0]===this.target[0]||b[0]===this.tooltip[0]||e||this.target.has(b[0]).length||!c||this.hide(a)}),"number"==typeof e.hide.inactive&&(this._bind(h,"qtip-"+this.id+"-inactive",o,"inactive"),this._bind(i.add(g),y.inactiveEvents,o)),this._bindEvents(r,s,h,i,m,n),this._bind(h.add(g),"mousemove",function(a){if("number"==typeof e.hide.distance){var b=this.cache.origin||{},c=this.options.hide.distance,d=Math.abs;(d(a.pageX-b.pageX)>=c||d(a.pageY-b.pageY)>=c)&&this.hide(a)}this._storeMouse(a)}),"mouse"===f.target&&f.adjust.mouse&&(e.hide.event&&this._bind(h,["mouseenter","mouseleave"],function(a){return this.cache?void(this.cache.onTarget="mouseenter"===a.type):E}),this._bind(l,"mousemove",function(a){this.rendered&&this.cache.onTarget&&!this.tooltip.hasClass(aa)&&this.tooltip[0].offsetWidth>0&&this.reposition(a)})),(f.adjust.resize||k.length)&&this._bind(d.event.special.resize?k:q,"resize",p),f.adjust.scroll&&this._bind(q.add(f.container),"scroll",p)},z._unassignEvents=function(){var c=this.options,e=c.show.target,f=c.hide.target,g=d.grep([this.elements.target[0],this.rendered&&this.tooltip[0],c.position.container[0],c.position.viewport[0],c.position.container.closest("html")[0],a,b],function(a){return"object"==typeof a});e&&e.toArray&&(g=g.concat(e.toArray())),f&&f.toArray&&(g=g.concat(f.toArray())),this._unbind(g)._unbind(g,"destroy")._unbind(g,"inactive")},d(function(){q(W,["mouseenter","mouseleave"],function(a){var b="mouseenter"===a.type,c=d(a.currentTarget),e=d(a.relatedTarget||a.target),f=this.options;b?(this.focus(a),c.hasClass(Y)&&!c.hasClass(aa)&&clearTimeout(this.timers.hide)):"mouse"===f.position.target&&f.position.adjust.mouse&&f.hide.event&&f.show.target&&!e.closest(f.show.target[0]).length&&this.hide(a),c.toggleClass(_,b)}),q("["+U+"]",X,o)}),y=d.fn.qtip=function(a,b,e){var f=(""+a).toLowerCase(),g=F,i=d.makeArray(arguments).slice(1),j=i[i.length-1],k=this[0]?d.data(this[0],S):F;return!arguments.length&&k||"api"===f?k:"string"==typeof a?(this.each(function(){var a=d.data(this,S);if(!a)return D;if(j&&j.timeStamp&&(a.cache.event=j),!b||"option"!==f&&"options"!==f)a[f]&&a[f].apply(a,i);else{if(e===c&&!d.isPlainObject(b))return g=a.get(b),E;a.set(b,e)}}),g!==F?g:this):"object"!=typeof a&&arguments.length?void 0:(k=h(d.extend(D,{},a)),this.each(function(a){var b,c;return c=d.isArray(k.id)?k.id[a]:k.id,c=!c||c===E||c.length<1||y.api[c]?y.nextid++:c,b=r(d(this),c,k),b===E?D:(y.api[c]=b,d.each(R,function(){"initialize"===this.initialize&&this(b)}),void b._assignInitialEvents(j))}))},d.qtip=e,y.api={},d.each({attr:function(a,b){if(this.length){var c=this[0],e="title",f=d.data(c,"qtip");if(a===e&&f&&f.options&&"object"==typeof f&&"object"==typeof f.options&&f.options.suppress)return arguments.length<2?d.attr(c,ca):(f&&f.options.content.attr===e&&f.cache.attr&&f.set("content.text",b),this.attr(ca,b))}return d.fn["attr"+ba].apply(this,arguments)},clone:function(a){var b=d.fn["clone"+ba].apply(this,arguments);return a||b.filter("["+ca+"]").attr("title",function(){return d.attr(this,ca)}).removeAttr(ca),b}},function(a,b){if(!b||d.fn[a+ba])return D;var c=d.fn[a+ba]=d.fn[a];d.fn[a]=function(){return b.apply(this,arguments)||c.apply(this,arguments)}}),d.ui||(d["cleanData"+ba]=d.cleanData,d.cleanData=function(a){for(var b,c=0;(b=d(a[c])).length;c++)if(b.attr(T))try{b.triggerHandler("removeqtip")}catch(e){}d["cleanData"+ba].apply(this,arguments)}),y.version="3.0.3",y.nextid=0,y.inactiveEvents=X,y.zindex=15e3,y.defaults={prerender:E,id:E,overwrite:D,suppress:D,content:{text:D,attr:"title",title:E,button:E},position:{my:"top left",at:"bottom right",target:E,container:E,viewport:E,adjust:{x:0,y:0,mouse:D,scroll:D,resize:D,method:"flipinvert flipinvert"},effect:function(a,b){d(this).animate(b,{duration:200,queue:E})}},show:{target:E,event:"mouseenter",effect:D,delay:90,solo:E,ready:E,autofocus:E},hide:{target:E,event:"mouseleave",effect:D,delay:0,fixed:E,inactive:E,leave:"window",distance:E},style:{classes:"",widget:E,width:E,height:E,def:D},events:{render:F,move:F,show:F,hide:F,toggle:F,visible:F,hidden:F,focus:F,blur:F}};var ha,ia,ja,ka,la,ma="margin",na="border",oa="color",pa="background-color",qa="transparent",ra=" !important",sa=!!b.createElement("canvas").getContext,ta=/rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i,ua={},va=["Webkit","O","Moz","ms"];sa?(ka=a.devicePixelRatio||1,la=function(){var a=b.createElement("canvas").getContext("2d");return a.backingStorePixelRatio||a.webkitBackingStorePixelRatio||a.mozBackingStorePixelRatio||a.msBackingStorePixelRatio||a.oBackingStorePixelRatio||1}(),ja=ka/la):ia=function(a,b,c){return"<qtipvml:"+a+' xmlns="urn:schemas-microsoft.com:vml" class="qtip-vml" '+(b||"")+' style="behavior: url(#default#VML); '+(c||"")+'" />'},d.extend(v.prototype,{init:function(a){var b,c;c=this.element=a.elements.tip=d("<div />",{"class":S+"-tip"}).prependTo(a.tooltip),sa?(b=d("<canvas />").appendTo(this.element)[0].getContext("2d"),b.lineJoin="miter",b.miterLimit=1e5,b.save()):(b=ia("shape",'coordorigin="0,0"',"position:absolute;"),this.element.html(b+b),a._bind(d("*",c).add(c),["click","mousedown"],function(a){a.stopPropagation()},this._ns)),a._bind(a.tooltip,"tooltipmove",this.reposition,this._ns,this),this.create()},_swapDimensions:function(){this.size[0]=this.options.height,this.size[1]=this.options.width},_resetDimensions:function(){this.size[0]=this.options.width,this.size[1]=this.options.height},_useTitle:function(a){var b=this.qtip.elements.titlebar;return b&&(a.y===K||a.y===O&&this.element.position().top+this.size[1]/2+this.options.offset<b.outerHeight(D))},_parseCorner:function(a){var b=this.qtip.options.position.my;return a===E||b===E?a=E:a===D?a=new A(b.string()):a.string||(a=new A(a),a.fixed=D),a},_parseWidth:function(a,b,c){var d=this.qtip.elements,e=na+s(b)+"Width";return(c?u(c,e):u(d.content,e)||u(this._useTitle(a)&&d.titlebar||d.content,e)||u(d.tooltip,e))||0},_parseRadius:function(a){var b=this.qtip.elements,c=na+s(a.y)+s(a.x)+"Radius";return da.ie<9?0:u(this._useTitle(a)&&b.titlebar||b.content,c)||u(b.tooltip,c)||0},_invalidColour:function(a,b,c){var d=a.css(b);return!d||c&&d===a.css(c)||ta.test(d)?E:d},_parseColours:function(a){var b=this.qtip.elements,c=this.element.css("cssText",""),e=na+s(a[a.precedance])+s(oa),f=this._useTitle(a)&&b.titlebar||b.content,g=this._invalidColour,h=[];return h[0]=g(c,pa)||g(f,pa)||g(b.content,pa)||g(b.tooltip,pa)||c.css(pa),h[1]=g(c,e,oa)||g(f,e,oa)||g(b.content,e,oa)||g(b.tooltip,e,oa)||b.tooltip.css(e),d("*",c).add(c).css("cssText",pa+":"+qa+ra+";"+na+":0"+ra+";"),h},_calculateSize:function(a){var b,c,d,e=a.precedance===H,f=this.options.width,g=this.options.height,h="c"===a.abbrev(),i=(e?f:g)*(h?.5:1),j=Math.pow,k=Math.round,l=Math.sqrt(j(i,2)+j(g,2)),m=[this.border/i*l,this.border/g*l];return m[2]=Math.sqrt(j(m[0],2)-j(this.border,2)),m[3]=Math.sqrt(j(m[1],2)-j(this.border,2)),b=l+m[2]+m[3]+(h?0:m[0]),c=b/l,d=[k(c*f),k(c*g)],e?d:d.reverse()},_calculateTip:function(a,b,c){c=c||1,b=b||this.size;var d=b[0]*c,e=b[1]*c,f=Math.ceil(d/2),g=Math.ceil(e/2),h={br:[0,0,d,e,d,0],bl:[0,0,d,0,0,e],tr:[0,e,d,0,d,e],tl:[0,0,0,e,d,e],tc:[0,e,f,0,d,e],bc:[0,0,d,0,f,e],rc:[0,0,d,g,0,e],lc:[d,0,d,e,0,g]};return h.lt=h.br,h.rt=h.bl,h.lb=h.tr,h.rb=h.tl,h[a.abbrev()]},_drawCoords:function(a,b){a.beginPath(),a.moveTo(b[0],b[1]),a.lineTo(b[2],b[3]),a.lineTo(b[4],b[5]),a.closePath()},create:function(){var a=this.corner=(sa||da.ie)&&this._parseCorner(this.options.corner);return this.enabled=!!this.corner&&"c"!==this.corner.abbrev(),this.enabled&&(this.qtip.cache.corner=a.clone(),this.update()),this.element.toggle(this.enabled),this.corner},update:function(b,c){if(!this.enabled)return this;var e,f,g,h,i,j,k,l,m=this.qtip.elements,n=this.element,o=n.children(),p=this.options,q=this.size,r=p.mimic,s=Math.round;b||(b=this.qtip.cache.corner||this.corner),r===E?r=b:(r=new A(r),r.precedance=b.precedance,"inherit"===r.x?r.x=b.x:"inherit"===r.y?r.y=b.y:r.x===r.y&&(r[b.precedance]=b[b.precedance])),f=r.precedance,b.precedance===G?this._swapDimensions():this._resetDimensions(),e=this.color=this._parseColours(b),e[1]!==qa?(l=this.border=this._parseWidth(b,b[b.precedance]),p.border&&1>l&&!ta.test(e[1])&&(e[0]=e[1]),this.border=l=p.border!==D?p.border:l):this.border=l=0,k=this.size=this._calculateSize(b),n.css({width:k[0],height:k[1],lineHeight:k[1]+"px"}),j=b.precedance===H?[s(r.x===L?l:r.x===N?k[0]-q[0]-l:(k[0]-q[0])/2),s(r.y===K?k[1]-q[1]:0)]:[s(r.x===L?k[0]-q[0]:0),s(r.y===K?l:r.y===M?k[1]-q[1]-l:(k[1]-q[1])/2)],sa?(g=o[0].getContext("2d"),g.restore(),g.save(),g.clearRect(0,0,6e3,6e3),h=this._calculateTip(r,q,ja),i=this._calculateTip(r,this.size,ja),o.attr(I,k[0]*ja).attr(J,k[1]*ja),o.css(I,k[0]).css(J,k[1]),this._drawCoords(g,i),g.fillStyle=e[1],g.fill(),g.translate(j[0]*ja,j[1]*ja),this._drawCoords(g,h),g.fillStyle=e[0],g.fill()):(h=this._calculateTip(r),h="m"+h[0]+","+h[1]+" l"+h[2]+","+h[3]+" "+h[4]+","+h[5]+" xe",j[2]=l&&/^(r|b)/i.test(b.string())?8===da.ie?2:1:0,o.css({coordsize:k[0]+l+" "+k[1]+l,antialias:""+(r.string().indexOf(O)>-1),left:j[0]-j[2]*Number(f===G),top:j[1]-j[2]*Number(f===H),width:k[0]+l,height:k[1]+l}).each(function(a){var b=d(this);b[b.prop?"prop":"attr"]({coordsize:k[0]+l+" "+k[1]+l,path:h,fillcolor:e[0],filled:!!a,stroked:!a}).toggle(!(!l&&!a)),!a&&b.html(ia("stroke",'weight="'+2*l+'px" color="'+e[1]+'" miterlimit="1000" joinstyle="miter"'))})),a.opera&&setTimeout(function(){m.tip.css({display:"inline-block",visibility:"visible"})},1),c!==E&&this.calculate(b,k)},calculate:function(a,b){if(!this.enabled)return E;var c,e,f=this,g=this.qtip.elements,h=this.element,i=this.options.offset,j={};
4
+ return a=a||this.corner,c=a.precedance,b=b||this._calculateSize(a),e=[a.x,a.y],c===G&&e.reverse(),d.each(e,function(d,e){var h,k,l;e===O?(h=c===H?L:K,j[h]="50%",j[ma+"-"+h]=-Math.round(b[c===H?0:1]/2)+i):(h=f._parseWidth(a,e,g.tooltip),k=f._parseWidth(a,e,g.content),l=f._parseRadius(a),j[e]=Math.max(-f.border,d?k:i+(l>h?l:-h)))}),j[a[c]]-=b[c===G?0:1],h.css({margin:"",top:"",bottom:"",left:"",right:""}).css(j),j},reposition:function(a,b,d){function e(a,b,c,d,e){a===Q&&j.precedance===b&&k[d]&&j[c]!==O?j.precedance=j.precedance===G?H:G:a!==Q&&k[d]&&(j[b]=j[b]===O?k[d]>0?d:e:j[b]===d?e:d)}function f(a,b,e){j[a]===O?p[ma+"-"+b]=o[a]=g[ma+"-"+b]-k[b]:(h=g[e]!==c?[k[b],-g[b]]:[-k[b],g[b]],(o[a]=Math.max(h[0],h[1]))>h[0]&&(d[b]-=k[b],o[b]=E),p[g[e]!==c?e:b]=o[a])}if(this.enabled){var g,h,i=b.cache,j=this.corner.clone(),k=d.adjusted,l=b.options.position.adjust.method.split(" "),m=l[0],n=l[1]||l[0],o={left:E,top:E,x:0,y:0},p={};this.corner.fixed!==D&&(e(m,G,H,L,N),e(n,H,G,K,M),j.string()===i.corner.string()&&i.cornerTop===k.top&&i.cornerLeft===k.left||this.update(j,E)),g=this.calculate(j),g.right!==c&&(g.left=-g.right),g.bottom!==c&&(g.top=-g.bottom),g.user=this.offset,o.left=m===Q&&!!k.left,o.left&&f(G,L,N),o.top=n===Q&&!!k.top,o.top&&f(H,K,M),this.element.css(p).toggle(!(o.x&&o.y||j.x===O&&o.y||j.y===O&&o.x)),d.left-=g.left.charAt?g.user:m!==Q||o.top||!o.left&&!o.top?g.left+this.border:0,d.top-=g.top.charAt?g.user:n!==Q||o.left||!o.left&&!o.top?g.top+this.border:0,i.cornerLeft=k.left,i.cornerTop=k.top,i.corner=j.clone()}},destroy:function(){this.qtip._unbind(this.qtip.tooltip,this._ns),this.qtip.elements.tip&&this.qtip.elements.tip.find("*").remove().end().remove()}}),ha=R.tip=function(a){return new v(a,a.options.style.tip)},ha.initialize="render",ha.sanitize=function(a){if(a.style&&"tip"in a.style){var b=a.style.tip;"object"!=typeof b&&(b=a.style.tip={corner:b}),/string|boolean/i.test(typeof b.corner)||(b.corner=D)}},B.tip={"^position.my|style.tip.(corner|mimic|border)$":function(){this.create(),this.qtip.reposition()},"^style.tip.(height|width)$":function(a){this.size=[a.width,a.height],this.update(),this.qtip.reposition()},"^content.title|style.(classes|widget)$":function(){this.update()}},d.extend(D,y.defaults,{style:{tip:{corner:D,mimic:E,width:6,height:6,border:D,offset:0}}});var wa,xa,ya="qtip-modal",za="."+ya;xa=function(){function a(a){if(d.expr[":"].focusable)return d.expr[":"].focusable;var b,c,e,f=!isNaN(d.attr(a,"tabindex")),g=a.nodeName&&a.nodeName.toLowerCase();return"area"===g?(b=a.parentNode,c=b.name,a.href&&c&&"map"===b.nodeName.toLowerCase()?(e=d("img[usemap=#"+c+"]")[0],!!e&&e.is(":visible")):!1):/input|select|textarea|button|object/.test(g)?!a.disabled:"a"===g?a.href||f:f}function c(a){j.length<1&&a.length?a.not("body").blur():j.first().focus()}function e(a){if(h.is(":visible")){var b,e=d(a.target),g=f.tooltip,i=e.closest(W);b=i.length<1?E:parseInt(i[0].style.zIndex,10)>parseInt(g[0].style.zIndex,10),b||e.closest(W)[0]===g[0]||c(e)}}var f,g,h,i=this,j={};d.extend(i,{init:function(){return h=i.elem=d("<div />",{id:"qtip-overlay",html:"<div></div>",mousedown:function(){return E}}).hide(),d(b.body).bind("focusin"+za,e),d(b).bind("keydown"+za,function(a){f&&f.options.show.modal.escape&&27===a.keyCode&&f.hide(a)}),h.bind("click"+za,function(a){f&&f.options.show.modal.blur&&f.hide(a)}),i},update:function(b){f=b,j=b.options.show.modal.stealfocus!==E?b.tooltip.find("*").filter(function(){return a(this)}):[]},toggle:function(a,e,j){var k=a.tooltip,l=a.options.show.modal,m=l.effect,n=e?"show":"hide",o=h.is(":visible"),p=d(za).filter(":visible:not(:animated)").not(k);return i.update(a),e&&l.stealfocus!==E&&c(d(":focus")),h.toggleClass("blurs",l.blur),e&&h.appendTo(b.body),h.is(":animated")&&o===e&&g!==E||!e&&p.length?i:(h.stop(D,E),d.isFunction(m)?m.call(h,e):m===E?h[n]():h.fadeTo(parseInt(j,10)||90,e?1:0,function(){e||h.hide()}),e||h.queue(function(a){h.css({left:"",top:""}),d(za).length||h.detach(),a()}),g=e,f.destroyed&&(f=F),i)}}),i.init()},xa=new xa,d.extend(w.prototype,{init:function(a){var b=a.tooltip;return this.options.on?(a.elements.overlay=xa.elem,b.addClass(ya).css("z-index",y.modal_zindex+d(za).length),a._bind(b,["tooltipshow","tooltiphide"],function(a,c,e){var f=a.originalEvent;if(a.target===b[0])if(f&&"tooltiphide"===a.type&&/mouse(leave|enter)/.test(f.type)&&d(f.relatedTarget).closest(xa.elem[0]).length)try{a.preventDefault()}catch(g){}else(!f||f&&"tooltipsolo"!==f.type)&&this.toggle(a,"tooltipshow"===a.type,e)},this._ns,this),a._bind(b,"tooltipfocus",function(a,c){if(!a.isDefaultPrevented()&&a.target===b[0]){var e=d(za),f=y.modal_zindex+e.length,g=parseInt(b[0].style.zIndex,10);xa.elem[0].style.zIndex=f-1,e.each(function(){this.style.zIndex>g&&(this.style.zIndex-=1)}),e.filter("."+$).qtip("blur",a.originalEvent),b.addClass($)[0].style.zIndex=f,xa.update(c);try{a.preventDefault()}catch(h){}}},this._ns,this),void a._bind(b,"tooltiphide",function(a){a.target===b[0]&&d(za).filter(":visible").not(b).last().qtip("focus",a)},this._ns,this)):this},toggle:function(a,b,c){return a&&a.isDefaultPrevented()?this:void xa.toggle(this.qtip,!!b,c)},destroy:function(){this.qtip.tooltip.removeClass(ya),this.qtip._unbind(this.qtip.tooltip,this._ns),xa.toggle(this.qtip,E),delete this.qtip.elements.overlay}}),wa=R.modal=function(a){return new w(a,a.options.show.modal)},wa.sanitize=function(a){a.show&&("object"!=typeof a.show.modal?a.show.modal={on:!!a.show.modal}:"undefined"==typeof a.show.modal.on&&(a.show.modal.on=D))},y.modal_zindex=y.zindex-200,wa.initialize="render",B.modal={"^show.modal.(on|blur)$":function(){this.destroy(),this.init(),this.qtip.elems.overlay.toggle(this.qtip.tooltip[0].offsetWidth>0)}},d.extend(D,y.defaults,{show:{modal:{on:E,effect:D,blur:D,stealfocus:D,escape:D}}}),R.viewport=function(c,d,e,f,g,h,i){function j(a,b,c,e,f,g,h,i,j){var k=d[f],s=u[a],t=v[a],w=c===Q,x=s===f?j:s===g?-j:-j/2,y=t===f?i:t===g?-i:-i/2,z=q[f]+r[f]-(n?0:m[f]),A=z-k,B=k+j-(h===I?o:p)-z,C=x-(u.precedance===a||s===u[b]?y:0)-(t===O?i/2:0);return w?(C=(s===f?1:-1)*x,d[f]+=A>0?A:B>0?-B:0,d[f]=Math.max(-m[f]+r[f],k-C,Math.min(Math.max(-m[f]+r[f]+(h===I?o:p),k+C),d[f],"center"===s?k-x:1e9))):(e*=c===P?2:0,A>0&&(s!==f||B>0)?(d[f]-=C+e,l.invert(a,f)):B>0&&(s!==g||A>0)&&(d[f]-=(s===O?-C:C)+e,l.invert(a,g)),d[f]<q[f]&&-d[f]>B&&(d[f]=k,l=u.clone())),d[f]-k}var k,l,m,n,o,p,q,r,s=e.target,t=c.elements.tooltip,u=e.my,v=e.at,w=e.adjust,x=w.method.split(" "),y=x[0],z=x[1]||x[0],A=e.viewport,B=e.container,C={left:0,top:0};return A.jquery&&s[0]!==a&&s[0]!==b.body&&"none"!==w.method?(m=B.offset()||C,n="static"===B.css("position"),k="fixed"===t.css("position"),o=A[0]===a?A.width():A.outerWidth(E),p=A[0]===a?A.height():A.outerHeight(E),q={left:k?0:A.scrollLeft(),top:k?0:A.scrollTop()},r=A.offset()||C,"shift"===y&&"shift"===z||(l=u.clone()),C={left:"none"!==y?j(G,H,y,w.x,L,N,I,f,h):0,top:"none"!==z?j(H,G,z,w.y,K,M,J,g,i):0,my:l}):C},R.polys={polygon:function(a,b){var c,d,e,f={width:0,height:0,position:{top:1e10,right:0,bottom:0,left:1e10},adjustable:E},g=0,h=[],i=1,j=1,k=0,l=0;for(g=a.length;g--;)c=[parseInt(a[--g],10),parseInt(a[g+1],10)],c[0]>f.position.right&&(f.position.right=c[0]),c[0]<f.position.left&&(f.position.left=c[0]),c[1]>f.position.bottom&&(f.position.bottom=c[1]),c[1]<f.position.top&&(f.position.top=c[1]),h.push(c);if(d=f.width=Math.abs(f.position.right-f.position.left),e=f.height=Math.abs(f.position.bottom-f.position.top),"c"===b.abbrev())f.position={left:f.position.left+f.width/2,top:f.position.top+f.height/2};else{for(;d>0&&e>0&&i>0&&j>0;)for(d=Math.floor(d/2),e=Math.floor(e/2),b.x===L?i=d:b.x===N?i=f.width-d:i+=Math.floor(d/2),b.y===K?j=e:b.y===M?j=f.height-e:j+=Math.floor(e/2),g=h.length;g--&&!(h.length<2);)k=h[g][0]-f.position.left,l=h[g][1]-f.position.top,(b.x===L&&k>=i||b.x===N&&i>=k||b.x===O&&(i>k||k>f.width-i)||b.y===K&&l>=j||b.y===M&&j>=l||b.y===O&&(j>l||l>f.height-j))&&h.splice(g,1);f.position={left:h[0][0],top:h[0][1]}}return f},rect:function(a,b,c,d){return{width:Math.abs(c-a),height:Math.abs(d-b),position:{left:Math.min(a,c),top:Math.min(b,d)}}},_angles:{tc:1.5,tr:7/4,tl:5/4,bc:.5,br:.25,bl:.75,rc:2,lc:1,c:0},ellipse:function(a,b,c,d,e){var f=R.polys._angles[e.abbrev()],g=0===f?0:c*Math.cos(f*Math.PI),h=d*Math.sin(f*Math.PI);return{width:2*c-Math.abs(g),height:2*d-Math.abs(h),position:{left:a+g,top:b+h},adjustable:E}},circle:function(a,b,c,d){return R.polys.ellipse(a,b,c,c,d)}},R.svg=function(a,c,e){for(var f,g,h,i,j,k,l,m,n,o=c[0],p=d(o.ownerSVGElement),q=o.ownerDocument,r=(parseInt(c.css("stroke-width"),10)||0)/2;!o.getBBox;)o=o.parentNode;if(!o.getBBox||!o.parentNode)return E;switch(o.nodeName){case"ellipse":case"circle":m=R.polys.ellipse(o.cx.baseVal.value,o.cy.baseVal.value,(o.rx||o.r).baseVal.value+r,(o.ry||o.r).baseVal.value+r,e);break;case"line":case"polygon":case"polyline":for(l=o.points||[{x:o.x1.baseVal.value,y:o.y1.baseVal.value},{x:o.x2.baseVal.value,y:o.y2.baseVal.value}],m=[],k=-1,i=l.numberOfItems||l.length;++k<i;)j=l.getItem?l.getItem(k):l[k],m.push.apply(m,[j.x,j.y]);m=R.polys.polygon(m,e);break;default:m=o.getBBox(),m={width:m.width,height:m.height,position:{left:m.x,top:m.y}}}return n=m.position,p=p[0],p.createSVGPoint&&(g=o.getScreenCTM(),l=p.createSVGPoint(),l.x=n.left,l.y=n.top,h=l.matrixTransform(g),n.left=h.x,n.top=h.y),q!==b&&"mouse"!==a.position.target&&(f=d((q.defaultView||q.parentWindow).frameElement).offset(),f&&(n.left+=f.left,n.top+=f.top)),q=d(q),n.left+=q.scrollLeft(),n.top+=q.scrollTop(),m},R.imagemap=function(a,b,c){b.jquery||(b=d(b));var e,f,g,h,i,j=(b.attr("shape")||"rect").toLowerCase().replace("poly","polygon"),k=d('img[usemap="#'+b.parent("map").attr("name")+'"]'),l=d.trim(b.attr("coords")),m=l.replace(/,$/,"").split(",");if(!k.length)return E;if("polygon"===j)h=R.polys.polygon(m,c);else{if(!R.polys[j])return E;for(g=-1,i=m.length,f=[];++g<i;)f.push(parseInt(m[g],10));h=R.polys[j].apply(this,f.concat(c))}return e=k.offset(),e.left+=Math.ceil((k.outerWidth(E)-k.width())/2),e.top+=Math.ceil((k.outerHeight(E)-k.height())/2),h.position.left+=e.left,h.position.top+=e.top,h};var Aa,Ba='<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:\'\';" style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=0); -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";"></iframe>';d.extend(x.prototype,{_scroll:function(){var b=this.qtip.elements.overlay;b&&(b[0].style.top=d(a).scrollTop()+"px")},init:function(c){var e=c.tooltip;d("select, object").length<1&&(this.bgiframe=c.elements.bgiframe=d(Ba).appendTo(e),c._bind(e,"tooltipmove",this.adjustBGIFrame,this._ns,this)),this.redrawContainer=d("<div/>",{id:S+"-rcontainer"}).appendTo(b.body),c.elements.overlay&&c.elements.overlay.addClass("qtipmodal-ie6fix")&&(c._bind(a,["scroll","resize"],this._scroll,this._ns,this),c._bind(e,["tooltipshow"],this._scroll,this._ns,this)),this.redraw()},adjustBGIFrame:function(){var a,b,c=this.qtip.tooltip,d={height:c.outerHeight(E),width:c.outerWidth(E)},e=this.qtip.plugins.tip,f=this.qtip.elements.tip;b=parseInt(c.css("borderLeftWidth"),10)||0,b={left:-b,top:-b},e&&f&&(a="x"===e.corner.precedance?[I,L]:[J,K],b[a[1]]-=f[a[0]]()),this.bgiframe.css(b).css(d)},redraw:function(){if(this.qtip.rendered<1||this.drawing)return this;var a,b,c,d,e=this.qtip.tooltip,f=this.qtip.options.style,g=this.qtip.options.position.container;return this.qtip.drawing=1,f.height&&e.css(J,f.height),f.width?e.css(I,f.width):(e.css(I,"").appendTo(this.redrawContainer),b=e.width(),1>b%2&&(b+=1),c=e.css("maxWidth")||"",d=e.css("minWidth")||"",a=(c+d).indexOf("%")>-1?g.width()/100:0,c=(c.indexOf("%")>-1?a:1*parseInt(c,10))||b,d=(d.indexOf("%")>-1?a:1*parseInt(d,10))||0,b=c+d?Math.min(Math.max(b,d),c):b,e.css(I,Math.round(b)).appendTo(g)),this.drawing=0,this},destroy:function(){this.bgiframe&&this.bgiframe.remove(),this.qtip._unbind([a,this.qtip.tooltip],this._ns)}}),Aa=R.ie6=function(a){return 6===da.ie?new x(a):E},Aa.initialize="render",B.ie6={"^content|style$":function(){this.redraw()}}})}(window,document);
5
5
  //# sourceMappingURL=jquery.qtip.min.map
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-qtip2-wrapper-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Dobert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-13 00:00:00.000000000 Z
11
+ date: 2016-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -47,10 +47,7 @@ extra_rdoc_files: []
47
47
  files:
48
48
  - lib/jquery/qtip2/wrapper/rails.rb
49
49
  - lib/jquery/qtip2/wrapper/rails/version.rb
50
- - vendor/assets/javascripts/jquery.qtip.js
51
50
  - vendor/assets/javascripts/jquery.qtip.min.js
52
- - vendor/assets/javascripts/jquery.qtip.min.map
53
- - vendor/assets/stylesheets/jquery.qtip.css
54
51
  - vendor/assets/stylesheets/jquery.qtip.min.css
55
52
  homepage: https://github.com/dondope/jquery-qtip2-wrapper-rails
56
53
  licenses:
@@ -72,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
69
  version: '0'
73
70
  requirements: []
74
71
  rubyforge_project:
75
- rubygems_version: 2.5.1
72
+ rubygems_version: 2.6.6
76
73
  signing_key:
77
74
  specification_version: 4
78
75
  summary: A simple asset wrapper for the qTip2 jQuery plugin.
@@ -1,3484 +0,0 @@
1
- /*
2
- * qTip2 - Pretty powerful tooltips - v3.0.2
3
- * http://qtip2.com
4
- *
5
- * Copyright (c) 2015
6
- * Released under the MIT licenses
7
- * http://jquery.org/license
8
- *
9
- * Date: Tue Dec 8 2015 07:16 GMT+0000
10
- * Plugins: tips modal viewport svg imagemap ie6
11
- * Styles: core basic css3
12
- */
13
- /*global window: false, jQuery: false, console: false, define: false */
14
-
15
- /* Cache window, document, undefined */
16
- (function( window, document, undefined ) {
17
-
18
- // Uses AMD or browser globals to create a jQuery plugin.
19
- (function( factory ) {
20
- "use strict";
21
- if(typeof define === 'function' && define.amd) {
22
- define(['jquery'], factory);
23
- }
24
- else if(jQuery && !jQuery.fn.qtip) {
25
- factory(jQuery);
26
- }
27
- }
28
- (function($) {
29
- "use strict"; // Enable ECMAScript "strict" operation for this function. See more: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/
30
- ;// Munge the primitives - Paul Irish tip
31
- var TRUE = true,
32
- FALSE = false,
33
- NULL = null,
34
-
35
- // Common variables
36
- X = 'x', Y = 'y',
37
- WIDTH = 'width',
38
- HEIGHT = 'height',
39
-
40
- // Positioning sides
41
- TOP = 'top',
42
- LEFT = 'left',
43
- BOTTOM = 'bottom',
44
- RIGHT = 'right',
45
- CENTER = 'center',
46
-
47
- // Position adjustment types
48
- FLIP = 'flip',
49
- FLIPINVERT = 'flipinvert',
50
- SHIFT = 'shift',
51
-
52
- // Shortcut vars
53
- QTIP, PROTOTYPE, CORNER, CHECKS,
54
- PLUGINS = {},
55
- NAMESPACE = 'qtip',
56
- ATTR_HAS = 'data-hasqtip',
57
- ATTR_ID = 'data-qtip-id',
58
- WIDGET = ['ui-widget', 'ui-tooltip'],
59
- SELECTOR = '.'+NAMESPACE,
60
- INACTIVE_EVENTS = 'click dblclick mousedown mouseup mousemove mouseleave mouseenter'.split(' '),
61
-
62
- CLASS_FIXED = NAMESPACE+'-fixed',
63
- CLASS_DEFAULT = NAMESPACE + '-default',
64
- CLASS_FOCUS = NAMESPACE + '-focus',
65
- CLASS_HOVER = NAMESPACE + '-hover',
66
- CLASS_DISABLED = NAMESPACE+'-disabled',
67
-
68
- replaceSuffix = '_replacedByqTip',
69
- oldtitle = 'oldtitle',
70
- trackingBound,
71
-
72
- // Browser detection
73
- BROWSER = {
74
- /*
75
- * IE version detection
76
- *
77
- * Adapted from: http://ajaxian.com/archives/attack-of-the-ie-conditional-comment
78
- * Credit to James Padolsey for the original implemntation!
79
- */
80
- ie: (function() {
81
- /* eslint-disable no-empty */
82
- var v, i;
83
- for (
84
- v = 4, i = document.createElement('div');
85
- (i.innerHTML = '<!--[if gt IE ' + v + ']><i></i><![endif]-->') && i.getElementsByTagName('i')[0];
86
- v+=1
87
- ) {}
88
- return v > 4 ? v : NaN;
89
- /* eslint-enable no-empty */
90
- })(),
91
-
92
- /*
93
- * iOS version detection
94
- */
95
- iOS: parseFloat(
96
- ('' + (/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent) || [0,''])[1])
97
- .replace('undefined', '3_2').replace('_', '.').replace('_', '')
98
- ) || FALSE
99
- };
100
- ;function QTip(target, options, id, attr) {
101
- // Elements and ID
102
- this.id = id;
103
- this.target = target;
104
- this.tooltip = NULL;
105
- this.elements = { target: target };
106
-
107
- // Internal constructs
108
- this._id = NAMESPACE + '-' + id;
109
- this.timers = { img: {} };
110
- this.options = options;
111
- this.plugins = {};
112
-
113
- // Cache object
114
- this.cache = {
115
- event: {},
116
- target: $(),
117
- disabled: FALSE,
118
- attr: attr,
119
- onTooltip: FALSE,
120
- lastClass: ''
121
- };
122
-
123
- // Set the initial flags
124
- this.rendered = this.destroyed = this.disabled = this.waiting =
125
- this.hiddenDuringWait = this.positioning = this.triggering = FALSE;
126
- }
127
- PROTOTYPE = QTip.prototype;
128
-
129
- PROTOTYPE._when = function(deferreds) {
130
- return $.when.apply($, deferreds);
131
- };
132
-
133
- PROTOTYPE.render = function(show) {
134
- if(this.rendered || this.destroyed) { return this; } // If tooltip has already been rendered, exit
135
-
136
- var self = this,
137
- options = this.options,
138
- cache = this.cache,
139
- elements = this.elements,
140
- text = options.content.text,
141
- title = options.content.title,
142
- button = options.content.button,
143
- posOptions = options.position,
144
- deferreds = [];
145
-
146
- // Add ARIA attributes to target
147
- $.attr(this.target[0], 'aria-describedby', this._id);
148
-
149
- // Create public position object that tracks current position corners
150
- cache.posClass = this._createPosClass(
151
- (this.position = { my: posOptions.my, at: posOptions.at }).my
152
- );
153
-
154
- // Create tooltip element
155
- this.tooltip = elements.tooltip = $('<div/>', {
156
- 'id': this._id,
157
- 'class': [ NAMESPACE, CLASS_DEFAULT, options.style.classes, cache.posClass ].join(' '),
158
- 'width': options.style.width || '',
159
- 'height': options.style.height || '',
160
- 'tracking': posOptions.target === 'mouse' && posOptions.adjust.mouse,
161
-
162
- /* ARIA specific attributes */
163
- 'role': 'alert',
164
- 'aria-live': 'polite',
165
- 'aria-atomic': FALSE,
166
- 'aria-describedby': this._id + '-content',
167
- 'aria-hidden': TRUE
168
- })
169
- .toggleClass(CLASS_DISABLED, this.disabled)
170
- .attr(ATTR_ID, this.id)
171
- .data(NAMESPACE, this)
172
- .appendTo(posOptions.container)
173
- .append(
174
- // Create content element
175
- elements.content = $('<div />', {
176
- 'class': NAMESPACE + '-content',
177
- 'id': this._id + '-content',
178
- 'aria-atomic': TRUE
179
- })
180
- );
181
-
182
- // Set rendered flag and prevent redundant reposition calls for now
183
- this.rendered = -1;
184
- this.positioning = TRUE;
185
-
186
- // Create title...
187
- if(title) {
188
- this._createTitle();
189
-
190
- // Update title only if its not a callback (called in toggle if so)
191
- if(!$.isFunction(title)) {
192
- deferreds.push( this._updateTitle(title, FALSE) );
193
- }
194
- }
195
-
196
- // Create button
197
- if(button) { this._createButton(); }
198
-
199
- // Set proper rendered flag and update content if not a callback function (called in toggle)
200
- if(!$.isFunction(text)) {
201
- deferreds.push( this._updateContent(text, FALSE) );
202
- }
203
- this.rendered = TRUE;
204
-
205
- // Setup widget classes
206
- this._setWidget();
207
-
208
- // Initialize 'render' plugins
209
- $.each(PLUGINS, function(name) {
210
- var instance;
211
- if(this.initialize === 'render' && (instance = this(self))) {
212
- self.plugins[name] = instance;
213
- }
214
- });
215
-
216
- // Unassign initial events and assign proper events
217
- this._unassignEvents();
218
- this._assignEvents();
219
-
220
- // When deferreds have completed
221
- this._when(deferreds).then(function() {
222
- // tooltiprender event
223
- self._trigger('render');
224
-
225
- // Reset flags
226
- self.positioning = FALSE;
227
-
228
- // Show tooltip if not hidden during wait period
229
- if(!self.hiddenDuringWait && (options.show.ready || show)) {
230
- self.toggle(TRUE, cache.event, FALSE);
231
- }
232
- self.hiddenDuringWait = FALSE;
233
- });
234
-
235
- // Expose API
236
- QTIP.api[this.id] = this;
237
-
238
- return this;
239
- };
240
-
241
- PROTOTYPE.destroy = function(immediate) {
242
- // Set flag the signify destroy is taking place to plugins
243
- // and ensure it only gets destroyed once!
244
- if(this.destroyed) { return this.target; }
245
-
246
- function process() {
247
- if(this.destroyed) { return; }
248
- this.destroyed = TRUE;
249
-
250
- var target = this.target,
251
- title = target.attr(oldtitle),
252
- timer;
253
-
254
- // Destroy tooltip if rendered
255
- if(this.rendered) {
256
- this.tooltip.stop(1,0).find('*').remove().end().remove();
257
- }
258
-
259
- // Destroy all plugins
260
- $.each(this.plugins, function() {
261
- this.destroy && this.destroy();
262
- });
263
-
264
- // Clear timers
265
- for (timer in this.timers) {
266
- if (this.timers.hasOwnProperty(timer)) {
267
- clearTimeout(this.timers[timer]);
268
- }
269
- }
270
-
271
- // Remove api object and ARIA attributes
272
- target.removeData(NAMESPACE)
273
- .removeAttr(ATTR_ID)
274
- .removeAttr(ATTR_HAS)
275
- .removeAttr('aria-describedby');
276
-
277
- // Reset old title attribute if removed
278
- if(this.options.suppress && title) {
279
- target.attr('title', title).removeAttr(oldtitle);
280
- }
281
-
282
- // Remove qTip events associated with this API
283
- this._unassignEvents();
284
-
285
- // Remove ID from used id objects, and delete object references
286
- // for better garbage collection and leak protection
287
- this.options = this.elements = this.cache = this.timers =
288
- this.plugins = this.mouse = NULL;
289
-
290
- // Delete epoxsed API object
291
- delete QTIP.api[this.id];
292
- }
293
-
294
- // If an immediate destroy is needed
295
- if((immediate !== TRUE || this.triggering === 'hide') && this.rendered) {
296
- this.tooltip.one('tooltiphidden', $.proxy(process, this));
297
- !this.triggering && this.hide();
298
- }
299
-
300
- // If we're not in the process of hiding... process
301
- else { process.call(this); }
302
-
303
- return this.target;
304
- };
305
- ;function invalidOpt(a) {
306
- return a === NULL || $.type(a) !== 'object';
307
- }
308
-
309
- function invalidContent(c) {
310
- return !($.isFunction(c) || c && c.attr) || c.length || $.type(c) === 'object' && (c.jquery || c.then);
311
- }
312
-
313
- // Option object sanitizer
314
- function sanitizeOptions(opts) {
315
- var content, text, ajax, once;
316
-
317
- if(invalidOpt(opts)) { return FALSE; }
318
-
319
- if(invalidOpt(opts.metadata)) {
320
- opts.metadata = { type: opts.metadata };
321
- }
322
-
323
- if('content' in opts) {
324
- content = opts.content;
325
-
326
- if(invalidOpt(content) || content.jquery || content.done) {
327
- text = invalidContent(content) ? FALSE : content;
328
- content = opts.content = {
329
- text: text
330
- };
331
- }
332
- else { text = content.text; }
333
-
334
- // DEPRECATED - Old content.ajax plugin functionality
335
- // Converts it into the proper Deferred syntax
336
- if('ajax' in content) {
337
- ajax = content.ajax;
338
- once = ajax && ajax.once !== FALSE;
339
- delete content.ajax;
340
-
341
- content.text = function(event, api) {
342
- var loading = text || $(this).attr(api.options.content.attr) || 'Loading...',
343
-
344
- deferred = $.ajax(
345
- $.extend({}, ajax, { context: api })
346
- )
347
- .then(ajax.success, NULL, ajax.error)
348
- .then(function(newContent) {
349
- if(newContent && once) { api.set('content.text', newContent); }
350
- return newContent;
351
- },
352
- function(xhr, status, error) {
353
- if(api.destroyed || xhr.status === 0) { return; }
354
- api.set('content.text', status + ': ' + error);
355
- });
356
-
357
- return !once ? (api.set('content.text', loading), deferred) : loading;
358
- };
359
- }
360
-
361
- if('title' in content) {
362
- if($.isPlainObject(content.title)) {
363
- content.button = content.title.button;
364
- content.title = content.title.text;
365
- }
366
-
367
- if(invalidContent(content.title || FALSE)) {
368
- content.title = FALSE;
369
- }
370
- }
371
- }
372
-
373
- if('position' in opts && invalidOpt(opts.position)) {
374
- opts.position = { my: opts.position, at: opts.position };
375
- }
376
-
377
- if('show' in opts && invalidOpt(opts.show)) {
378
- opts.show = opts.show.jquery ? { target: opts.show } :
379
- opts.show === TRUE ? { ready: TRUE } : { event: opts.show };
380
- }
381
-
382
- if('hide' in opts && invalidOpt(opts.hide)) {
383
- opts.hide = opts.hide.jquery ? { target: opts.hide } : { event: opts.hide };
384
- }
385
-
386
- if('style' in opts && invalidOpt(opts.style)) {
387
- opts.style = { classes: opts.style };
388
- }
389
-
390
- // Sanitize plugin options
391
- $.each(PLUGINS, function() {
392
- this.sanitize && this.sanitize(opts);
393
- });
394
-
395
- return opts;
396
- }
397
-
398
- // Setup builtin .set() option checks
399
- CHECKS = PROTOTYPE.checks = {
400
- builtin: {
401
- // Core checks
402
- '^id$': function(obj, o, v, prev) {
403
- var id = v === TRUE ? QTIP.nextid : v,
404
- newId = NAMESPACE + '-' + id;
405
-
406
- if(id !== FALSE && id.length > 0 && !$('#'+newId).length) {
407
- this._id = newId;
408
-
409
- if(this.rendered) {
410
- this.tooltip[0].id = this._id;
411
- this.elements.content[0].id = this._id + '-content';
412
- this.elements.title[0].id = this._id + '-title';
413
- }
414
- }
415
- else { obj[o] = prev; }
416
- },
417
- '^prerender': function(obj, o, v) {
418
- v && !this.rendered && this.render(this.options.show.ready);
419
- },
420
-
421
- // Content checks
422
- '^content.text$': function(obj, o, v) {
423
- this._updateContent(v);
424
- },
425
- '^content.attr$': function(obj, o, v, prev) {
426
- if(this.options.content.text === this.target.attr(prev)) {
427
- this._updateContent( this.target.attr(v) );
428
- }
429
- },
430
- '^content.title$': function(obj, o, v) {
431
- // Remove title if content is null
432
- if(!v) { return this._removeTitle(); }
433
-
434
- // If title isn't already created, create it now and update
435
- v && !this.elements.title && this._createTitle();
436
- this._updateTitle(v);
437
- },
438
- '^content.button$': function(obj, o, v) {
439
- this._updateButton(v);
440
- },
441
- '^content.title.(text|button)$': function(obj, o, v) {
442
- this.set('content.'+o, v); // Backwards title.text/button compat
443
- },
444
-
445
- // Position checks
446
- '^position.(my|at)$': function(obj, o, v){
447
- if('string' === typeof v) {
448
- this.position[o] = obj[o] = new CORNER(v, o === 'at');
449
- }
450
- },
451
- '^position.container$': function(obj, o, v){
452
- this.rendered && this.tooltip.appendTo(v);
453
- },
454
-
455
- // Show checks
456
- '^show.ready$': function(obj, o, v) {
457
- v && (!this.rendered && this.render(TRUE) || this.toggle(TRUE));
458
- },
459
-
460
- // Style checks
461
- '^style.classes$': function(obj, o, v, p) {
462
- this.rendered && this.tooltip.removeClass(p).addClass(v);
463
- },
464
- '^style.(width|height)': function(obj, o, v) {
465
- this.rendered && this.tooltip.css(o, v);
466
- },
467
- '^style.widget|content.title': function() {
468
- this.rendered && this._setWidget();
469
- },
470
- '^style.def': function(obj, o, v) {
471
- this.rendered && this.tooltip.toggleClass(CLASS_DEFAULT, !!v);
472
- },
473
-
474
- // Events check
475
- '^events.(render|show|move|hide|focus|blur)$': function(obj, o, v) {
476
- this.rendered && this.tooltip[($.isFunction(v) ? '' : 'un') + 'bind']('tooltip'+o, v);
477
- },
478
-
479
- // Properties which require event reassignment
480
- '^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)': function() {
481
- if(!this.rendered) { return; }
482
-
483
- // Set tracking flag
484
- var posOptions = this.options.position;
485
- this.tooltip.attr('tracking', posOptions.target === 'mouse' && posOptions.adjust.mouse);
486
-
487
- // Reassign events
488
- this._unassignEvents();
489
- this._assignEvents();
490
- }
491
- }
492
- };
493
-
494
- // Dot notation converter
495
- function convertNotation(options, notation) {
496
- var i = 0, obj, option = options,
497
-
498
- // Split notation into array
499
- levels = notation.split('.');
500
-
501
- // Loop through
502
- while(option = option[ levels[i++] ]) {
503
- if(i < levels.length) { obj = option; }
504
- }
505
-
506
- return [obj || options, levels.pop()];
507
- }
508
-
509
- PROTOTYPE.get = function(notation) {
510
- if(this.destroyed) { return this; }
511
-
512
- var o = convertNotation(this.options, notation.toLowerCase()),
513
- result = o[0][ o[1] ];
514
-
515
- return result.precedance ? result.string() : result;
516
- };
517
-
518
- function setCallback(notation, args) {
519
- var category, rule, match;
520
-
521
- for(category in this.checks) {
522
- if (!this.checks.hasOwnProperty(category)) { continue; }
523
-
524
- for(rule in this.checks[category]) {
525
- if (!this.checks[category].hasOwnProperty(rule)) { continue; }
526
-
527
- if(match = (new RegExp(rule, 'i')).exec(notation)) {
528
- args.push(match);
529
-
530
- if(category === 'builtin' || this.plugins[category]) {
531
- this.checks[category][rule].apply(
532
- this.plugins[category] || this, args
533
- );
534
- }
535
- }
536
- }
537
- }
538
- }
539
-
540
- var rmove = /^position\.(my|at|adjust|target|container|viewport)|style|content|show\.ready/i,
541
- rrender = /^prerender|show\.ready/i;
542
-
543
- PROTOTYPE.set = function(option, value) {
544
- if(this.destroyed) { return this; }
545
-
546
- var rendered = this.rendered,
547
- reposition = FALSE,
548
- options = this.options,
549
- name;
550
-
551
- // Convert singular option/value pair into object form
552
- if('string' === typeof option) {
553
- name = option; option = {}; option[name] = value;
554
- }
555
- else { option = $.extend({}, option); }
556
-
557
- // Set all of the defined options to their new values
558
- $.each(option, function(notation, val) {
559
- if(rendered && rrender.test(notation)) {
560
- delete option[notation]; return;
561
- }
562
-
563
- // Set new obj value
564
- var obj = convertNotation(options, notation.toLowerCase()), previous;
565
- previous = obj[0][ obj[1] ];
566
- obj[0][ obj[1] ] = val && val.nodeType ? $(val) : val;
567
-
568
- // Also check if we need to reposition
569
- reposition = rmove.test(notation) || reposition;
570
-
571
- // Set the new params for the callback
572
- option[notation] = [obj[0], obj[1], val, previous];
573
- });
574
-
575
- // Re-sanitize options
576
- sanitizeOptions(options);
577
-
578
- /*
579
- * Execute any valid callbacks for the set options
580
- * Also set positioning flag so we don't get loads of redundant repositioning calls.
581
- */
582
- this.positioning = TRUE;
583
- $.each(option, $.proxy(setCallback, this));
584
- this.positioning = FALSE;
585
-
586
- // Update position if needed
587
- if(this.rendered && this.tooltip[0].offsetWidth > 0 && reposition) {
588
- this.reposition( options.position.target === 'mouse' ? NULL : this.cache.event );
589
- }
590
-
591
- return this;
592
- };
593
- ;PROTOTYPE._update = function(content, element) {
594
- var self = this,
595
- cache = this.cache;
596
-
597
- // Make sure tooltip is rendered and content is defined. If not return
598
- if(!this.rendered || !content) { return FALSE; }
599
-
600
- // Use function to parse content
601
- if($.isFunction(content)) {
602
- content = content.call(this.elements.target, cache.event, this) || '';
603
- }
604
-
605
- // Handle deferred content
606
- if($.isFunction(content.then)) {
607
- cache.waiting = TRUE;
608
- return content.then(function(c) {
609
- cache.waiting = FALSE;
610
- return self._update(c, element);
611
- }, NULL, function(e) {
612
- return self._update(e, element);
613
- });
614
- }
615
-
616
- // If content is null... return false
617
- if(content === FALSE || !content && content !== '') { return FALSE; }
618
-
619
- // Append new content if its a DOM array and show it if hidden
620
- if(content.jquery && content.length > 0) {
621
- element.empty().append(
622
- content.css({ display: 'block', visibility: 'visible' })
623
- );
624
- }
625
-
626
- // Content is a regular string, insert the new content
627
- else { element.html(content); }
628
-
629
- // Wait for content to be loaded, and reposition
630
- return this._waitForContent(element).then(function(images) {
631
- if(self.rendered && self.tooltip[0].offsetWidth > 0) {
632
- self.reposition(cache.event, !images.length);
633
- }
634
- });
635
- };
636
-
637
- PROTOTYPE._waitForContent = function(element) {
638
- var cache = this.cache;
639
-
640
- // Set flag
641
- cache.waiting = TRUE;
642
-
643
- // If imagesLoaded is included, ensure images have loaded and return promise
644
- return ( $.fn.imagesLoaded ? element.imagesLoaded() : new $.Deferred().resolve([]) )
645
- .done(function() { cache.waiting = FALSE; })
646
- .promise();
647
- };
648
-
649
- PROTOTYPE._updateContent = function(content, reposition) {
650
- this._update(content, this.elements.content, reposition);
651
- };
652
-
653
- PROTOTYPE._updateTitle = function(content, reposition) {
654
- if(this._update(content, this.elements.title, reposition) === FALSE) {
655
- this._removeTitle(FALSE);
656
- }
657
- };
658
-
659
- PROTOTYPE._createTitle = function()
660
- {
661
- var elements = this.elements,
662
- id = this._id+'-title';
663
-
664
- // Destroy previous title element, if present
665
- if(elements.titlebar) { this._removeTitle(); }
666
-
667
- // Create title bar and title elements
668
- elements.titlebar = $('<div />', {
669
- 'class': NAMESPACE + '-titlebar ' + (this.options.style.widget ? createWidgetClass('header') : '')
670
- })
671
- .append(
672
- elements.title = $('<div />', {
673
- 'id': id,
674
- 'class': NAMESPACE + '-title',
675
- 'aria-atomic': TRUE
676
- })
677
- )
678
- .insertBefore(elements.content)
679
-
680
- // Button-specific events
681
- .delegate('.qtip-close', 'mousedown keydown mouseup keyup mouseout', function(event) {
682
- $(this).toggleClass('ui-state-active ui-state-focus', event.type.substr(-4) === 'down');
683
- })
684
- .delegate('.qtip-close', 'mouseover mouseout', function(event){
685
- $(this).toggleClass('ui-state-hover', event.type === 'mouseover');
686
- });
687
-
688
- // Create button if enabled
689
- if(this.options.content.button) { this._createButton(); }
690
- };
691
-
692
- PROTOTYPE._removeTitle = function(reposition)
693
- {
694
- var elements = this.elements;
695
-
696
- if(elements.title) {
697
- elements.titlebar.remove();
698
- elements.titlebar = elements.title = elements.button = NULL;
699
-
700
- // Reposition if enabled
701
- if(reposition !== FALSE) { this.reposition(); }
702
- }
703
- };
704
- ;PROTOTYPE._createPosClass = function(my) {
705
- return NAMESPACE + '-pos-' + (my || this.options.position.my).abbrev();
706
- };
707
-
708
- PROTOTYPE.reposition = function(event, effect) {
709
- if(!this.rendered || this.positioning || this.destroyed) { return this; }
710
-
711
- // Set positioning flag
712
- this.positioning = TRUE;
713
-
714
- var cache = this.cache,
715
- tooltip = this.tooltip,
716
- posOptions = this.options.position,
717
- target = posOptions.target,
718
- my = posOptions.my,
719
- at = posOptions.at,
720
- viewport = posOptions.viewport,
721
- container = posOptions.container,
722
- adjust = posOptions.adjust,
723
- method = adjust.method.split(' '),
724
- tooltipWidth = tooltip.outerWidth(FALSE),
725
- tooltipHeight = tooltip.outerHeight(FALSE),
726
- targetWidth = 0,
727
- targetHeight = 0,
728
- type = tooltip.css('position'),
729
- position = { left: 0, top: 0 },
730
- visible = tooltip[0].offsetWidth > 0,
731
- isScroll = event && event.type === 'scroll',
732
- win = $(window),
733
- doc = container[0].ownerDocument,
734
- mouse = this.mouse,
735
- pluginCalculations, offset, adjusted, newClass;
736
-
737
- // Check if absolute position was passed
738
- if($.isArray(target) && target.length === 2) {
739
- // Force left top and set position
740
- at = { x: LEFT, y: TOP };
741
- position = { left: target[0], top: target[1] };
742
- }
743
-
744
- // Check if mouse was the target
745
- else if(target === 'mouse') {
746
- // Force left top to allow flipping
747
- at = { x: LEFT, y: TOP };
748
-
749
- // Use the mouse origin that caused the show event, if distance hiding is enabled
750
- if((!adjust.mouse || this.options.hide.distance) && cache.origin && cache.origin.pageX) {
751
- event = cache.origin;
752
- }
753
-
754
- // Use cached event for resize/scroll events
755
- else if(!event || event && (event.type === 'resize' || event.type === 'scroll')) {
756
- event = cache.event;
757
- }
758
-
759
- // Otherwise, use the cached mouse coordinates if available
760
- else if(mouse && mouse.pageX) {
761
- event = mouse;
762
- }
763
-
764
- // Calculate body and container offset and take them into account below
765
- if(type !== 'static') { position = container.offset(); }
766
- if(doc.body.offsetWidth !== (window.innerWidth || doc.documentElement.clientWidth)) {
767
- offset = $(document.body).offset();
768
- }
769
-
770
- // Use event coordinates for position
771
- position = {
772
- left: event.pageX - position.left + (offset && offset.left || 0),
773
- top: event.pageY - position.top + (offset && offset.top || 0)
774
- };
775
-
776
- // Scroll events are a pain, some browsers
777
- if(adjust.mouse && isScroll && mouse) {
778
- position.left -= (mouse.scrollX || 0) - win.scrollLeft();
779
- position.top -= (mouse.scrollY || 0) - win.scrollTop();
780
- }
781
- }
782
-
783
- // Target wasn't mouse or absolute...
784
- else {
785
- // Check if event targetting is being used
786
- if(target === 'event') {
787
- if(event && event.target && event.type !== 'scroll' && event.type !== 'resize') {
788
- cache.target = $(event.target);
789
- }
790
- else if(!event.target) {
791
- cache.target = this.elements.target;
792
- }
793
- }
794
- else if(target !== 'event'){
795
- cache.target = $(target.jquery ? target : this.elements.target);
796
- }
797
- target = cache.target;
798
-
799
- // Parse the target into a jQuery object and make sure there's an element present
800
- target = $(target).eq(0);
801
- if(target.length === 0) { return this; }
802
-
803
- // Check if window or document is the target
804
- else if(target[0] === document || target[0] === window) {
805
- targetWidth = BROWSER.iOS ? window.innerWidth : target.width();
806
- targetHeight = BROWSER.iOS ? window.innerHeight : target.height();
807
-
808
- if(target[0] === window) {
809
- position = {
810
- top: (viewport || target).scrollTop(),
811
- left: (viewport || target).scrollLeft()
812
- };
813
- }
814
- }
815
-
816
- // Check if the target is an <AREA> element
817
- else if(PLUGINS.imagemap && target.is('area')) {
818
- pluginCalculations = PLUGINS.imagemap(this, target, at, PLUGINS.viewport ? method : FALSE);
819
- }
820
-
821
- // Check if the target is an SVG element
822
- else if(PLUGINS.svg && target && target[0].ownerSVGElement) {
823
- pluginCalculations = PLUGINS.svg(this, target, at, PLUGINS.viewport ? method : FALSE);
824
- }
825
-
826
- // Otherwise use regular jQuery methods
827
- else {
828
- targetWidth = target.outerWidth(FALSE);
829
- targetHeight = target.outerHeight(FALSE);
830
- position = target.offset();
831
- }
832
-
833
- // Parse returned plugin values into proper variables
834
- if(pluginCalculations) {
835
- targetWidth = pluginCalculations.width;
836
- targetHeight = pluginCalculations.height;
837
- offset = pluginCalculations.offset;
838
- position = pluginCalculations.position;
839
- }
840
-
841
- // Adjust position to take into account offset parents
842
- position = this.reposition.offset(target, position, container);
843
-
844
- // Adjust for position.fixed tooltips (and also iOS scroll bug in v3.2-4.0 & v4.3-4.3.2)
845
- if(BROWSER.iOS > 3.1 && BROWSER.iOS < 4.1 ||
846
- BROWSER.iOS >= 4.3 && BROWSER.iOS < 4.33 ||
847
- !BROWSER.iOS && type === 'fixed'
848
- ){
849
- position.left -= win.scrollLeft();
850
- position.top -= win.scrollTop();
851
- }
852
-
853
- // Adjust position relative to target
854
- if(!pluginCalculations || pluginCalculations && pluginCalculations.adjustable !== FALSE) {
855
- position.left += at.x === RIGHT ? targetWidth : at.x === CENTER ? targetWidth / 2 : 0;
856
- position.top += at.y === BOTTOM ? targetHeight : at.y === CENTER ? targetHeight / 2 : 0;
857
- }
858
- }
859
-
860
- // Adjust position relative to tooltip
861
- position.left += adjust.x + (my.x === RIGHT ? -tooltipWidth : my.x === CENTER ? -tooltipWidth / 2 : 0);
862
- position.top += adjust.y + (my.y === BOTTOM ? -tooltipHeight : my.y === CENTER ? -tooltipHeight / 2 : 0);
863
-
864
- // Use viewport adjustment plugin if enabled
865
- if(PLUGINS.viewport) {
866
- adjusted = position.adjusted = PLUGINS.viewport(
867
- this, position, posOptions, targetWidth, targetHeight, tooltipWidth, tooltipHeight
868
- );
869
-
870
- // Apply offsets supplied by positioning plugin (if used)
871
- if(offset && adjusted.left) { position.left += offset.left; }
872
- if(offset && adjusted.top) { position.top += offset.top; }
873
-
874
- // Apply any new 'my' position
875
- if(adjusted.my) { this.position.my = adjusted.my; }
876
- }
877
-
878
- // Viewport adjustment is disabled, set values to zero
879
- else { position.adjusted = { left: 0, top: 0 }; }
880
-
881
- // Set tooltip position class if it's changed
882
- if(cache.posClass !== (newClass = this._createPosClass(this.position.my))) {
883
- cache.posClass = newClass;
884
- tooltip.removeClass(cache.posClass).addClass(newClass);
885
- }
886
-
887
- // tooltipmove event
888
- if(!this._trigger('move', [position, viewport.elem || viewport], event)) { return this; }
889
- delete position.adjusted;
890
-
891
- // If effect is disabled, target it mouse, no animation is defined or positioning gives NaN out, set CSS directly
892
- if(effect === FALSE || !visible || isNaN(position.left) || isNaN(position.top) || target === 'mouse' || !$.isFunction(posOptions.effect)) {
893
- tooltip.css(position);
894
- }
895
-
896
- // Use custom function if provided
897
- else if($.isFunction(posOptions.effect)) {
898
- posOptions.effect.call(tooltip, this, $.extend({}, position));
899
- tooltip.queue(function(next) {
900
- // Reset attributes to avoid cross-browser rendering bugs
901
- $(this).css({ opacity: '', height: '' });
902
- if(BROWSER.ie) { this.style.removeAttribute('filter'); }
903
-
904
- next();
905
- });
906
- }
907
-
908
- // Set positioning flag
909
- this.positioning = FALSE;
910
-
911
- return this;
912
- };
913
-
914
- // Custom (more correct for qTip!) offset calculator
915
- PROTOTYPE.reposition.offset = function(elem, pos, container) {
916
- if(!container[0]) { return pos; }
917
-
918
- var ownerDocument = $(elem[0].ownerDocument),
919
- quirks = !!BROWSER.ie && document.compatMode !== 'CSS1Compat',
920
- parent = container[0],
921
- scrolled, position, parentOffset, overflow;
922
-
923
- function scroll(e, i) {
924
- pos.left += i * e.scrollLeft();
925
- pos.top += i * e.scrollTop();
926
- }
927
-
928
- // Compensate for non-static containers offset
929
- do {
930
- if((position = $.css(parent, 'position')) !== 'static') {
931
- if(position === 'fixed') {
932
- parentOffset = parent.getBoundingClientRect();
933
- scroll(ownerDocument, -1);
934
- }
935
- else {
936
- parentOffset = $(parent).position();
937
- parentOffset.left += parseFloat($.css(parent, 'borderLeftWidth')) || 0;
938
- parentOffset.top += parseFloat($.css(parent, 'borderTopWidth')) || 0;
939
- }
940
-
941
- pos.left -= parentOffset.left + (parseFloat($.css(parent, 'marginLeft')) || 0);
942
- pos.top -= parentOffset.top + (parseFloat($.css(parent, 'marginTop')) || 0);
943
-
944
- // If this is the first parent element with an overflow of "scroll" or "auto", store it
945
- if(!scrolled && (overflow = $.css(parent, 'overflow')) !== 'hidden' && overflow !== 'visible') { scrolled = $(parent); }
946
- }
947
- }
948
- while(parent = parent.offsetParent);
949
-
950
- // Compensate for containers scroll if it also has an offsetParent (or in IE quirks mode)
951
- if(scrolled && (scrolled[0] !== ownerDocument[0] || quirks)) {
952
- scroll(scrolled, 1);
953
- }
954
-
955
- return pos;
956
- };
957
-
958
- // Corner class
959
- var C = (CORNER = PROTOTYPE.reposition.Corner = function(corner, forceY) {
960
- corner = ('' + corner).replace(/([A-Z])/, ' $1').replace(/middle/gi, CENTER).toLowerCase();
961
- this.x = (corner.match(/left|right/i) || corner.match(/center/) || ['inherit'])[0].toLowerCase();
962
- this.y = (corner.match(/top|bottom|center/i) || ['inherit'])[0].toLowerCase();
963
- this.forceY = !!forceY;
964
-
965
- var f = corner.charAt(0);
966
- this.precedance = f === 't' || f === 'b' ? Y : X;
967
- }).prototype;
968
-
969
- C.invert = function(z, center) {
970
- this[z] = this[z] === LEFT ? RIGHT : this[z] === RIGHT ? LEFT : center || this[z];
971
- };
972
-
973
- C.string = function(join) {
974
- var x = this.x, y = this.y;
975
-
976
- var result = x !== y ?
977
- x === 'center' || y !== 'center' && (this.precedance === Y || this.forceY) ?
978
- [y,x] :
979
- [x,y] :
980
- [x];
981
-
982
- return join !== false ? result.join(' ') : result;
983
- };
984
-
985
- C.abbrev = function() {
986
- var result = this.string(false);
987
- return result[0].charAt(0) + (result[1] && result[1].charAt(0) || '');
988
- };
989
-
990
- C.clone = function() {
991
- return new CORNER( this.string(), this.forceY );
992
- };
993
-
994
- ;
995
- PROTOTYPE.toggle = function(state, event) {
996
- var cache = this.cache,
997
- options = this.options,
998
- tooltip = this.tooltip;
999
-
1000
- // Try to prevent flickering when tooltip overlaps show element
1001
- if(event) {
1002
- if((/over|enter/).test(event.type) && cache.event && (/out|leave/).test(cache.event.type) &&
1003
- options.show.target.add(event.target).length === options.show.target.length &&
1004
- tooltip.has(event.relatedTarget).length) {
1005
- return this;
1006
- }
1007
-
1008
- // Cache event
1009
- cache.event = $.event.fix(event);
1010
- }
1011
-
1012
- // If we're currently waiting and we've just hidden... stop it
1013
- this.waiting && !state && (this.hiddenDuringWait = TRUE);
1014
-
1015
- // Render the tooltip if showing and it isn't already
1016
- if(!this.rendered) { return state ? this.render(1) : this; }
1017
- else if(this.destroyed || this.disabled) { return this; }
1018
-
1019
- var type = state ? 'show' : 'hide',
1020
- opts = this.options[type],
1021
- posOptions = this.options.position,
1022
- contentOptions = this.options.content,
1023
- width = this.tooltip.css('width'),
1024
- visible = this.tooltip.is(':visible'),
1025
- animate = state || opts.target.length === 1,
1026
- sameTarget = !event || opts.target.length < 2 || cache.target[0] === event.target,
1027
- identicalState, allow, after;
1028
-
1029
- // Detect state if valid one isn't provided
1030
- if((typeof state).search('boolean|number')) { state = !visible; }
1031
-
1032
- // Check if the tooltip is in an identical state to the new would-be state
1033
- identicalState = !tooltip.is(':animated') && visible === state && sameTarget;
1034
-
1035
- // Fire tooltip(show/hide) event and check if destroyed
1036
- allow = !identicalState ? !!this._trigger(type, [90]) : NULL;
1037
-
1038
- // Check to make sure the tooltip wasn't destroyed in the callback
1039
- if(this.destroyed) { return this; }
1040
-
1041
- // If the user didn't stop the method prematurely and we're showing the tooltip, focus it
1042
- if(allow !== FALSE && state) { this.focus(event); }
1043
-
1044
- // If the state hasn't changed or the user stopped it, return early
1045
- if(!allow || identicalState) { return this; }
1046
-
1047
- // Set ARIA hidden attribute
1048
- $.attr(tooltip[0], 'aria-hidden', !!!state);
1049
-
1050
- // Execute state specific properties
1051
- if(state) {
1052
- // Store show origin coordinates
1053
- this.mouse && (cache.origin = $.event.fix(this.mouse));
1054
-
1055
- // Update tooltip content & title if it's a dynamic function
1056
- if($.isFunction(contentOptions.text)) { this._updateContent(contentOptions.text, FALSE); }
1057
- if($.isFunction(contentOptions.title)) { this._updateTitle(contentOptions.title, FALSE); }
1058
-
1059
- // Cache mousemove events for positioning purposes (if not already tracking)
1060
- if(!trackingBound && posOptions.target === 'mouse' && posOptions.adjust.mouse) {
1061
- $(document).bind('mousemove.'+NAMESPACE, this._storeMouse);
1062
- trackingBound = TRUE;
1063
- }
1064
-
1065
- // Update the tooltip position (set width first to prevent viewport/max-width issues)
1066
- if(!width) { tooltip.css('width', tooltip.outerWidth(FALSE)); }
1067
- this.reposition(event, arguments[2]);
1068
- if(!width) { tooltip.css('width', ''); }
1069
-
1070
- // Hide other tooltips if tooltip is solo
1071
- if(!!opts.solo) {
1072
- (typeof opts.solo === 'string' ? $(opts.solo) : $(SELECTOR, opts.solo))
1073
- .not(tooltip).not(opts.target).qtip('hide', new $.Event('tooltipsolo'));
1074
- }
1075
- }
1076
- else {
1077
- // Clear show timer if we're hiding
1078
- clearTimeout(this.timers.show);
1079
-
1080
- // Remove cached origin on hide
1081
- delete cache.origin;
1082
-
1083
- // Remove mouse tracking event if not needed (all tracking qTips are hidden)
1084
- if(trackingBound && !$(SELECTOR+'[tracking="true"]:visible', opts.solo).not(tooltip).length) {
1085
- $(document).unbind('mousemove.'+NAMESPACE);
1086
- trackingBound = FALSE;
1087
- }
1088
-
1089
- // Blur the tooltip
1090
- this.blur(event);
1091
- }
1092
-
1093
- // Define post-animation, state specific properties
1094
- after = $.proxy(function() {
1095
- if(state) {
1096
- // Prevent antialias from disappearing in IE by removing filter
1097
- if(BROWSER.ie) { tooltip[0].style.removeAttribute('filter'); }
1098
-
1099
- // Remove overflow setting to prevent tip bugs
1100
- tooltip.css('overflow', '');
1101
-
1102
- // Autofocus elements if enabled
1103
- if('string' === typeof opts.autofocus) {
1104
- $(this.options.show.autofocus, tooltip).focus();
1105
- }
1106
-
1107
- // If set, hide tooltip when inactive for delay period
1108
- this.options.show.target.trigger('qtip-'+this.id+'-inactive');
1109
- }
1110
- else {
1111
- // Reset CSS states
1112
- tooltip.css({
1113
- display: '',
1114
- visibility: '',
1115
- opacity: '',
1116
- left: '',
1117
- top: ''
1118
- });
1119
- }
1120
-
1121
- // tooltipvisible/tooltiphidden events
1122
- this._trigger(state ? 'visible' : 'hidden');
1123
- }, this);
1124
-
1125
- // If no effect type is supplied, use a simple toggle
1126
- if(opts.effect === FALSE || animate === FALSE) {
1127
- tooltip[ type ]();
1128
- after();
1129
- }
1130
-
1131
- // Use custom function if provided
1132
- else if($.isFunction(opts.effect)) {
1133
- tooltip.stop(1, 1);
1134
- opts.effect.call(tooltip, this);
1135
- tooltip.queue('fx', function(n) {
1136
- after(); n();
1137
- });
1138
- }
1139
-
1140
- // Use basic fade function by default
1141
- else { tooltip.fadeTo(90, state ? 1 : 0, after); }
1142
-
1143
- // If inactive hide method is set, active it
1144
- if(state) { opts.target.trigger('qtip-'+this.id+'-inactive'); }
1145
-
1146
- return this;
1147
- };
1148
-
1149
- PROTOTYPE.show = function(event) { return this.toggle(TRUE, event); };
1150
-
1151
- PROTOTYPE.hide = function(event) { return this.toggle(FALSE, event); };
1152
- ;PROTOTYPE.focus = function(event) {
1153
- if(!this.rendered || this.destroyed) { return this; }
1154
-
1155
- var qtips = $(SELECTOR),
1156
- tooltip = this.tooltip,
1157
- curIndex = parseInt(tooltip[0].style.zIndex, 10),
1158
- newIndex = QTIP.zindex + qtips.length;
1159
-
1160
- // Only update the z-index if it has changed and tooltip is not already focused
1161
- if(!tooltip.hasClass(CLASS_FOCUS)) {
1162
- // tooltipfocus event
1163
- if(this._trigger('focus', [newIndex], event)) {
1164
- // Only update z-index's if they've changed
1165
- if(curIndex !== newIndex) {
1166
- // Reduce our z-index's and keep them properly ordered
1167
- qtips.each(function() {
1168
- if(this.style.zIndex > curIndex) {
1169
- this.style.zIndex = this.style.zIndex - 1;
1170
- }
1171
- });
1172
-
1173
- // Fire blur event for focused tooltip
1174
- qtips.filter('.' + CLASS_FOCUS).qtip('blur', event);
1175
- }
1176
-
1177
- // Set the new z-index
1178
- tooltip.addClass(CLASS_FOCUS)[0].style.zIndex = newIndex;
1179
- }
1180
- }
1181
-
1182
- return this;
1183
- };
1184
-
1185
- PROTOTYPE.blur = function(event) {
1186
- if(!this.rendered || this.destroyed) { return this; }
1187
-
1188
- // Set focused status to FALSE
1189
- this.tooltip.removeClass(CLASS_FOCUS);
1190
-
1191
- // tooltipblur event
1192
- this._trigger('blur', [ this.tooltip.css('zIndex') ], event);
1193
-
1194
- return this;
1195
- };
1196
- ;PROTOTYPE.disable = function(state) {
1197
- if(this.destroyed) { return this; }
1198
-
1199
- // If 'toggle' is passed, toggle the current state
1200
- if(state === 'toggle') {
1201
- state = !(this.rendered ? this.tooltip.hasClass(CLASS_DISABLED) : this.disabled);
1202
- }
1203
-
1204
- // Disable if no state passed
1205
- else if('boolean' !== typeof state) {
1206
- state = TRUE;
1207
- }
1208
-
1209
- if(this.rendered) {
1210
- this.tooltip.toggleClass(CLASS_DISABLED, state)
1211
- .attr('aria-disabled', state);
1212
- }
1213
-
1214
- this.disabled = !!state;
1215
-
1216
- return this;
1217
- };
1218
-
1219
- PROTOTYPE.enable = function() { return this.disable(FALSE); };
1220
- ;PROTOTYPE._createButton = function()
1221
- {
1222
- var self = this,
1223
- elements = this.elements,
1224
- tooltip = elements.tooltip,
1225
- button = this.options.content.button,
1226
- isString = typeof button === 'string',
1227
- close = isString ? button : 'Close tooltip';
1228
-
1229
- if(elements.button) { elements.button.remove(); }
1230
-
1231
- // Use custom button if one was supplied by user, else use default
1232
- if(button.jquery) {
1233
- elements.button = button;
1234
- }
1235
- else {
1236
- elements.button = $('<a />', {
1237
- 'class': 'qtip-close ' + (this.options.style.widget ? '' : NAMESPACE+'-icon'),
1238
- 'title': close,
1239
- 'aria-label': close
1240
- })
1241
- .prepend(
1242
- $('<span />', {
1243
- 'class': 'ui-icon ui-icon-close',
1244
- 'html': '&times;'
1245
- })
1246
- );
1247
- }
1248
-
1249
- // Create button and setup attributes
1250
- elements.button.appendTo(elements.titlebar || tooltip)
1251
- .attr('role', 'button')
1252
- .click(function(event) {
1253
- if(!tooltip.hasClass(CLASS_DISABLED)) { self.hide(event); }
1254
- return FALSE;
1255
- });
1256
- };
1257
-
1258
- PROTOTYPE._updateButton = function(button)
1259
- {
1260
- // Make sure tooltip is rendered and if not, return
1261
- if(!this.rendered) { return FALSE; }
1262
-
1263
- var elem = this.elements.button;
1264
- if(button) { this._createButton(); }
1265
- else { elem.remove(); }
1266
- };
1267
- ;// Widget class creator
1268
- function createWidgetClass(cls) {
1269
- return WIDGET.concat('').join(cls ? '-'+cls+' ' : ' ');
1270
- }
1271
-
1272
- // Widget class setter method
1273
- PROTOTYPE._setWidget = function()
1274
- {
1275
- var on = this.options.style.widget,
1276
- elements = this.elements,
1277
- tooltip = elements.tooltip,
1278
- disabled = tooltip.hasClass(CLASS_DISABLED);
1279
-
1280
- tooltip.removeClass(CLASS_DISABLED);
1281
- CLASS_DISABLED = on ? 'ui-state-disabled' : 'qtip-disabled';
1282
- tooltip.toggleClass(CLASS_DISABLED, disabled);
1283
-
1284
- tooltip.toggleClass('ui-helper-reset '+createWidgetClass(), on).toggleClass(CLASS_DEFAULT, this.options.style.def && !on);
1285
-
1286
- if(elements.content) {
1287
- elements.content.toggleClass( createWidgetClass('content'), on);
1288
- }
1289
- if(elements.titlebar) {
1290
- elements.titlebar.toggleClass( createWidgetClass('header'), on);
1291
- }
1292
- if(elements.button) {
1293
- elements.button.toggleClass(NAMESPACE+'-icon', !on);
1294
- }
1295
- };
1296
- ;function delay(callback, duration) {
1297
- // If tooltip has displayed, start hide timer
1298
- if(duration > 0) {
1299
- return setTimeout(
1300
- $.proxy(callback, this), duration
1301
- );
1302
- }
1303
- else{ callback.call(this); }
1304
- }
1305
-
1306
- function showMethod(event) {
1307
- if(this.tooltip.hasClass(CLASS_DISABLED)) { return; }
1308
-
1309
- // Clear hide timers
1310
- clearTimeout(this.timers.show);
1311
- clearTimeout(this.timers.hide);
1312
-
1313
- // Start show timer
1314
- this.timers.show = delay.call(this,
1315
- function() { this.toggle(TRUE, event); },
1316
- this.options.show.delay
1317
- );
1318
- }
1319
-
1320
- function hideMethod(event) {
1321
- if(this.tooltip.hasClass(CLASS_DISABLED) || this.destroyed) { return; }
1322
-
1323
- // Check if new target was actually the tooltip element
1324
- var relatedTarget = $(event.relatedTarget),
1325
- ontoTooltip = relatedTarget.closest(SELECTOR)[0] === this.tooltip[0],
1326
- ontoTarget = relatedTarget[0] === this.options.show.target[0];
1327
-
1328
- // Clear timers and stop animation queue
1329
- clearTimeout(this.timers.show);
1330
- clearTimeout(this.timers.hide);
1331
-
1332
- // Prevent hiding if tooltip is fixed and event target is the tooltip.
1333
- // Or if mouse positioning is enabled and cursor momentarily overlaps
1334
- if(this !== relatedTarget[0] &&
1335
- (this.options.position.target === 'mouse' && ontoTooltip) ||
1336
- this.options.hide.fixed && (
1337
- (/mouse(out|leave|move)/).test(event.type) && (ontoTooltip || ontoTarget))
1338
- )
1339
- {
1340
- /* eslint-disable no-empty */
1341
- try {
1342
- event.preventDefault();
1343
- event.stopImmediatePropagation();
1344
- } catch(e) {}
1345
- /* eslint-enable no-empty */
1346
-
1347
- return;
1348
- }
1349
-
1350
- // If tooltip has displayed, start hide timer
1351
- this.timers.hide = delay.call(this,
1352
- function() { this.toggle(FALSE, event); },
1353
- this.options.hide.delay,
1354
- this
1355
- );
1356
- }
1357
-
1358
- function inactiveMethod(event) {
1359
- if(this.tooltip.hasClass(CLASS_DISABLED) || !this.options.hide.inactive) { return; }
1360
-
1361
- // Clear timer
1362
- clearTimeout(this.timers.inactive);
1363
-
1364
- this.timers.inactive = delay.call(this,
1365
- function(){ this.hide(event); },
1366
- this.options.hide.inactive
1367
- );
1368
- }
1369
-
1370
- function repositionMethod(event) {
1371
- if(this.rendered && this.tooltip[0].offsetWidth > 0) { this.reposition(event); }
1372
- }
1373
-
1374
- // Store mouse coordinates
1375
- PROTOTYPE._storeMouse = function(event) {
1376
- (this.mouse = $.event.fix(event)).type = 'mousemove';
1377
- return this;
1378
- };
1379
-
1380
- // Bind events
1381
- PROTOTYPE._bind = function(targets, events, method, suffix, context) {
1382
- if(!targets || !method || !events.length) { return; }
1383
- var ns = '.' + this._id + (suffix ? '-'+suffix : '');
1384
- $(targets).bind(
1385
- (events.split ? events : events.join(ns + ' ')) + ns,
1386
- $.proxy(method, context || this)
1387
- );
1388
- return this;
1389
- };
1390
- PROTOTYPE._unbind = function(targets, suffix) {
1391
- targets && $(targets).unbind('.' + this._id + (suffix ? '-'+suffix : ''));
1392
- return this;
1393
- };
1394
-
1395
- // Global delegation helper
1396
- function delegate(selector, events, method) {
1397
- $(document.body).delegate(selector,
1398
- (events.split ? events : events.join('.'+NAMESPACE + ' ')) + '.'+NAMESPACE,
1399
- function() {
1400
- var api = QTIP.api[ $.attr(this, ATTR_ID) ];
1401
- api && !api.disabled && method.apply(api, arguments);
1402
- }
1403
- );
1404
- }
1405
- // Event trigger
1406
- PROTOTYPE._trigger = function(type, args, event) {
1407
- var callback = new $.Event('tooltip'+type);
1408
- callback.originalEvent = event && $.extend({}, event) || this.cache.event || NULL;
1409
-
1410
- this.triggering = type;
1411
- this.tooltip.trigger(callback, [this].concat(args || []));
1412
- this.triggering = FALSE;
1413
-
1414
- return !callback.isDefaultPrevented();
1415
- };
1416
-
1417
- PROTOTYPE._bindEvents = function(showEvents, hideEvents, showTargets, hideTargets, showCallback, hideCallback) {
1418
- // Get tasrgets that lye within both
1419
- var similarTargets = showTargets.filter( hideTargets ).add( hideTargets.filter(showTargets) ),
1420
- toggleEvents = [];
1421
-
1422
- // If hide and show targets are the same...
1423
- if(similarTargets.length) {
1424
-
1425
- // Filter identical show/hide events
1426
- $.each(hideEvents, function(i, type) {
1427
- var showIndex = $.inArray(type, showEvents);
1428
-
1429
- // Both events are identical, remove from both hide and show events
1430
- // and append to toggleEvents
1431
- showIndex > -1 && toggleEvents.push( showEvents.splice( showIndex, 1 )[0] );
1432
- });
1433
-
1434
- // Toggle events are special case of identical show/hide events, which happen in sequence
1435
- if(toggleEvents.length) {
1436
- // Bind toggle events to the similar targets
1437
- this._bind(similarTargets, toggleEvents, function(event) {
1438
- var state = this.rendered ? this.tooltip[0].offsetWidth > 0 : false;
1439
- (state ? hideCallback : showCallback).call(this, event);
1440
- });
1441
-
1442
- // Remove the similar targets from the regular show/hide bindings
1443
- showTargets = showTargets.not(similarTargets);
1444
- hideTargets = hideTargets.not(similarTargets);
1445
- }
1446
- }
1447
-
1448
- // Apply show/hide/toggle events
1449
- this._bind(showTargets, showEvents, showCallback);
1450
- this._bind(hideTargets, hideEvents, hideCallback);
1451
- };
1452
-
1453
- PROTOTYPE._assignInitialEvents = function(event) {
1454
- var options = this.options,
1455
- showTarget = options.show.target,
1456
- hideTarget = options.hide.target,
1457
- showEvents = options.show.event ? $.trim('' + options.show.event).split(' ') : [],
1458
- hideEvents = options.hide.event ? $.trim('' + options.hide.event).split(' ') : [];
1459
-
1460
- // Catch remove/removeqtip events on target element to destroy redundant tooltips
1461
- this._bind(this.elements.target, ['remove', 'removeqtip'], function() {
1462
- this.destroy(true);
1463
- }, 'destroy');
1464
-
1465
- /*
1466
- * Make sure hoverIntent functions properly by using mouseleave as a hide event if
1467
- * mouseenter/mouseout is used for show.event, even if it isn't in the users options.
1468
- */
1469
- if(/mouse(over|enter)/i.test(options.show.event) && !/mouse(out|leave)/i.test(options.hide.event)) {
1470
- hideEvents.push('mouseleave');
1471
- }
1472
-
1473
- /*
1474
- * Also make sure initial mouse targetting works correctly by caching mousemove coords
1475
- * on show targets before the tooltip has rendered. Also set onTarget when triggered to
1476
- * keep mouse tracking working.
1477
- */
1478
- this._bind(showTarget, 'mousemove', function(moveEvent) {
1479
- this._storeMouse(moveEvent);
1480
- this.cache.onTarget = TRUE;
1481
- });
1482
-
1483
- // Define hoverIntent function
1484
- function hoverIntent(hoverEvent) {
1485
- // Only continue if tooltip isn't disabled
1486
- if(this.disabled || this.destroyed) { return FALSE; }
1487
-
1488
- // Cache the event data
1489
- this.cache.event = hoverEvent && $.event.fix(hoverEvent);
1490
- this.cache.target = hoverEvent && $(hoverEvent.target);
1491
-
1492
- // Start the event sequence
1493
- clearTimeout(this.timers.show);
1494
- this.timers.show = delay.call(this,
1495
- function() { this.render(typeof hoverEvent === 'object' || options.show.ready); },
1496
- options.prerender ? 0 : options.show.delay
1497
- );
1498
- }
1499
-
1500
- // Filter and bind events
1501
- this._bindEvents(showEvents, hideEvents, showTarget, hideTarget, hoverIntent, function() {
1502
- if(!this.timers) { return FALSE; }
1503
- clearTimeout(this.timers.show);
1504
- });
1505
-
1506
- // Prerendering is enabled, create tooltip now
1507
- if(options.show.ready || options.prerender) { hoverIntent.call(this, event); }
1508
- };
1509
-
1510
- // Event assignment method
1511
- PROTOTYPE._assignEvents = function() {
1512
- var self = this,
1513
- options = this.options,
1514
- posOptions = options.position,
1515
-
1516
- tooltip = this.tooltip,
1517
- showTarget = options.show.target,
1518
- hideTarget = options.hide.target,
1519
- containerTarget = posOptions.container,
1520
- viewportTarget = posOptions.viewport,
1521
- documentTarget = $(document),
1522
- windowTarget = $(window),
1523
-
1524
- showEvents = options.show.event ? $.trim('' + options.show.event).split(' ') : [],
1525
- hideEvents = options.hide.event ? $.trim('' + options.hide.event).split(' ') : [];
1526
-
1527
-
1528
- // Assign passed event callbacks
1529
- $.each(options.events, function(name, callback) {
1530
- self._bind(tooltip, name === 'toggle' ? ['tooltipshow','tooltiphide'] : ['tooltip'+name], callback, null, tooltip);
1531
- });
1532
-
1533
- // Hide tooltips when leaving current window/frame (but not select/option elements)
1534
- if(/mouse(out|leave)/i.test(options.hide.event) && options.hide.leave === 'window') {
1535
- this._bind(documentTarget, ['mouseout', 'blur'], function(event) {
1536
- if(!/select|option/.test(event.target.nodeName) && !event.relatedTarget) {
1537
- this.hide(event);
1538
- }
1539
- });
1540
- }
1541
-
1542
- // Enable hide.fixed by adding appropriate class
1543
- if(options.hide.fixed) {
1544
- hideTarget = hideTarget.add( tooltip.addClass(CLASS_FIXED) );
1545
- }
1546
-
1547
- /*
1548
- * Make sure hoverIntent functions properly by using mouseleave to clear show timer if
1549
- * mouseenter/mouseout is used for show.event, even if it isn't in the users options.
1550
- */
1551
- else if(/mouse(over|enter)/i.test(options.show.event)) {
1552
- this._bind(hideTarget, 'mouseleave', function() {
1553
- clearTimeout(this.timers.show);
1554
- });
1555
- }
1556
-
1557
- // Hide tooltip on document mousedown if unfocus events are enabled
1558
- if(('' + options.hide.event).indexOf('unfocus') > -1) {
1559
- this._bind(containerTarget.closest('html'), ['mousedown', 'touchstart'], function(event) {
1560
- var elem = $(event.target),
1561
- enabled = this.rendered && !this.tooltip.hasClass(CLASS_DISABLED) && this.tooltip[0].offsetWidth > 0,
1562
- isAncestor = elem.parents(SELECTOR).filter(this.tooltip[0]).length > 0;
1563
-
1564
- if(elem[0] !== this.target[0] && elem[0] !== this.tooltip[0] && !isAncestor &&
1565
- !this.target.has(elem[0]).length && enabled
1566
- ) {
1567
- this.hide(event);
1568
- }
1569
- });
1570
- }
1571
-
1572
- // Check if the tooltip hides when inactive
1573
- if('number' === typeof options.hide.inactive) {
1574
- // Bind inactive method to show target(s) as a custom event
1575
- this._bind(showTarget, 'qtip-'+this.id+'-inactive', inactiveMethod, 'inactive');
1576
-
1577
- // Define events which reset the 'inactive' event handler
1578
- this._bind(hideTarget.add(tooltip), QTIP.inactiveEvents, inactiveMethod);
1579
- }
1580
-
1581
- // Filter and bind events
1582
- this._bindEvents(showEvents, hideEvents, showTarget, hideTarget, showMethod, hideMethod);
1583
-
1584
- // Mouse movement bindings
1585
- this._bind(showTarget.add(tooltip), 'mousemove', function(event) {
1586
- // Check if the tooltip hides when mouse is moved a certain distance
1587
- if('number' === typeof options.hide.distance) {
1588
- var origin = this.cache.origin || {},
1589
- limit = this.options.hide.distance,
1590
- abs = Math.abs;
1591
-
1592
- // Check if the movement has gone beyond the limit, and hide it if so
1593
- if(abs(event.pageX - origin.pageX) >= limit || abs(event.pageY - origin.pageY) >= limit) {
1594
- this.hide(event);
1595
- }
1596
- }
1597
-
1598
- // Cache mousemove coords on show targets
1599
- this._storeMouse(event);
1600
- });
1601
-
1602
- // Mouse positioning events
1603
- if(posOptions.target === 'mouse') {
1604
- // If mouse adjustment is on...
1605
- if(posOptions.adjust.mouse) {
1606
- // Apply a mouseleave event so we don't get problems with overlapping
1607
- if(options.hide.event) {
1608
- // Track if we're on the target or not
1609
- this._bind(showTarget, ['mouseenter', 'mouseleave'], function(event) {
1610
- if(!this.cache) {return FALSE; }
1611
- this.cache.onTarget = event.type === 'mouseenter';
1612
- });
1613
- }
1614
-
1615
- // Update tooltip position on mousemove
1616
- this._bind(documentTarget, 'mousemove', function(event) {
1617
- // Update the tooltip position only if the tooltip is visible and adjustment is enabled
1618
- if(this.rendered && this.cache.onTarget && !this.tooltip.hasClass(CLASS_DISABLED) && this.tooltip[0].offsetWidth > 0) {
1619
- this.reposition(event);
1620
- }
1621
- });
1622
- }
1623
- }
1624
-
1625
- // Adjust positions of the tooltip on window resize if enabled
1626
- if(posOptions.adjust.resize || viewportTarget.length) {
1627
- this._bind( $.event.special.resize ? viewportTarget : windowTarget, 'resize', repositionMethod );
1628
- }
1629
-
1630
- // Adjust tooltip position on scroll of the window or viewport element if present
1631
- if(posOptions.adjust.scroll) {
1632
- this._bind( windowTarget.add(posOptions.container), 'scroll', repositionMethod );
1633
- }
1634
- };
1635
-
1636
- // Un-assignment method
1637
- PROTOTYPE._unassignEvents = function() {
1638
- var options = this.options,
1639
- showTargets = options.show.target,
1640
- hideTargets = options.hide.target,
1641
- targets = $.grep([
1642
- this.elements.target[0],
1643
- this.rendered && this.tooltip[0],
1644
- options.position.container[0],
1645
- options.position.viewport[0],
1646
- options.position.container.closest('html')[0], // unfocus
1647
- window,
1648
- document
1649
- ], function(i) {
1650
- return typeof i === 'object';
1651
- });
1652
-
1653
- // Add show and hide targets if they're valid
1654
- if(showTargets && showTargets.toArray) {
1655
- targets = targets.concat(showTargets.toArray());
1656
- }
1657
- if(hideTargets && hideTargets.toArray) {
1658
- targets = targets.concat(hideTargets.toArray());
1659
- }
1660
-
1661
- // Unbind the events
1662
- this._unbind(targets)
1663
- ._unbind(targets, 'destroy')
1664
- ._unbind(targets, 'inactive');
1665
- };
1666
-
1667
- // Apply common event handlers using delegate (avoids excessive .bind calls!)
1668
- $(function() {
1669
- delegate(SELECTOR, ['mouseenter', 'mouseleave'], function(event) {
1670
- var state = event.type === 'mouseenter',
1671
- tooltip = $(event.currentTarget),
1672
- target = $(event.relatedTarget || event.target),
1673
- options = this.options;
1674
-
1675
- // On mouseenter...
1676
- if(state) {
1677
- // Focus the tooltip on mouseenter (z-index stacking)
1678
- this.focus(event);
1679
-
1680
- // Clear hide timer on tooltip hover to prevent it from closing
1681
- tooltip.hasClass(CLASS_FIXED) && !tooltip.hasClass(CLASS_DISABLED) && clearTimeout(this.timers.hide);
1682
- }
1683
-
1684
- // On mouseleave...
1685
- else {
1686
- // When mouse tracking is enabled, hide when we leave the tooltip and not onto the show target (if a hide event is set)
1687
- if(options.position.target === 'mouse' && options.position.adjust.mouse &&
1688
- options.hide.event && options.show.target && !target.closest(options.show.target[0]).length) {
1689
- this.hide(event);
1690
- }
1691
- }
1692
-
1693
- // Add hover class
1694
- tooltip.toggleClass(CLASS_HOVER, state);
1695
- });
1696
-
1697
- // Define events which reset the 'inactive' event handler
1698
- delegate('['+ATTR_ID+']', INACTIVE_EVENTS, inactiveMethod);
1699
- });
1700
- ;// Initialization method
1701
- function init(elem, id, opts) {
1702
- var obj, posOptions, attr, config, title,
1703
-
1704
- // Setup element references
1705
- docBody = $(document.body),
1706
-
1707
- // Use document body instead of document element if needed
1708
- newTarget = elem[0] === document ? docBody : elem,
1709
-
1710
- // Grab metadata from element if plugin is present
1711
- metadata = elem.metadata ? elem.metadata(opts.metadata) : NULL,
1712
-
1713
- // If metadata type if HTML5, grab 'name' from the object instead, or use the regular data object otherwise
1714
- metadata5 = opts.metadata.type === 'html5' && metadata ? metadata[opts.metadata.name] : NULL,
1715
-
1716
- // Grab data from metadata.name (or data-qtipopts as fallback) using .data() method,
1717
- html5 = elem.data(opts.metadata.name || 'qtipopts');
1718
-
1719
- // If we don't get an object returned attempt to parse it manualyl without parseJSON
1720
- /* eslint-disable no-empty */
1721
- try { html5 = typeof html5 === 'string' ? $.parseJSON(html5) : html5; }
1722
- catch(e) {}
1723
- /* eslint-enable no-empty */
1724
-
1725
- // Merge in and sanitize metadata
1726
- config = $.extend(TRUE, {}, QTIP.defaults, opts,
1727
- typeof html5 === 'object' ? sanitizeOptions(html5) : NULL,
1728
- sanitizeOptions(metadata5 || metadata));
1729
-
1730
- // Re-grab our positioning options now we've merged our metadata and set id to passed value
1731
- posOptions = config.position;
1732
- config.id = id;
1733
-
1734
- // Setup missing content if none is detected
1735
- if('boolean' === typeof config.content.text) {
1736
- attr = elem.attr(config.content.attr);
1737
-
1738
- // Grab from supplied attribute if available
1739
- if(config.content.attr !== FALSE && attr) { config.content.text = attr; }
1740
-
1741
- // No valid content was found, abort render
1742
- else { return FALSE; }
1743
- }
1744
-
1745
- // Setup target options
1746
- if(!posOptions.container.length) { posOptions.container = docBody; }
1747
- if(posOptions.target === FALSE) { posOptions.target = newTarget; }
1748
- if(config.show.target === FALSE) { config.show.target = newTarget; }
1749
- if(config.show.solo === TRUE) { config.show.solo = posOptions.container.closest('body'); }
1750
- if(config.hide.target === FALSE) { config.hide.target = newTarget; }
1751
- if(config.position.viewport === TRUE) { config.position.viewport = posOptions.container; }
1752
-
1753
- // Ensure we only use a single container
1754
- posOptions.container = posOptions.container.eq(0);
1755
-
1756
- // Convert position corner values into x and y strings
1757
- posOptions.at = new CORNER(posOptions.at, TRUE);
1758
- posOptions.my = new CORNER(posOptions.my);
1759
-
1760
- // Destroy previous tooltip if overwrite is enabled, or skip element if not
1761
- if(elem.data(NAMESPACE)) {
1762
- if(config.overwrite) {
1763
- elem.qtip('destroy', true);
1764
- }
1765
- else if(config.overwrite === FALSE) {
1766
- return FALSE;
1767
- }
1768
- }
1769
-
1770
- // Add has-qtip attribute
1771
- elem.attr(ATTR_HAS, id);
1772
-
1773
- // Remove title attribute and store it if present
1774
- if(config.suppress && (title = elem.attr('title'))) {
1775
- // Final attr call fixes event delegatiom and IE default tooltip showing problem
1776
- elem.removeAttr('title').attr(oldtitle, title).attr('title', '');
1777
- }
1778
-
1779
- // Initialize the tooltip and add API reference
1780
- obj = new QTip(elem, config, id, !!attr);
1781
- elem.data(NAMESPACE, obj);
1782
-
1783
- return obj;
1784
- }
1785
-
1786
- // jQuery $.fn extension method
1787
- QTIP = $.fn.qtip = function(options, notation, newValue)
1788
- {
1789
- var command = ('' + options).toLowerCase(), // Parse command
1790
- returned = NULL,
1791
- args = $.makeArray(arguments).slice(1),
1792
- event = args[args.length - 1],
1793
- opts = this[0] ? $.data(this[0], NAMESPACE) : NULL;
1794
-
1795
- // Check for API request
1796
- if(!arguments.length && opts || command === 'api') {
1797
- return opts;
1798
- }
1799
-
1800
- // Execute API command if present
1801
- else if('string' === typeof options) {
1802
- this.each(function() {
1803
- var api = $.data(this, NAMESPACE);
1804
- if(!api) { return TRUE; }
1805
-
1806
- // Cache the event if possible
1807
- if(event && event.timeStamp) { api.cache.event = event; }
1808
-
1809
- // Check for specific API commands
1810
- if(notation && (command === 'option' || command === 'options')) {
1811
- if(newValue !== undefined || $.isPlainObject(notation)) {
1812
- api.set(notation, newValue);
1813
- }
1814
- else {
1815
- returned = api.get(notation);
1816
- return FALSE;
1817
- }
1818
- }
1819
-
1820
- // Execute API command
1821
- else if(api[command]) {
1822
- api[command].apply(api, args);
1823
- }
1824
- });
1825
-
1826
- return returned !== NULL ? returned : this;
1827
- }
1828
-
1829
- // No API commands. validate provided options and setup qTips
1830
- else if('object' === typeof options || !arguments.length) {
1831
- // Sanitize options first
1832
- opts = sanitizeOptions($.extend(TRUE, {}, options));
1833
-
1834
- return this.each(function(i) {
1835
- var api, id;
1836
-
1837
- // Find next available ID, or use custom ID if provided
1838
- id = $.isArray(opts.id) ? opts.id[i] : opts.id;
1839
- id = !id || id === FALSE || id.length < 1 || QTIP.api[id] ? QTIP.nextid++ : id;
1840
-
1841
- // Initialize the qTip and re-grab newly sanitized options
1842
- api = init($(this), id, opts);
1843
- if(api === FALSE) { return TRUE; }
1844
- else { QTIP.api[id] = api; }
1845
-
1846
- // Initialize plugins
1847
- $.each(PLUGINS, function() {
1848
- if(this.initialize === 'initialize') { this(api); }
1849
- });
1850
-
1851
- // Assign initial pre-render events
1852
- api._assignInitialEvents(event);
1853
- });
1854
- }
1855
- };
1856
-
1857
- // Expose class
1858
- $.qtip = QTip;
1859
-
1860
- // Populated in render method
1861
- QTIP.api = {};
1862
- ;$.each({
1863
- /* Allow other plugins to successfully retrieve the title of an element with a qTip applied */
1864
- attr: function(attr, val) {
1865
- if(this.length) {
1866
- var self = this[0],
1867
- title = 'title',
1868
- api = $.data(self, 'qtip');
1869
-
1870
- if(attr === title && api && api.options && 'object' === typeof api && 'object' === typeof api.options && api.options.suppress) {
1871
- if(arguments.length < 2) {
1872
- return $.attr(self, oldtitle);
1873
- }
1874
-
1875
- // If qTip is rendered and title was originally used as content, update it
1876
- if(api && api.options.content.attr === title && api.cache.attr) {
1877
- api.set('content.text', val);
1878
- }
1879
-
1880
- // Use the regular attr method to set, then cache the result
1881
- return this.attr(oldtitle, val);
1882
- }
1883
- }
1884
-
1885
- return $.fn['attr'+replaceSuffix].apply(this, arguments);
1886
- },
1887
-
1888
- /* Allow clone to correctly retrieve cached title attributes */
1889
- clone: function(keepData) {
1890
- // Clone our element using the real clone method
1891
- var elems = $.fn['clone'+replaceSuffix].apply(this, arguments);
1892
-
1893
- // Grab all elements with an oldtitle set, and change it to regular title attribute, if keepData is false
1894
- if(!keepData) {
1895
- elems.filter('['+oldtitle+']').attr('title', function() {
1896
- return $.attr(this, oldtitle);
1897
- })
1898
- .removeAttr(oldtitle);
1899
- }
1900
-
1901
- return elems;
1902
- }
1903
- }, function(name, func) {
1904
- if(!func || $.fn[name+replaceSuffix]) { return TRUE; }
1905
-
1906
- var old = $.fn[name+replaceSuffix] = $.fn[name];
1907
- $.fn[name] = function() {
1908
- return func.apply(this, arguments) || old.apply(this, arguments);
1909
- };
1910
- });
1911
-
1912
- /* Fire off 'removeqtip' handler in $.cleanData if jQuery UI not present (it already does similar).
1913
- * This snippet is taken directly from jQuery UI source code found here:
1914
- * http://code.jquery.com/ui/jquery-ui-git.js
1915
- */
1916
- if(!$.ui) {
1917
- $['cleanData'+replaceSuffix] = $.cleanData;
1918
- $.cleanData = function( elems ) {
1919
- for(var i = 0, elem; (elem = $( elems[i] )).length; i++) {
1920
- if(elem.attr(ATTR_HAS)) {
1921
- /* eslint-disable no-empty */
1922
- try { elem.triggerHandler('removeqtip'); }
1923
- catch( e ) {}
1924
- /* eslint-enable no-empty */
1925
- }
1926
- }
1927
- $['cleanData'+replaceSuffix].apply(this, arguments);
1928
- };
1929
- }
1930
- ;// qTip version
1931
- QTIP.version = '3.0.2';
1932
-
1933
- // Base ID for all qTips
1934
- QTIP.nextid = 0;
1935
-
1936
- // Inactive events array
1937
- QTIP.inactiveEvents = INACTIVE_EVENTS;
1938
-
1939
- // Base z-index for all qTips
1940
- QTIP.zindex = 15000;
1941
-
1942
- // Define configuration defaults
1943
- QTIP.defaults = {
1944
- prerender: FALSE,
1945
- id: FALSE,
1946
- overwrite: TRUE,
1947
- suppress: TRUE,
1948
- content: {
1949
- text: TRUE,
1950
- attr: 'title',
1951
- title: FALSE,
1952
- button: FALSE
1953
- },
1954
- position: {
1955
- my: 'top left',
1956
- at: 'bottom right',
1957
- target: FALSE,
1958
- container: FALSE,
1959
- viewport: FALSE,
1960
- adjust: {
1961
- x: 0, y: 0,
1962
- mouse: TRUE,
1963
- scroll: TRUE,
1964
- resize: TRUE,
1965
- method: 'flipinvert flipinvert'
1966
- },
1967
- effect: function(api, pos) {
1968
- $(this).animate(pos, {
1969
- duration: 200,
1970
- queue: FALSE
1971
- });
1972
- }
1973
- },
1974
- show: {
1975
- target: FALSE,
1976
- event: 'mouseenter',
1977
- effect: TRUE,
1978
- delay: 90,
1979
- solo: FALSE,
1980
- ready: FALSE,
1981
- autofocus: FALSE
1982
- },
1983
- hide: {
1984
- target: FALSE,
1985
- event: 'mouseleave',
1986
- effect: TRUE,
1987
- delay: 0,
1988
- fixed: FALSE,
1989
- inactive: FALSE,
1990
- leave: 'window',
1991
- distance: FALSE
1992
- },
1993
- style: {
1994
- classes: '',
1995
- widget: FALSE,
1996
- width: FALSE,
1997
- height: FALSE,
1998
- def: TRUE
1999
- },
2000
- events: {
2001
- render: NULL,
2002
- move: NULL,
2003
- show: NULL,
2004
- hide: NULL,
2005
- toggle: NULL,
2006
- visible: NULL,
2007
- hidden: NULL,
2008
- focus: NULL,
2009
- blur: NULL
2010
- }
2011
- };
2012
- ;var TIP,
2013
- createVML,
2014
- SCALE,
2015
- PIXEL_RATIO,
2016
- BACKING_STORE_RATIO,
2017
-
2018
- // Common CSS strings
2019
- MARGIN = 'margin',
2020
- BORDER = 'border',
2021
- COLOR = 'color',
2022
- BG_COLOR = 'background-color',
2023
- TRANSPARENT = 'transparent',
2024
- IMPORTANT = ' !important',
2025
-
2026
- // Check if the browser supports <canvas/> elements
2027
- HASCANVAS = !!document.createElement('canvas').getContext,
2028
-
2029
- // Invalid colour values used in parseColours()
2030
- INVALID = /rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i;
2031
-
2032
- // Camel-case method, taken from jQuery source
2033
- // http://code.jquery.com/jquery-1.8.0.js
2034
- function camel(s) { return s.charAt(0).toUpperCase() + s.slice(1); }
2035
-
2036
- /*
2037
- * Modified from Modernizr's testPropsAll()
2038
- * http://modernizr.com/downloads/modernizr-latest.js
2039
- */
2040
- var cssProps = {}, cssPrefixes = ['Webkit', 'O', 'Moz', 'ms'];
2041
- function vendorCss(elem, prop) {
2042
- var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1),
2043
- props = (prop + ' ' + cssPrefixes.join(ucProp + ' ') + ucProp).split(' '),
2044
- cur, val, i = 0;
2045
-
2046
- // If the property has already been mapped...
2047
- if(cssProps[prop]) { return elem.css(cssProps[prop]); }
2048
-
2049
- while(cur = props[i++]) {
2050
- if((val = elem.css(cur)) !== undefined) {
2051
- cssProps[prop] = cur;
2052
- return val;
2053
- }
2054
- }
2055
- }
2056
-
2057
- // Parse a given elements CSS property into an int
2058
- function intCss(elem, prop) {
2059
- return Math.ceil(parseFloat(vendorCss(elem, prop)));
2060
- }
2061
-
2062
-
2063
- // VML creation (for IE only)
2064
- if(!HASCANVAS) {
2065
- createVML = function(tag, props, style) {
2066
- return '<qtipvml:'+tag+' xmlns="urn:schemas-microsoft.com:vml" class="qtip-vml" '+(props||'')+
2067
- ' style="behavior: url(#default#VML); '+(style||'')+ '" />';
2068
- };
2069
- }
2070
-
2071
- // Canvas only definitions
2072
- else {
2073
- PIXEL_RATIO = window.devicePixelRatio || 1;
2074
- BACKING_STORE_RATIO = (function() {
2075
- var context = document.createElement('canvas').getContext('2d');
2076
- return context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio ||
2077
- context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || 1;
2078
- })();
2079
- SCALE = PIXEL_RATIO / BACKING_STORE_RATIO;
2080
- }
2081
-
2082
-
2083
- function Tip(qtip, options) {
2084
- this._ns = 'tip';
2085
- this.options = options;
2086
- this.offset = options.offset;
2087
- this.size = [ options.width, options.height ];
2088
-
2089
- // Initialize
2090
- this.qtip = qtip;
2091
- this.init(qtip);
2092
- }
2093
-
2094
- $.extend(Tip.prototype, {
2095
- init: function(qtip) {
2096
- var context, tip;
2097
-
2098
- // Create tip element and prepend to the tooltip
2099
- tip = this.element = qtip.elements.tip = $('<div />', { 'class': NAMESPACE+'-tip' }).prependTo(qtip.tooltip);
2100
-
2101
- // Create tip drawing element(s)
2102
- if(HASCANVAS) {
2103
- // save() as soon as we create the canvas element so FF2 doesn't bork on our first restore()!
2104
- context = $('<canvas />').appendTo(this.element)[0].getContext('2d');
2105
-
2106
- // Setup constant parameters
2107
- context.lineJoin = 'miter';
2108
- context.miterLimit = 100000;
2109
- context.save();
2110
- }
2111
- else {
2112
- context = createVML('shape', 'coordorigin="0,0"', 'position:absolute;');
2113
- this.element.html(context + context);
2114
-
2115
- // Prevent mousing down on the tip since it causes problems with .live() handling in IE due to VML
2116
- qtip._bind( $('*', tip).add(tip), ['click', 'mousedown'], function(event) { event.stopPropagation(); }, this._ns);
2117
- }
2118
-
2119
- // Bind update events
2120
- qtip._bind(qtip.tooltip, 'tooltipmove', this.reposition, this._ns, this);
2121
-
2122
- // Create it
2123
- this.create();
2124
- },
2125
-
2126
- _swapDimensions: function() {
2127
- this.size[0] = this.options.height;
2128
- this.size[1] = this.options.width;
2129
- },
2130
- _resetDimensions: function() {
2131
- this.size[0] = this.options.width;
2132
- this.size[1] = this.options.height;
2133
- },
2134
-
2135
- _useTitle: function(corner) {
2136
- var titlebar = this.qtip.elements.titlebar;
2137
- return titlebar && (
2138
- corner.y === TOP || corner.y === CENTER && this.element.position().top + this.size[1] / 2 + this.options.offset < titlebar.outerHeight(TRUE)
2139
- );
2140
- },
2141
-
2142
- _parseCorner: function(corner) {
2143
- var my = this.qtip.options.position.my;
2144
-
2145
- // Detect corner and mimic properties
2146
- if(corner === FALSE || my === FALSE) {
2147
- corner = FALSE;
2148
- }
2149
- else if(corner === TRUE) {
2150
- corner = new CORNER( my.string() );
2151
- }
2152
- else if(!corner.string) {
2153
- corner = new CORNER(corner);
2154
- corner.fixed = TRUE;
2155
- }
2156
-
2157
- return corner;
2158
- },
2159
-
2160
- _parseWidth: function(corner, side, use) {
2161
- var elements = this.qtip.elements,
2162
- prop = BORDER + camel(side) + 'Width';
2163
-
2164
- return (use ? intCss(use, prop) :
2165
- intCss(elements.content, prop) ||
2166
- intCss(this._useTitle(corner) && elements.titlebar || elements.content, prop) ||
2167
- intCss(elements.tooltip, prop)
2168
- ) || 0;
2169
- },
2170
-
2171
- _parseRadius: function(corner) {
2172
- var elements = this.qtip.elements,
2173
- prop = BORDER + camel(corner.y) + camel(corner.x) + 'Radius';
2174
-
2175
- return BROWSER.ie < 9 ? 0 :
2176
- intCss(this._useTitle(corner) && elements.titlebar || elements.content, prop) ||
2177
- intCss(elements.tooltip, prop) || 0;
2178
- },
2179
-
2180
- _invalidColour: function(elem, prop, compare) {
2181
- var val = elem.css(prop);
2182
- return !val || compare && val === elem.css(compare) || INVALID.test(val) ? FALSE : val;
2183
- },
2184
-
2185
- _parseColours: function(corner) {
2186
- var elements = this.qtip.elements,
2187
- tip = this.element.css('cssText', ''),
2188
- borderSide = BORDER + camel(corner[ corner.precedance ]) + camel(COLOR),
2189
- colorElem = this._useTitle(corner) && elements.titlebar || elements.content,
2190
- css = this._invalidColour, color = [];
2191
-
2192
- // Attempt to detect the background colour from various elements, left-to-right precedance
2193
- color[0] = css(tip, BG_COLOR) || css(colorElem, BG_COLOR) || css(elements.content, BG_COLOR) ||
2194
- css(elements.tooltip, BG_COLOR) || tip.css(BG_COLOR);
2195
-
2196
- // Attempt to detect the correct border side colour from various elements, left-to-right precedance
2197
- color[1] = css(tip, borderSide, COLOR) || css(colorElem, borderSide, COLOR) ||
2198
- css(elements.content, borderSide, COLOR) || css(elements.tooltip, borderSide, COLOR) || elements.tooltip.css(borderSide);
2199
-
2200
- // Reset background and border colours
2201
- $('*', tip).add(tip).css('cssText', BG_COLOR+':'+TRANSPARENT+IMPORTANT+';'+BORDER+':0'+IMPORTANT+';');
2202
-
2203
- return color;
2204
- },
2205
-
2206
- _calculateSize: function(corner) {
2207
- var y = corner.precedance === Y,
2208
- width = this.options.width,
2209
- height = this.options.height,
2210
- isCenter = corner.abbrev() === 'c',
2211
- base = (y ? width: height) * (isCenter ? 0.5 : 1),
2212
- pow = Math.pow,
2213
- round = Math.round,
2214
- bigHyp, ratio, result,
2215
-
2216
- smallHyp = Math.sqrt( pow(base, 2) + pow(height, 2) ),
2217
- hyp = [
2218
- this.border / base * smallHyp,
2219
- this.border / height * smallHyp
2220
- ];
2221
-
2222
- hyp[2] = Math.sqrt( pow(hyp[0], 2) - pow(this.border, 2) );
2223
- hyp[3] = Math.sqrt( pow(hyp[1], 2) - pow(this.border, 2) );
2224
-
2225
- bigHyp = smallHyp + hyp[2] + hyp[3] + (isCenter ? 0 : hyp[0]);
2226
- ratio = bigHyp / smallHyp;
2227
-
2228
- result = [ round(ratio * width), round(ratio * height) ];
2229
- return y ? result : result.reverse();
2230
- },
2231
-
2232
- // Tip coordinates calculator
2233
- _calculateTip: function(corner, size, scale) {
2234
- scale = scale || 1;
2235
- size = size || this.size;
2236
-
2237
- var width = size[0] * scale,
2238
- height = size[1] * scale,
2239
- width2 = Math.ceil(width / 2), height2 = Math.ceil(height / 2),
2240
-
2241
- // Define tip coordinates in terms of height and width values
2242
- tips = {
2243
- br: [0,0, width,height, width,0],
2244
- bl: [0,0, width,0, 0,height],
2245
- tr: [0,height, width,0, width,height],
2246
- tl: [0,0, 0,height, width,height],
2247
- tc: [0,height, width2,0, width,height],
2248
- bc: [0,0, width,0, width2,height],
2249
- rc: [0,0, width,height2, 0,height],
2250
- lc: [width,0, width,height, 0,height2]
2251
- };
2252
-
2253
- // Set common side shapes
2254
- tips.lt = tips.br; tips.rt = tips.bl;
2255
- tips.lb = tips.tr; tips.rb = tips.tl;
2256
-
2257
- return tips[ corner.abbrev() ];
2258
- },
2259
-
2260
- // Tip coordinates drawer (canvas)
2261
- _drawCoords: function(context, coords) {
2262
- context.beginPath();
2263
- context.moveTo(coords[0], coords[1]);
2264
- context.lineTo(coords[2], coords[3]);
2265
- context.lineTo(coords[4], coords[5]);
2266
- context.closePath();
2267
- },
2268
-
2269
- create: function() {
2270
- // Determine tip corner
2271
- var c = this.corner = (HASCANVAS || BROWSER.ie) && this._parseCorner(this.options.corner);
2272
-
2273
- // If we have a tip corner...
2274
- this.enabled = !!this.corner && this.corner.abbrev() !== 'c';
2275
- if(this.enabled) {
2276
- // Cache it
2277
- this.qtip.cache.corner = c.clone();
2278
-
2279
- // Create it
2280
- this.update();
2281
- }
2282
-
2283
- // Toggle tip element
2284
- this.element.toggle(this.enabled);
2285
-
2286
- return this.corner;
2287
- },
2288
-
2289
- update: function(corner, position) {
2290
- if(!this.enabled) { return this; }
2291
-
2292
- var elements = this.qtip.elements,
2293
- tip = this.element,
2294
- inner = tip.children(),
2295
- options = this.options,
2296
- curSize = this.size,
2297
- mimic = options.mimic,
2298
- round = Math.round,
2299
- color, precedance, context,
2300
- coords, bigCoords, translate, newSize, border;
2301
-
2302
- // Re-determine tip if not already set
2303
- if(!corner) { corner = this.qtip.cache.corner || this.corner; }
2304
-
2305
- // Use corner property if we detect an invalid mimic value
2306
- if(mimic === FALSE) { mimic = corner; }
2307
-
2308
- // Otherwise inherit mimic properties from the corner object as necessary
2309
- else {
2310
- mimic = new CORNER(mimic);
2311
- mimic.precedance = corner.precedance;
2312
-
2313
- if(mimic.x === 'inherit') { mimic.x = corner.x; }
2314
- else if(mimic.y === 'inherit') { mimic.y = corner.y; }
2315
- else if(mimic.x === mimic.y) {
2316
- mimic[ corner.precedance ] = corner[ corner.precedance ];
2317
- }
2318
- }
2319
- precedance = mimic.precedance;
2320
-
2321
- // Ensure the tip width.height are relative to the tip position
2322
- if(corner.precedance === X) { this._swapDimensions(); }
2323
- else { this._resetDimensions(); }
2324
-
2325
- // Update our colours
2326
- color = this.color = this._parseColours(corner);
2327
-
2328
- // Detect border width, taking into account colours
2329
- if(color[1] !== TRANSPARENT) {
2330
- // Grab border width
2331
- border = this.border = this._parseWidth(corner, corner[corner.precedance]);
2332
-
2333
- // If border width isn't zero, use border color as fill if it's not invalid (1.0 style tips)
2334
- if(options.border && border < 1 && !INVALID.test(color[1])) { color[0] = color[1]; }
2335
-
2336
- // Set border width (use detected border width if options.border is true)
2337
- this.border = border = options.border !== TRUE ? options.border : border;
2338
- }
2339
-
2340
- // Border colour was invalid, set border to zero
2341
- else { this.border = border = 0; }
2342
-
2343
- // Determine tip size
2344
- newSize = this.size = this._calculateSize(corner);
2345
- tip.css({
2346
- width: newSize[0],
2347
- height: newSize[1],
2348
- lineHeight: newSize[1]+'px'
2349
- });
2350
-
2351
- // Calculate tip translation
2352
- if(corner.precedance === Y) {
2353
- translate = [
2354
- round(mimic.x === LEFT ? border : mimic.x === RIGHT ? newSize[0] - curSize[0] - border : (newSize[0] - curSize[0]) / 2),
2355
- round(mimic.y === TOP ? newSize[1] - curSize[1] : 0)
2356
- ];
2357
- }
2358
- else {
2359
- translate = [
2360
- round(mimic.x === LEFT ? newSize[0] - curSize[0] : 0),
2361
- round(mimic.y === TOP ? border : mimic.y === BOTTOM ? newSize[1] - curSize[1] - border : (newSize[1] - curSize[1]) / 2)
2362
- ];
2363
- }
2364
-
2365
- // Canvas drawing implementation
2366
- if(HASCANVAS) {
2367
- // Grab canvas context and clear/save it
2368
- context = inner[0].getContext('2d');
2369
- context.restore(); context.save();
2370
- context.clearRect(0,0,6000,6000);
2371
-
2372
- // Calculate coordinates
2373
- coords = this._calculateTip(mimic, curSize, SCALE);
2374
- bigCoords = this._calculateTip(mimic, this.size, SCALE);
2375
-
2376
- // Set the canvas size using calculated size
2377
- inner.attr(WIDTH, newSize[0] * SCALE).attr(HEIGHT, newSize[1] * SCALE);
2378
- inner.css(WIDTH, newSize[0]).css(HEIGHT, newSize[1]);
2379
-
2380
- // Draw the outer-stroke tip
2381
- this._drawCoords(context, bigCoords);
2382
- context.fillStyle = color[1];
2383
- context.fill();
2384
-
2385
- // Draw the actual tip
2386
- context.translate(translate[0] * SCALE, translate[1] * SCALE);
2387
- this._drawCoords(context, coords);
2388
- context.fillStyle = color[0];
2389
- context.fill();
2390
- }
2391
-
2392
- // VML (IE Proprietary implementation)
2393
- else {
2394
- // Calculate coordinates
2395
- coords = this._calculateTip(mimic);
2396
-
2397
- // Setup coordinates string
2398
- coords = 'm' + coords[0] + ',' + coords[1] + ' l' + coords[2] +
2399
- ',' + coords[3] + ' ' + coords[4] + ',' + coords[5] + ' xe';
2400
-
2401
- // Setup VML-specific offset for pixel-perfection
2402
- translate[2] = border && /^(r|b)/i.test(corner.string()) ?
2403
- BROWSER.ie === 8 ? 2 : 1 : 0;
2404
-
2405
- // Set initial CSS
2406
- inner.css({
2407
- coordsize: newSize[0]+border + ' ' + newSize[1]+border,
2408
- antialias: ''+(mimic.string().indexOf(CENTER) > -1),
2409
- left: translate[0] - translate[2] * Number(precedance === X),
2410
- top: translate[1] - translate[2] * Number(precedance === Y),
2411
- width: newSize[0] + border,
2412
- height: newSize[1] + border
2413
- })
2414
- .each(function(i) {
2415
- var $this = $(this);
2416
-
2417
- // Set shape specific attributes
2418
- $this[ $this.prop ? 'prop' : 'attr' ]({
2419
- coordsize: newSize[0]+border + ' ' + newSize[1]+border,
2420
- path: coords,
2421
- fillcolor: color[0],
2422
- filled: !!i,
2423
- stroked: !i
2424
- })
2425
- .toggle(!!(border || i));
2426
-
2427
- // Check if border is enabled and add stroke element
2428
- !i && $this.html( createVML(
2429
- 'stroke', 'weight="'+border*2+'px" color="'+color[1]+'" miterlimit="1000" joinstyle="miter"'
2430
- ) );
2431
- });
2432
- }
2433
-
2434
- // Opera bug #357 - Incorrect tip position
2435
- // https://github.com/Craga89/qTip2/issues/367
2436
- window.opera && setTimeout(function() {
2437
- elements.tip.css({
2438
- display: 'inline-block',
2439
- visibility: 'visible'
2440
- });
2441
- }, 1);
2442
-
2443
- // Position if needed
2444
- if(position !== FALSE) { this.calculate(corner, newSize); }
2445
- },
2446
-
2447
- calculate: function(corner, size) {
2448
- if(!this.enabled) { return FALSE; }
2449
-
2450
- var self = this,
2451
- elements = this.qtip.elements,
2452
- tip = this.element,
2453
- userOffset = this.options.offset,
2454
- position = {},
2455
- precedance, corners;
2456
-
2457
- // Inherit corner if not provided
2458
- corner = corner || this.corner;
2459
- precedance = corner.precedance;
2460
-
2461
- // Determine which tip dimension to use for adjustment
2462
- size = size || this._calculateSize(corner);
2463
-
2464
- // Setup corners and offset array
2465
- corners = [ corner.x, corner.y ];
2466
- if(precedance === X) { corners.reverse(); }
2467
-
2468
- // Calculate tip position
2469
- $.each(corners, function(i, side) {
2470
- var b, bc, br;
2471
-
2472
- if(side === CENTER) {
2473
- b = precedance === Y ? LEFT : TOP;
2474
- position[ b ] = '50%';
2475
- position[MARGIN+'-' + b] = -Math.round(size[ precedance === Y ? 0 : 1 ] / 2) + userOffset;
2476
- }
2477
- else {
2478
- b = self._parseWidth(corner, side, elements.tooltip);
2479
- bc = self._parseWidth(corner, side, elements.content);
2480
- br = self._parseRadius(corner);
2481
-
2482
- position[ side ] = Math.max(-self.border, i ? bc : userOffset + (br > b ? br : -b));
2483
- }
2484
- });
2485
-
2486
- // Adjust for tip size
2487
- position[ corner[precedance] ] -= size[ precedance === X ? 0 : 1 ];
2488
-
2489
- // Set and return new position
2490
- tip.css({ margin: '', top: '', bottom: '', left: '', right: '' }).css(position);
2491
- return position;
2492
- },
2493
-
2494
- reposition: function(event, api, pos) {
2495
- if(!this.enabled) { return; }
2496
-
2497
- var cache = api.cache,
2498
- newCorner = this.corner.clone(),
2499
- adjust = pos.adjusted,
2500
- method = api.options.position.adjust.method.split(' '),
2501
- horizontal = method[0],
2502
- vertical = method[1] || method[0],
2503
- shift = { left: FALSE, top: FALSE, x: 0, y: 0 },
2504
- offset, css = {}, props;
2505
-
2506
- function shiftflip(direction, precedance, popposite, side, opposite) {
2507
- // Horizontal - Shift or flip method
2508
- if(direction === SHIFT && newCorner.precedance === precedance && adjust[side] && newCorner[popposite] !== CENTER) {
2509
- newCorner.precedance = newCorner.precedance === X ? Y : X;
2510
- }
2511
- else if(direction !== SHIFT && adjust[side]){
2512
- newCorner[precedance] = newCorner[precedance] === CENTER ?
2513
- adjust[side] > 0 ? side : opposite :
2514
- newCorner[precedance] === side ? opposite : side;
2515
- }
2516
- }
2517
-
2518
- function shiftonly(xy, side, opposite) {
2519
- if(newCorner[xy] === CENTER) {
2520
- css[MARGIN+'-'+side] = shift[xy] = offset[MARGIN+'-'+side] - adjust[side];
2521
- }
2522
- else {
2523
- props = offset[opposite] !== undefined ?
2524
- [ adjust[side], -offset[side] ] : [ -adjust[side], offset[side] ];
2525
-
2526
- if( (shift[xy] = Math.max(props[0], props[1])) > props[0] ) {
2527
- pos[side] -= adjust[side];
2528
- shift[side] = FALSE;
2529
- }
2530
-
2531
- css[ offset[opposite] !== undefined ? opposite : side ] = shift[xy];
2532
- }
2533
- }
2534
-
2535
- // If our tip position isn't fixed e.g. doesn't adjust with viewport...
2536
- if(this.corner.fixed !== TRUE) {
2537
- // Perform shift/flip adjustments
2538
- shiftflip(horizontal, X, Y, LEFT, RIGHT);
2539
- shiftflip(vertical, Y, X, TOP, BOTTOM);
2540
-
2541
- // Update and redraw the tip if needed (check cached details of last drawn tip)
2542
- if(newCorner.string() !== cache.corner.string() || cache.cornerTop !== adjust.top || cache.cornerLeft !== adjust.left) {
2543
- this.update(newCorner, FALSE);
2544
- }
2545
- }
2546
-
2547
- // Setup tip offset properties
2548
- offset = this.calculate(newCorner);
2549
-
2550
- // Readjust offset object to make it left/top
2551
- if(offset.right !== undefined) { offset.left = -offset.right; }
2552
- if(offset.bottom !== undefined) { offset.top = -offset.bottom; }
2553
- offset.user = this.offset;
2554
-
2555
- // Perform shift adjustments
2556
- shift.left = horizontal === SHIFT && !!adjust.left;
2557
- if(shift.left) {
2558
- shiftonly(X, LEFT, RIGHT);
2559
- }
2560
- shift.top = vertical === SHIFT && !!adjust.top;
2561
- if(shift.top) {
2562
- shiftonly(Y, TOP, BOTTOM);
2563
- }
2564
-
2565
- /*
2566
- * If the tip is adjusted in both dimensions, or in a
2567
- * direction that would cause it to be anywhere but the
2568
- * outer border, hide it!
2569
- */
2570
- this.element.css(css).toggle(
2571
- !(shift.x && shift.y || newCorner.x === CENTER && shift.y || newCorner.y === CENTER && shift.x)
2572
- );
2573
-
2574
- // Adjust position to accomodate tip dimensions
2575
- pos.left -= offset.left.charAt ? offset.user :
2576
- horizontal !== SHIFT || shift.top || !shift.left && !shift.top ? offset.left + this.border : 0;
2577
- pos.top -= offset.top.charAt ? offset.user :
2578
- vertical !== SHIFT || shift.left || !shift.left && !shift.top ? offset.top + this.border : 0;
2579
-
2580
- // Cache details
2581
- cache.cornerLeft = adjust.left; cache.cornerTop = adjust.top;
2582
- cache.corner = newCorner.clone();
2583
- },
2584
-
2585
- destroy: function() {
2586
- // Unbind events
2587
- this.qtip._unbind(this.qtip.tooltip, this._ns);
2588
-
2589
- // Remove the tip element(s)
2590
- if(this.qtip.elements.tip) {
2591
- this.qtip.elements.tip.find('*')
2592
- .remove().end().remove();
2593
- }
2594
- }
2595
- });
2596
-
2597
- TIP = PLUGINS.tip = function(api) {
2598
- return new Tip(api, api.options.style.tip);
2599
- };
2600
-
2601
- // Initialize tip on render
2602
- TIP.initialize = 'render';
2603
-
2604
- // Setup plugin sanitization options
2605
- TIP.sanitize = function(options) {
2606
- if(options.style && 'tip' in options.style) {
2607
- var opts = options.style.tip;
2608
- if(typeof opts !== 'object') { opts = options.style.tip = { corner: opts }; }
2609
- if(!(/string|boolean/i).test(typeof opts.corner)) { opts.corner = TRUE; }
2610
- }
2611
- };
2612
-
2613
- // Add new option checks for the plugin
2614
- CHECKS.tip = {
2615
- '^position.my|style.tip.(corner|mimic|border)$': function() {
2616
- // Make sure a tip can be drawn
2617
- this.create();
2618
-
2619
- // Reposition the tooltip
2620
- this.qtip.reposition();
2621
- },
2622
- '^style.tip.(height|width)$': function(obj) {
2623
- // Re-set dimensions and redraw the tip
2624
- this.size = [ obj.width, obj.height ];
2625
- this.update();
2626
-
2627
- // Reposition the tooltip
2628
- this.qtip.reposition();
2629
- },
2630
- '^content.title|style.(classes|widget)$': function() {
2631
- this.update();
2632
- }
2633
- };
2634
-
2635
- // Extend original qTip defaults
2636
- $.extend(TRUE, QTIP.defaults, {
2637
- style: {
2638
- tip: {
2639
- corner: TRUE,
2640
- mimic: FALSE,
2641
- width: 6,
2642
- height: 6,
2643
- border: TRUE,
2644
- offset: 0
2645
- }
2646
- }
2647
- });
2648
- ;var MODAL, OVERLAY,
2649
- MODALCLASS = 'qtip-modal',
2650
- MODALSELECTOR = '.'+MODALCLASS;
2651
-
2652
- OVERLAY = function()
2653
- {
2654
- var self = this,
2655
- focusableElems = {},
2656
- current,
2657
- prevState,
2658
- elem;
2659
-
2660
- // Modified code from jQuery UI 1.10.0 source
2661
- // http://code.jquery.com/ui/1.10.0/jquery-ui.js
2662
- function focusable(element) {
2663
- // Use the defined focusable checker when possible
2664
- if($.expr[':'].focusable) { return $.expr[':'].focusable; }
2665
-
2666
- var isTabIndexNotNaN = !isNaN($.attr(element, 'tabindex')),
2667
- nodeName = element.nodeName && element.nodeName.toLowerCase(),
2668
- map, mapName, img;
2669
-
2670
- if('area' === nodeName) {
2671
- map = element.parentNode;
2672
- mapName = map.name;
2673
- if(!element.href || !mapName || map.nodeName.toLowerCase() !== 'map') {
2674
- return false;
2675
- }
2676
- img = $('img[usemap=#' + mapName + ']')[0];
2677
- return !!img && img.is(':visible');
2678
- }
2679
-
2680
- return /input|select|textarea|button|object/.test( nodeName ) ?
2681
- !element.disabled :
2682
- 'a' === nodeName ?
2683
- element.href || isTabIndexNotNaN :
2684
- isTabIndexNotNaN
2685
- ;
2686
- }
2687
-
2688
- // Focus inputs using cached focusable elements (see update())
2689
- function focusInputs(blurElems) {
2690
- // Blurring body element in IE causes window.open windows to unfocus!
2691
- if(focusableElems.length < 1 && blurElems.length) { blurElems.not('body').blur(); }
2692
-
2693
- // Focus the inputs
2694
- else { focusableElems.first().focus(); }
2695
- }
2696
-
2697
- // Steal focus from elements outside tooltip
2698
- function stealFocus(event) {
2699
- if(!elem.is(':visible')) { return; }
2700
-
2701
- var target = $(event.target),
2702
- tooltip = current.tooltip,
2703
- container = target.closest(SELECTOR),
2704
- targetOnTop;
2705
-
2706
- // Determine if input container target is above this
2707
- targetOnTop = container.length < 1 ? FALSE :
2708
- parseInt(container[0].style.zIndex, 10) > parseInt(tooltip[0].style.zIndex, 10);
2709
-
2710
- // If we're showing a modal, but focus has landed on an input below
2711
- // this modal, divert focus to the first visible input in this modal
2712
- // or if we can't find one... the tooltip itself
2713
- if(!targetOnTop && target.closest(SELECTOR)[0] !== tooltip[0]) {
2714
- focusInputs(target);
2715
- }
2716
- }
2717
-
2718
- $.extend(self, {
2719
- init: function() {
2720
- // Create document overlay
2721
- elem = self.elem = $('<div />', {
2722
- id: 'qtip-overlay',
2723
- html: '<div></div>',
2724
- mousedown: function() { return FALSE; }
2725
- })
2726
- .hide();
2727
-
2728
- // Make sure we can't focus anything outside the tooltip
2729
- $(document.body).bind('focusin'+MODALSELECTOR, stealFocus);
2730
-
2731
- // Apply keyboard "Escape key" close handler
2732
- $(document).bind('keydown'+MODALSELECTOR, function(event) {
2733
- if(current && current.options.show.modal.escape && event.keyCode === 27) {
2734
- current.hide(event);
2735
- }
2736
- });
2737
-
2738
- // Apply click handler for blur option
2739
- elem.bind('click'+MODALSELECTOR, function(event) {
2740
- if(current && current.options.show.modal.blur) {
2741
- current.hide(event);
2742
- }
2743
- });
2744
-
2745
- return self;
2746
- },
2747
-
2748
- update: function(api) {
2749
- // Update current API reference
2750
- current = api;
2751
-
2752
- // Update focusable elements if enabled
2753
- if(api.options.show.modal.stealfocus !== FALSE) {
2754
- focusableElems = api.tooltip.find('*').filter(function() {
2755
- return focusable(this);
2756
- });
2757
- }
2758
- else { focusableElems = []; }
2759
- },
2760
-
2761
- toggle: function(api, state, duration) {
2762
- var tooltip = api.tooltip,
2763
- options = api.options.show.modal,
2764
- effect = options.effect,
2765
- type = state ? 'show': 'hide',
2766
- visible = elem.is(':visible'),
2767
- visibleModals = $(MODALSELECTOR).filter(':visible:not(:animated)').not(tooltip);
2768
-
2769
- // Set active tooltip API reference
2770
- self.update(api);
2771
-
2772
- // If the modal can steal the focus...
2773
- // Blur the current item and focus anything in the modal we an
2774
- if(state && options.stealfocus !== FALSE) {
2775
- focusInputs( $(':focus') );
2776
- }
2777
-
2778
- // Toggle backdrop cursor style on show
2779
- elem.toggleClass('blurs', options.blur);
2780
-
2781
- // Append to body on show
2782
- if(state) {
2783
- elem.appendTo(document.body);
2784
- }
2785
-
2786
- // Prevent modal from conflicting with show.solo, and don't hide backdrop is other modals are visible
2787
- if(elem.is(':animated') && visible === state && prevState !== FALSE || !state && visibleModals.length) {
2788
- return self;
2789
- }
2790
-
2791
- // Stop all animations
2792
- elem.stop(TRUE, FALSE);
2793
-
2794
- // Use custom function if provided
2795
- if($.isFunction(effect)) {
2796
- effect.call(elem, state);
2797
- }
2798
-
2799
- // If no effect type is supplied, use a simple toggle
2800
- else if(effect === FALSE) {
2801
- elem[ type ]();
2802
- }
2803
-
2804
- // Use basic fade function
2805
- else {
2806
- elem.fadeTo( parseInt(duration, 10) || 90, state ? 1 : 0, function() {
2807
- if(!state) { elem.hide(); }
2808
- });
2809
- }
2810
-
2811
- // Reset position and detach from body on hide
2812
- if(!state) {
2813
- elem.queue(function(next) {
2814
- elem.css({ left: '', top: '' });
2815
- if(!$(MODALSELECTOR).length) { elem.detach(); }
2816
- next();
2817
- });
2818
- }
2819
-
2820
- // Cache the state
2821
- prevState = state;
2822
-
2823
- // If the tooltip is destroyed, set reference to null
2824
- if(current.destroyed) { current = NULL; }
2825
-
2826
- return self;
2827
- }
2828
- });
2829
-
2830
- self.init();
2831
- };
2832
- OVERLAY = new OVERLAY();
2833
-
2834
- function Modal(api, options) {
2835
- this.options = options;
2836
- this._ns = '-modal';
2837
-
2838
- this.qtip = api;
2839
- this.init(api);
2840
- }
2841
-
2842
- $.extend(Modal.prototype, {
2843
- init: function(qtip) {
2844
- var tooltip = qtip.tooltip;
2845
-
2846
- // If modal is disabled... return
2847
- if(!this.options.on) { return this; }
2848
-
2849
- // Set overlay reference
2850
- qtip.elements.overlay = OVERLAY.elem;
2851
-
2852
- // Add unique attribute so we can grab modal tooltips easily via a SELECTOR, and set z-index
2853
- tooltip.addClass(MODALCLASS).css('z-index', QTIP.modal_zindex + $(MODALSELECTOR).length);
2854
-
2855
- // Apply our show/hide/focus modal events
2856
- qtip._bind(tooltip, ['tooltipshow', 'tooltiphide'], function(event, api, duration) {
2857
- var oEvent = event.originalEvent;
2858
-
2859
- // Make sure mouseout doesn't trigger a hide when showing the modal and mousing onto backdrop
2860
- if(event.target === tooltip[0]) {
2861
- if(oEvent && event.type === 'tooltiphide' && /mouse(leave|enter)/.test(oEvent.type) && $(oEvent.relatedTarget).closest(OVERLAY.elem[0]).length) {
2862
- /* eslint-disable no-empty */
2863
- try { event.preventDefault(); }
2864
- catch(e) {}
2865
- /* eslint-enable no-empty */
2866
- }
2867
- else if(!oEvent || oEvent && oEvent.type !== 'tooltipsolo') {
2868
- this.toggle(event, event.type === 'tooltipshow', duration);
2869
- }
2870
- }
2871
- }, this._ns, this);
2872
-
2873
- // Adjust modal z-index on tooltip focus
2874
- qtip._bind(tooltip, 'tooltipfocus', function(event, api) {
2875
- // If focus was cancelled before it reached us, don't do anything
2876
- if(event.isDefaultPrevented() || event.target !== tooltip[0]) { return; }
2877
-
2878
- var qtips = $(MODALSELECTOR),
2879
-
2880
- // Keep the modal's lower than other, regular qtips
2881
- newIndex = QTIP.modal_zindex + qtips.length,
2882
- curIndex = parseInt(tooltip[0].style.zIndex, 10);
2883
-
2884
- // Set overlay z-index
2885
- OVERLAY.elem[0].style.zIndex = newIndex - 1;
2886
-
2887
- // Reduce modal z-index's and keep them properly ordered
2888
- qtips.each(function() {
2889
- if(this.style.zIndex > curIndex) {
2890
- this.style.zIndex -= 1;
2891
- }
2892
- });
2893
-
2894
- // Fire blur event for focused tooltip
2895
- qtips.filter('.' + CLASS_FOCUS).qtip('blur', event.originalEvent);
2896
-
2897
- // Set the new z-index
2898
- tooltip.addClass(CLASS_FOCUS)[0].style.zIndex = newIndex;
2899
-
2900
- // Set current
2901
- OVERLAY.update(api);
2902
-
2903
- // Prevent default handling
2904
- /* eslint-disable no-empty */
2905
- try { event.preventDefault(); }
2906
- catch(e) {}
2907
- /* eslint-enable no-empty */
2908
- }, this._ns, this);
2909
-
2910
- // Focus any other visible modals when this one hides
2911
- qtip._bind(tooltip, 'tooltiphide', function(event) {
2912
- if(event.target === tooltip[0]) {
2913
- $(MODALSELECTOR).filter(':visible').not(tooltip).last().qtip('focus', event);
2914
- }
2915
- }, this._ns, this);
2916
- },
2917
-
2918
- toggle: function(event, state, duration) {
2919
- // Make sure default event hasn't been prevented
2920
- if(event && event.isDefaultPrevented()) { return this; }
2921
-
2922
- // Toggle it
2923
- OVERLAY.toggle(this.qtip, !!state, duration);
2924
- },
2925
-
2926
- destroy: function() {
2927
- // Remove modal class
2928
- this.qtip.tooltip.removeClass(MODALCLASS);
2929
-
2930
- // Remove bound events
2931
- this.qtip._unbind(this.qtip.tooltip, this._ns);
2932
-
2933
- // Delete element reference
2934
- OVERLAY.toggle(this.qtip, FALSE);
2935
- delete this.qtip.elements.overlay;
2936
- }
2937
- });
2938
-
2939
-
2940
- MODAL = PLUGINS.modal = function(api) {
2941
- return new Modal(api, api.options.show.modal);
2942
- };
2943
-
2944
- // Setup sanitiztion rules
2945
- MODAL.sanitize = function(opts) {
2946
- if(opts.show) {
2947
- if(typeof opts.show.modal !== 'object') { opts.show.modal = { on: !!opts.show.modal }; }
2948
- else if(typeof opts.show.modal.on === 'undefined') { opts.show.modal.on = TRUE; }
2949
- }
2950
- };
2951
-
2952
- // Base z-index for all modal tooltips (use qTip core z-index as a base)
2953
- /* eslint-disable camelcase */
2954
- QTIP.modal_zindex = QTIP.zindex - 200;
2955
- /* eslint-enable camelcase */
2956
-
2957
- // Plugin needs to be initialized on render
2958
- MODAL.initialize = 'render';
2959
-
2960
- // Setup option set checks
2961
- CHECKS.modal = {
2962
- '^show.modal.(on|blur)$': function() {
2963
- // Initialise
2964
- this.destroy();
2965
- this.init();
2966
-
2967
- // Show the modal if not visible already and tooltip is visible
2968
- this.qtip.elems.overlay.toggle(
2969
- this.qtip.tooltip[0].offsetWidth > 0
2970
- );
2971
- }
2972
- };
2973
-
2974
- // Extend original api defaults
2975
- $.extend(TRUE, QTIP.defaults, {
2976
- show: {
2977
- modal: {
2978
- on: FALSE,
2979
- effect: TRUE,
2980
- blur: TRUE,
2981
- stealfocus: TRUE,
2982
- escape: TRUE
2983
- }
2984
- }
2985
- });
2986
- ;PLUGINS.viewport = function(api, position, posOptions, targetWidth, targetHeight, elemWidth, elemHeight)
2987
- {
2988
- var target = posOptions.target,
2989
- tooltip = api.elements.tooltip,
2990
- my = posOptions.my,
2991
- at = posOptions.at,
2992
- adjust = posOptions.adjust,
2993
- method = adjust.method.split(' '),
2994
- methodX = method[0],
2995
- methodY = method[1] || method[0],
2996
- viewport = posOptions.viewport,
2997
- container = posOptions.container,
2998
- adjusted = { left: 0, top: 0 },
2999
- fixed, newMy, containerOffset, containerStatic,
3000
- viewportWidth, viewportHeight, viewportScroll, viewportOffset;
3001
-
3002
- // If viewport is not a jQuery element, or it's the window/document, or no adjustment method is used... return
3003
- if(!viewport.jquery || target[0] === window || target[0] === document.body || adjust.method === 'none') {
3004
- return adjusted;
3005
- }
3006
-
3007
- // Cach container details
3008
- containerOffset = container.offset() || adjusted;
3009
- containerStatic = container.css('position') === 'static';
3010
-
3011
- // Cache our viewport details
3012
- fixed = tooltip.css('position') === 'fixed';
3013
- viewportWidth = viewport[0] === window ? viewport.width() : viewport.outerWidth(FALSE);
3014
- viewportHeight = viewport[0] === window ? viewport.height() : viewport.outerHeight(FALSE);
3015
- viewportScroll = { left: fixed ? 0 : viewport.scrollLeft(), top: fixed ? 0 : viewport.scrollTop() };
3016
- viewportOffset = viewport.offset() || adjusted;
3017
-
3018
- // Generic calculation method
3019
- function calculate(side, otherSide, type, adjustment, side1, side2, lengthName, targetLength, elemLength) {
3020
- var initialPos = position[side1],
3021
- mySide = my[side],
3022
- atSide = at[side],
3023
- isShift = type === SHIFT,
3024
- myLength = mySide === side1 ? elemLength : mySide === side2 ? -elemLength : -elemLength / 2,
3025
- atLength = atSide === side1 ? targetLength : atSide === side2 ? -targetLength : -targetLength / 2,
3026
- sideOffset = viewportScroll[side1] + viewportOffset[side1] - (containerStatic ? 0 : containerOffset[side1]),
3027
- overflow1 = sideOffset - initialPos,
3028
- overflow2 = initialPos + elemLength - (lengthName === WIDTH ? viewportWidth : viewportHeight) - sideOffset,
3029
- offset = myLength - (my.precedance === side || mySide === my[otherSide] ? atLength : 0) - (atSide === CENTER ? targetLength / 2 : 0);
3030
-
3031
- // shift
3032
- if(isShift) {
3033
- offset = (mySide === side1 ? 1 : -1) * myLength;
3034
-
3035
- // Adjust position but keep it within viewport dimensions
3036
- position[side1] += overflow1 > 0 ? overflow1 : overflow2 > 0 ? -overflow2 : 0;
3037
- position[side1] = Math.max(
3038
- -containerOffset[side1] + viewportOffset[side1],
3039
- initialPos - offset,
3040
- Math.min(
3041
- Math.max(
3042
- -containerOffset[side1] + viewportOffset[side1] + (lengthName === WIDTH ? viewportWidth : viewportHeight),
3043
- initialPos + offset
3044
- ),
3045
- position[side1],
3046
-
3047
- // Make sure we don't adjust complete off the element when using 'center'
3048
- mySide === 'center' ? initialPos - myLength : 1E9
3049
- )
3050
- );
3051
-
3052
- }
3053
-
3054
- // flip/flipinvert
3055
- else {
3056
- // Update adjustment amount depending on if using flipinvert or flip
3057
- adjustment *= type === FLIPINVERT ? 2 : 0;
3058
-
3059
- // Check for overflow on the left/top
3060
- if(overflow1 > 0 && (mySide !== side1 || overflow2 > 0)) {
3061
- position[side1] -= offset + adjustment;
3062
- newMy.invert(side, side1);
3063
- }
3064
-
3065
- // Check for overflow on the bottom/right
3066
- else if(overflow2 > 0 && (mySide !== side2 || overflow1 > 0) ) {
3067
- position[side1] -= (mySide === CENTER ? -offset : offset) + adjustment;
3068
- newMy.invert(side, side2);
3069
- }
3070
-
3071
- // Make sure we haven't made things worse with the adjustment and reset if so
3072
- if(position[side1] < viewportScroll[side1] && -position[side1] > overflow2) {
3073
- position[side1] = initialPos; newMy = my.clone();
3074
- }
3075
- }
3076
-
3077
- return position[side1] - initialPos;
3078
- }
3079
-
3080
- // Set newMy if using flip or flipinvert methods
3081
- if(methodX !== 'shift' || methodY !== 'shift') { newMy = my.clone(); }
3082
-
3083
- // Adjust position based onviewport and adjustment options
3084
- adjusted = {
3085
- left: methodX !== 'none' ? calculate( X, Y, methodX, adjust.x, LEFT, RIGHT, WIDTH, targetWidth, elemWidth ) : 0,
3086
- top: methodY !== 'none' ? calculate( Y, X, methodY, adjust.y, TOP, BOTTOM, HEIGHT, targetHeight, elemHeight ) : 0,
3087
- my: newMy
3088
- };
3089
-
3090
- return adjusted;
3091
- };
3092
- ;PLUGINS.polys = {
3093
- // POLY area coordinate calculator
3094
- // Special thanks to Ed Cradock for helping out with this.
3095
- // Uses a binary search algorithm to find suitable coordinates.
3096
- polygon: function(baseCoords, corner) {
3097
- var result = {
3098
- width: 0, height: 0,
3099
- position: {
3100
- top: 1e10, right: 0,
3101
- bottom: 0, left: 1e10
3102
- },
3103
- adjustable: FALSE
3104
- },
3105
- i = 0, next,
3106
- coords = [],
3107
- compareX = 1, compareY = 1,
3108
- realX = 0, realY = 0,
3109
- newWidth, newHeight;
3110
-
3111
- // First pass, sanitize coords and determine outer edges
3112
- i = baseCoords.length;
3113
- while(i--) {
3114
- next = [ parseInt(baseCoords[--i], 10), parseInt(baseCoords[i+1], 10) ];
3115
-
3116
- if(next[0] > result.position.right){ result.position.right = next[0]; }
3117
- if(next[0] < result.position.left){ result.position.left = next[0]; }
3118
- if(next[1] > result.position.bottom){ result.position.bottom = next[1]; }
3119
- if(next[1] < result.position.top){ result.position.top = next[1]; }
3120
-
3121
- coords.push(next);
3122
- }
3123
-
3124
- // Calculate height and width from outer edges
3125
- newWidth = result.width = Math.abs(result.position.right - result.position.left);
3126
- newHeight = result.height = Math.abs(result.position.bottom - result.position.top);
3127
-
3128
- // If it's the center corner...
3129
- if(corner.abbrev() === 'c') {
3130
- result.position = {
3131
- left: result.position.left + result.width / 2,
3132
- top: result.position.top + result.height / 2
3133
- };
3134
- }
3135
- else {
3136
- // Second pass, use a binary search algorithm to locate most suitable coordinate
3137
- while(newWidth > 0 && newHeight > 0 && compareX > 0 && compareY > 0)
3138
- {
3139
- newWidth = Math.floor(newWidth / 2);
3140
- newHeight = Math.floor(newHeight / 2);
3141
-
3142
- if(corner.x === LEFT){ compareX = newWidth; }
3143
- else if(corner.x === RIGHT){ compareX = result.width - newWidth; }
3144
- else{ compareX += Math.floor(newWidth / 2); }
3145
-
3146
- if(corner.y === TOP){ compareY = newHeight; }
3147
- else if(corner.y === BOTTOM){ compareY = result.height - newHeight; }
3148
- else{ compareY += Math.floor(newHeight / 2); }
3149
-
3150
- i = coords.length;
3151
- while(i--)
3152
- {
3153
- if(coords.length < 2){ break; }
3154
-
3155
- realX = coords[i][0] - result.position.left;
3156
- realY = coords[i][1] - result.position.top;
3157
-
3158
- if(
3159
- corner.x === LEFT && realX >= compareX ||
3160
- corner.x === RIGHT && realX <= compareX ||
3161
- corner.x === CENTER && (realX < compareX || realX > result.width - compareX) ||
3162
- corner.y === TOP && realY >= compareY ||
3163
- corner.y === BOTTOM && realY <= compareY ||
3164
- corner.y === CENTER && (realY < compareY || realY > result.height - compareY)) {
3165
- coords.splice(i, 1);
3166
- }
3167
- }
3168
- }
3169
- result.position = { left: coords[0][0], top: coords[0][1] };
3170
- }
3171
-
3172
- return result;
3173
- },
3174
-
3175
- rect: function(ax, ay, bx, by) {
3176
- return {
3177
- width: Math.abs(bx - ax),
3178
- height: Math.abs(by - ay),
3179
- position: {
3180
- left: Math.min(ax, bx),
3181
- top: Math.min(ay, by)
3182
- }
3183
- };
3184
- },
3185
-
3186
- _angles: {
3187
- tc: 3 / 2, tr: 7 / 4, tl: 5 / 4,
3188
- bc: 1 / 2, br: 1 / 4, bl: 3 / 4,
3189
- rc: 2, lc: 1, c: 0
3190
- },
3191
- ellipse: function(cx, cy, rx, ry, corner) {
3192
- var c = PLUGINS.polys._angles[ corner.abbrev() ],
3193
- rxc = c === 0 ? 0 : rx * Math.cos( c * Math.PI ),
3194
- rys = ry * Math.sin( c * Math.PI );
3195
-
3196
- return {
3197
- width: rx * 2 - Math.abs(rxc),
3198
- height: ry * 2 - Math.abs(rys),
3199
- position: {
3200
- left: cx + rxc,
3201
- top: cy + rys
3202
- },
3203
- adjustable: FALSE
3204
- };
3205
- },
3206
- circle: function(cx, cy, r, corner) {
3207
- return PLUGINS.polys.ellipse(cx, cy, r, r, corner);
3208
- }
3209
- };
3210
- ;PLUGINS.svg = function(api, svg, corner)
3211
- {
3212
- var elem = svg[0],
3213
- root = $(elem.ownerSVGElement),
3214
- ownerDocument = elem.ownerDocument,
3215
- strokeWidth2 = (parseInt(svg.css('stroke-width'), 10) || 0) / 2,
3216
- frameOffset, mtx, transformed,
3217
- len, next, i, points,
3218
- result, position;
3219
-
3220
- // Ascend the parentNode chain until we find an element with getBBox()
3221
- while(!elem.getBBox) { elem = elem.parentNode; }
3222
- if(!elem.getBBox || !elem.parentNode) { return FALSE; }
3223
-
3224
- // Determine which shape calculation to use
3225
- switch(elem.nodeName) {
3226
- case 'ellipse':
3227
- case 'circle':
3228
- result = PLUGINS.polys.ellipse(
3229
- elem.cx.baseVal.value,
3230
- elem.cy.baseVal.value,
3231
- (elem.rx || elem.r).baseVal.value + strokeWidth2,
3232
- (elem.ry || elem.r).baseVal.value + strokeWidth2,
3233
- corner
3234
- );
3235
- break;
3236
-
3237
- case 'line':
3238
- case 'polygon':
3239
- case 'polyline':
3240
- // Determine points object (line has none, so mimic using array)
3241
- points = elem.points || [
3242
- { x: elem.x1.baseVal.value, y: elem.y1.baseVal.value },
3243
- { x: elem.x2.baseVal.value, y: elem.y2.baseVal.value }
3244
- ];
3245
-
3246
- for(result = [], i = -1, len = points.numberOfItems || points.length; ++i < len;) {
3247
- next = points.getItem ? points.getItem(i) : points[i];
3248
- result.push.apply(result, [next.x, next.y]);
3249
- }
3250
-
3251
- result = PLUGINS.polys.polygon(result, corner);
3252
- break;
3253
-
3254
- // Unknown shape or rectangle? Use bounding box
3255
- default:
3256
- result = elem.getBBox();
3257
- result = {
3258
- width: result.width,
3259
- height: result.height,
3260
- position: {
3261
- left: result.x,
3262
- top: result.y
3263
- }
3264
- };
3265
- break;
3266
- }
3267
-
3268
- // Shortcut assignments
3269
- position = result.position;
3270
- root = root[0];
3271
-
3272
- // Convert position into a pixel value
3273
- if(root.createSVGPoint) {
3274
- mtx = elem.getScreenCTM();
3275
- points = root.createSVGPoint();
3276
-
3277
- points.x = position.left;
3278
- points.y = position.top;
3279
- transformed = points.matrixTransform( mtx );
3280
- position.left = transformed.x;
3281
- position.top = transformed.y;
3282
- }
3283
-
3284
- // Check the element is not in a child document, and if so, adjust for frame elements offset
3285
- if(ownerDocument !== document && api.position.target !== 'mouse') {
3286
- frameOffset = $((ownerDocument.defaultView || ownerDocument.parentWindow).frameElement).offset();
3287
- if(frameOffset) {
3288
- position.left += frameOffset.left;
3289
- position.top += frameOffset.top;
3290
- }
3291
- }
3292
-
3293
- // Adjust by scroll offset of owner document
3294
- ownerDocument = $(ownerDocument);
3295
- position.left += ownerDocument.scrollLeft();
3296
- position.top += ownerDocument.scrollTop();
3297
-
3298
- return result;
3299
- };
3300
- ;PLUGINS.imagemap = function(api, area, corner)
3301
- {
3302
- if(!area.jquery) { area = $(area); }
3303
-
3304
- var shape = (area.attr('shape') || 'rect').toLowerCase().replace('poly', 'polygon'),
3305
- image = $('img[usemap="#'+area.parent('map').attr('name')+'"]'),
3306
- coordsString = $.trim(area.attr('coords')),
3307
- coordsArray = coordsString.replace(/,$/, '').split(','),
3308
- imageOffset, coords, i, result, len;
3309
-
3310
- // If we can't find the image using the map...
3311
- if(!image.length) { return FALSE; }
3312
-
3313
- // Pass coordinates string if polygon
3314
- if(shape === 'polygon') {
3315
- result = PLUGINS.polys.polygon(coordsArray, corner);
3316
- }
3317
-
3318
- // Otherwise parse the coordinates and pass them as arguments
3319
- else if(PLUGINS.polys[shape]) {
3320
- for(i = -1, len = coordsArray.length, coords = []; ++i < len;) {
3321
- coords.push( parseInt(coordsArray[i], 10) );
3322
- }
3323
-
3324
- result = PLUGINS.polys[shape].apply(
3325
- this, coords.concat(corner)
3326
- );
3327
- }
3328
-
3329
- // If no shapre calculation method was found, return false
3330
- else { return FALSE; }
3331
-
3332
- // Make sure we account for padding and borders on the image
3333
- imageOffset = image.offset();
3334
- imageOffset.left += Math.ceil((image.outerWidth(FALSE) - image.width()) / 2);
3335
- imageOffset.top += Math.ceil((image.outerHeight(FALSE) - image.height()) / 2);
3336
-
3337
- // Add image position to offset coordinates
3338
- result.position.left += imageOffset.left;
3339
- result.position.top += imageOffset.top;
3340
-
3341
- return result;
3342
- };
3343
- ;var IE6,
3344
-
3345
- /*
3346
- * BGIFrame adaption (http://plugins.jquery.com/project/bgiframe)
3347
- * Special thanks to Brandon Aaron
3348
- */
3349
- BGIFRAME = '<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:\'\';" ' +
3350
- ' style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=0); ' +
3351
- '-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";"></iframe>';
3352
-
3353
- function Ie6(api) {
3354
- this._ns = 'ie6';
3355
-
3356
- this.qtip = api;
3357
- this.init(api);
3358
- }
3359
-
3360
- $.extend(Ie6.prototype, {
3361
- _scroll : function() {
3362
- var overlay = this.qtip.elements.overlay;
3363
- overlay && (overlay[0].style.top = $(window).scrollTop() + 'px');
3364
- },
3365
-
3366
- init: function(qtip) {
3367
- var tooltip = qtip.tooltip;
3368
-
3369
- // Create the BGIFrame element if needed
3370
- if($('select, object').length < 1) {
3371
- this.bgiframe = qtip.elements.bgiframe = $(BGIFRAME).appendTo(tooltip);
3372
-
3373
- // Update BGIFrame on tooltip move
3374
- qtip._bind(tooltip, 'tooltipmove', this.adjustBGIFrame, this._ns, this);
3375
- }
3376
-
3377
- // redraw() container for width/height calculations
3378
- this.redrawContainer = $('<div/>', { id: NAMESPACE+'-rcontainer' })
3379
- .appendTo(document.body);
3380
-
3381
- // Fixup modal plugin if present too
3382
- if( qtip.elements.overlay && qtip.elements.overlay.addClass('qtipmodal-ie6fix') ) {
3383
- qtip._bind(window, ['scroll', 'resize'], this._scroll, this._ns, this);
3384
- qtip._bind(tooltip, ['tooltipshow'], this._scroll, this._ns, this);
3385
- }
3386
-
3387
- // Set dimensions
3388
- this.redraw();
3389
- },
3390
-
3391
- adjustBGIFrame: function() {
3392
- var tooltip = this.qtip.tooltip,
3393
- dimensions = {
3394
- height: tooltip.outerHeight(FALSE),
3395
- width: tooltip.outerWidth(FALSE)
3396
- },
3397
- plugin = this.qtip.plugins.tip,
3398
- tip = this.qtip.elements.tip,
3399
- tipAdjust, offset;
3400
-
3401
- // Adjust border offset
3402
- offset = parseInt(tooltip.css('borderLeftWidth'), 10) || 0;
3403
- offset = { left: -offset, top: -offset };
3404
-
3405
- // Adjust for tips plugin
3406
- if(plugin && tip) {
3407
- tipAdjust = plugin.corner.precedance === 'x' ? [WIDTH, LEFT] : [HEIGHT, TOP];
3408
- offset[ tipAdjust[1] ] -= tip[ tipAdjust[0] ]();
3409
- }
3410
-
3411
- // Update bgiframe
3412
- this.bgiframe.css(offset).css(dimensions);
3413
- },
3414
-
3415
- // Max/min width simulator function
3416
- redraw: function() {
3417
- if(this.qtip.rendered < 1 || this.drawing) { return this; }
3418
-
3419
- var tooltip = this.qtip.tooltip,
3420
- style = this.qtip.options.style,
3421
- container = this.qtip.options.position.container,
3422
- perc, width, max, min;
3423
-
3424
- // Set drawing flag
3425
- this.qtip.drawing = 1;
3426
-
3427
- // If tooltip has a set height/width, just set it... like a boss!
3428
- if(style.height) { tooltip.css(HEIGHT, style.height); }
3429
- if(style.width) { tooltip.css(WIDTH, style.width); }
3430
-
3431
- // Simulate max/min width if not set width present...
3432
- else {
3433
- // Reset width and add fluid class
3434
- tooltip.css(WIDTH, '').appendTo(this.redrawContainer);
3435
-
3436
- // Grab our tooltip width (add 1 if odd so we don't get wrapping problems.. huzzah!)
3437
- width = tooltip.width();
3438
- if(width % 2 < 1) { width += 1; }
3439
-
3440
- // Grab our max/min properties
3441
- max = tooltip.css('maxWidth') || '';
3442
- min = tooltip.css('minWidth') || '';
3443
-
3444
- // Parse into proper pixel values
3445
- perc = (max + min).indexOf('%') > -1 ? container.width() / 100 : 0;
3446
- max = (max.indexOf('%') > -1 ? perc : 1 * parseInt(max, 10)) || width;
3447
- min = (min.indexOf('%') > -1 ? perc : 1 * parseInt(min, 10)) || 0;
3448
-
3449
- // Determine new dimension size based on max/min/current values
3450
- width = max + min ? Math.min(Math.max(width, min), max) : width;
3451
-
3452
- // Set the newly calculated width and remvoe fluid class
3453
- tooltip.css(WIDTH, Math.round(width)).appendTo(container);
3454
- }
3455
-
3456
- // Set drawing flag
3457
- this.drawing = 0;
3458
-
3459
- return this;
3460
- },
3461
-
3462
- destroy: function() {
3463
- // Remove iframe
3464
- this.bgiframe && this.bgiframe.remove();
3465
-
3466
- // Remove bound events
3467
- this.qtip._unbind([window, this.qtip.tooltip], this._ns);
3468
- }
3469
- });
3470
-
3471
- IE6 = PLUGINS.ie6 = function(api) {
3472
- // Proceed only if the browser is IE6
3473
- return BROWSER.ie === 6 ? new Ie6(api) : FALSE;
3474
- };
3475
-
3476
- IE6.initialize = 'render';
3477
-
3478
- CHECKS.ie6 = {
3479
- '^content|style$': function() {
3480
- this.redraw();
3481
- }
3482
- };
3483
- ;}));
3484
- }( window, document ));