Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
/* qTip2 v2.1.1 None | qtip2.com | Licensed MIT, GPL | Thu Jul 11 2013 14:03:06 */
(function(t,e,i){(function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery","imagesloaded"],t):jQuery&&!jQuery.fn.qtip&&t(jQuery)})(function(s){function o(t,e,i,o){this.id=i,this.target=t,this.tooltip=C,this.elements=elements={target:t},this._id=z+"-"+i,this.timers={img:{}},this.options=e,this.plugins={},this.cache=cache={event:{},target:s(),disabled:T,attr:o,onTooltip:T,lastClass:""},this.rendered=this.destroyed=this.disabled=this.waiting=this.hiddenDuringWait=this.positioning=this.triggering=T}function n(t){return t===C||"object"!==s.type(t)}function r(t){return!(s.isFunction(t)||t&&t.attr||t.length||"object"===s.type(t)&&(t.jquery||t.then))}function a(t){var e,i,o,a;return n(t)?T:(n(t.metadata)&&(t.metadata={type:t.metadata}),"content"in t&&(e=t.content,n(e)||e.jquery||e.done?e=t.content={text:i=r(e)?T:e}:i=e.text,"ajax"in e&&(o=e.ajax,a=o&&o.once!==T,delete e.ajax,e.text=function(t,e){var n=i||s(this).attr(e.options.content.attr)||"Loading...",r=s.ajax(s.extend({},o,{context:e})).then(o.success,C,o.error).then(function(t){return t&&a&&e.set("content.text",t),t},function(t,i,s){e.destroyed||0===t.status||e.set("content.text",i+": "+s)});return a?n:(e.set("content.text",n),r)}),"title"in e&&(n(e.title)||(e.button=e.title.button,e.title=e.title.text),r(e.title||T)&&(e.title=T))),"position"in t&&n(t.position)&&(t.position={my:t.position,at:t.position}),"show"in t&&n(t.show)&&(t.show=t.show.jquery?{target:t.show}:t.show===x?{ready:x}:{event:t.show}),"hide"in t&&n(t.hide)&&(t.hide=t.hide.jquery?{target:t.hide}:{event:t.hide}),"style"in t&&n(t.style)&&(t.style={classes:t.style}),s.each(B,function(){this.sanitize&&this.sanitize(t)}),t)}function h(t,e){for(var i,s=0,o=t,n=e.split(".");o=o[n[s++]];)n.length>s&&(i=o);return[i||t,n.pop()]}function d(t,e){var i,s,o;for(i in this.checks)for(s in this.checks[i])(o=RegExp(s,"i").exec(t))&&(e.push(o),("builtin"===i||this.plugins[i])&&this.checks[i][s].apply(this.plugins[i]||this,e))}function l(t){return A.concat("").join(t?"-"+t+" ":" ")}function c(t){if(this.tooltip.hasClass(M))return T;clearTimeout(this.timers.show),clearTimeout(this.timers.hide);var e=s.proxy(function(){this.toggle(x,t)},this);this.options.show.delay>0?this.timers.show=setTimeout(e,this.options.show.delay):e()}function u(t){if(this.tooltip.hasClass(M))return T;var e=s(t.relatedTarget),i=e.closest(F)[0]===this.tooltip[0],o=e[0]===this.options.show.target[0];if(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this!==e[0]&&"mouse"===this.options.position.target&&i||this.options.hide.fixed&&/mouse(out|leave|move)/.test(t.type)&&(i||o))try{t.preventDefault(),t.stopImmediatePropagation()}catch(n){}else{var r=s.proxy(function(){this.toggle(T,t)},this);this.options.hide.delay>0?this.timers.hide=setTimeout(r,this.options.hide.delay):r()}}function p(t){return this.tooltip.hasClass(M)||!this.options.hide.inactive?T:(clearTimeout(this.timers.inactive),this.timers.inactive=setTimeout(s.proxy(function(){this.hide(t)},this),this.options.hide.inactive),i)}function f(t){this.rendered&&this.tooltip[0].offsetWidth>0&&this.reposition(t)}function g(t,i,o){s(e.body).delegate(t,(i.split?i:i.join(V+" "))+V,function(){var t=v.api[s.attr(this,k)];t&&!t.disabled&&o.apply(t,arguments)})}function m(t,i,n){var r,h,d,l,c,u=s(e.body),p=t[0]===e?u:t,f=t.metadata?t.metadata(n.metadata):C,g="html5"===n.metadata.type&&f?f[n.metadata.name]:C,m=t.data(n.metadata.name||"qtipopts");try{m="string"==typeof m?s.parseJSON(m):m}catch(y){}if(l=s.extend(x,{},v.defaults,n,"object"==typeof m?a(m):C,a(g||f)),h=l.position,l.id=i,"boolean"==typeof l.content.text){if(d=t.attr(l.content.attr),l.content.attr===T||!d)return T;l.content.text=d}if(h.container.length||(h.container=u),h.target===T&&(h.target=p),l.show.target===T&&(l.show.target=p),l.show.solo===x&&(l.show.solo=h.container.closest("body")),l.hide.target===T&&(l.hide.target=p),l.position.viewport===x&&(l.position.viewport=h.container),h.container=h.container.eq(0),h.at=new b(h.at,x),h.my=new b(h.my),t.data(z))if(l.overwrite)t.qtip("destroy");else if(l.overwrite===T)return T;return t.attr(L,i),l.suppress&&(c=t.attr("title"))&&t.removeAttr("title").attr(P,c).attr("title",""),r=new o(t,l,i,!!d),t.data(z,r),t.one("remove.qtip-"+i+" removeqtip.qtip-"+i,function(){var t;(t=s(this).data(z))&&t.destroy()}),r}var v,y,b,w,_,x=!0,T=!1,C=null,j="x",q="y",W="top",E="left",S="bottom",O="right",R="center",B={},z="qtip",L="data-hasqtip",k="data-qtip-id",A=["ui-widget","ui-tooltip"],F="."+z,D="click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" "),X=z+"-fixed",$=z+"-default",Y=z+"-focus",I=z+"-hover",M=z+"-disabled",N="_replacedByqTip",P="oldtitle";BROWSER={ie:function(){for(var t=3,i=e.createElement("div");(i.innerHTML="<!--[if gt IE "+ ++t+"]><i></i><![endif]-->")&&i.getElementsByTagName("i")[0];);return t>4?t:0/0}(),iOS:parseFloat((""+(/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))||T},y=o.prototype,y.render=function(t){if(this.rendered||this.destroyed)return this;var e=this,i=this.options,o=this.cache,n=this.elements,r=i.content.text,a=i.content.title,h=i.content.button,d=i.position,l="."+this._id+" ",c=[];return s.attr(this.target[0],"aria-describedby",this._id),this.tooltip=n.tooltip=tooltip=s("<div/>",{id:this._id,"class":[z,$,i.style.classes,z+"-pos-"+i.position.my.abbrev()].join(" "),width:i.style.width||"",height:i.style.height||"",tracking:"mouse"===d.target&&d.adjust.mouse,role:"alert","aria-live":"polite","aria-atomic":T,"aria-describedby":this._id+"-content","aria-hidden":x}).toggleClass(M,this.disabled).attr(k,this.id).data(z,this).appendTo(d.container).append(n.content=s("<div />",{"class":z+"-content",id:this._id+"-content","aria-atomic":x})),this.rendered=-1,this.positioning=x,a&&(this._createTitle(),s.isFunction(a)||c.push(this._updateTitle(a,T))),h&&this._createButton(),s.isFunction(r)||c.push(this._updateContent(r,T)),this.rendered=x,this._setWidget(),s.each(i.events,function(t,e){s.isFunction(e)&&tooltip.bind(("toggle"===t?["tooltipshow","tooltiphide"]:["tooltip"+t]).join(l)+l,e)}),s.each(B,function(t){var i;"render"===this.initialize&&(i=this(e))&&(e.plugins[t]=i)}),this._assignEvents(),s.when.apply(s,c).then(function(){e._trigger("render"),e.positioning=T,e.hiddenDuringWait||!i.show.ready&&!t||e.toggle(x,o.event,T),e.hiddenDuringWait=T}),v.api[this.id]=this,this},y.destroy=function(t){function e(){if(!this.destroyed){this.destroyed=x;var t=this.target,e=t.attr(P);this.rendered&&this.tooltip.stop(1,0).find("*").remove().end().remove(),s.each(this.plugins,function(){this.destroy&&this.destroy()}),clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this._unassignEvents(),t.removeData(z).removeAttr(k).removeAttr("aria-describedby"),this.options.suppress&&e&&t.attr("title",e).removeAttr(P),this._unbind(t),this.options=this.elements=this.cache=this.timers=this.plugins=this.mouse=C,delete v.api[this.id]}}return this.destroyed?this.target:(t!==x&&this.rendered?(tooltip.one("tooltiphidden",s.proxy(e,this)),!this.triggering&&this.hide()):e.call(this),this.target)},w=y.checks={builtin:{"^id$":function(t,e,i,o){var n=i===x?v.nextid:i,r=z+"-"+n;n!==T&&n.length>0&&!s("#"+r).length?(this._id=r,this.rendered&&(this.tooltip[0].id=this._id,this.elements.content[0].id=this._id+"-content",this.elements.title[0].id=this._id+"-title")):t[e]=o},"^prerender":function(t,e,i){i&&!this.rendered&&this.render(this.options.show.ready)},"^content.text$":function(t,e,i){this._updateContent(i)},"^content.attr$":function(t,e,i,s){this.options.content.text===this.target.attr(s)&&this._updateContent(this.target.attr(i))},"^content.title$":function(t,e,s){return s?(s&&!this.elements.title&&this._createTitle(),this._updateTitle(s),i):this._removeTitle()},"^content.button$":function(t,e,i){this._updateButton(i)},"^content.title.(text|button)$":function(t,e,i){this.set("content."+e,i)},"^position.(my|at)$":function(t,e,i){"string"==typeof i&&(t[e]=new b(i,"at"===e))},"^position.container$":function(t,e,i){this.tooltip.appendTo(i)},"^show.ready$":function(t,e,i){i&&(!this.rendered&&this.render(x)||this.toggle(x))},"^style.classes$":function(t,e,i,s){this.tooltip.removeClass(s).addClass(i)},"^style.width|height":function(t,e,i){this.tooltip.css(e,i)},"^style.widget|content.title":function(){this._setWidget()},"^style.def":function(t,e,i){this.tooltip.toggleClass($,!!i)},"^events.(render|show|move|hide|focus|blur)$":function(t,e,i){tooltip[(s.isFunction(i)?"":"un")+"bind"]("tooltip"+e,i)},"^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)":function(){var t=this.options.position;tooltip.attr("tracking","mouse"===t.target&&t.adjust.mouse),this._unassignEvents(),this._assignEvents()}}},y.get=function(t){if(this.destroyed)return this;var e=h(this.options,t.toLowerCase()),i=e[0][e[1]];return i.precedance?i.string():i};var H=/^position\.(my|at|adjust|target|container|viewport)|style|content|show\.ready/i,Q=/^prerender|show\.ready/i;y.set=function(t,e){if(this.destroyed)return this;var o,n=this.rendered,r=T,l=this.options;return this.checks,"string"==typeof t?(o=t,t={},t[o]=e):t=s.extend({},t),s.each(t,function(e,o){if(!n&&!Q.test(e))return delete t[e],i;var a,d=h(l,e.toLowerCase());a=d[0][d[1]],d[0][d[1]]=o&&o.nodeType?s(o):o,r=H.test(e)||r,t[e]=[d[0],d[1],o,a]}),a(l),this.positioning=x,s.each(t,s.proxy(d,this)),this.positioning=T,this.rendered&&this.tooltip[0].offsetWidth>0&&r&&this.reposition("mouse"===l.position.target?C:this.cache.event),this},y._update=function(t,e){var i=this,o=this.cache;return this.rendered&&t?(s.isFunction(t)&&(t=t.call(this.elements.target,o.event,this)||""),s.isFunction(t.then)?(o.waiting=x,t.then(function(t){return o.waiting=T,i._update(t,e)},C,function(t){return i._update(t,e)})):t===T||!t&&""!==t?T:(t.jquery&&t.length>0?e.children().detach().end().append(t.css({display:"block"})):e.html(t),o.waiting=x,(s.fn.imagesLoaded?e.imagesLoaded():s.Deferred().resolve(s([]))).done(function(t){o.waiting=T,t.length&&i.rendered&&i.tooltip[0].offsetWidth>0&&i.reposition(o.event,!t.length)}).promise())):T},y._updateContent=function(t,e){this._update(t,this.elements.content,e)},y._updateTitle=function(t,e){this._update(t,this.elements.title,e)===T&&this._removeTitle(T)},y._createTitle=function(){var t=this.elements,e=this._id+"-title";t.titlebar&&this._removeTitle(),t.titlebar=s("<div />",{"class":z+"-titlebar "+(this.options.style.widget?l("header"):"")}).append(t.title=s("<div />",{id:e,"class":z+"-title","aria-atomic":x})).insertBefore(t.content).delegate(".qtip-close","mousedown keydown mouseup keyup mouseout",function(t){s(this).toggleClass("ui-state-active ui-state-focus","down"===t.type.substr(-4))}).delegate(".qtip-close","mouseover mouseout",function(t){s(this).toggleClass("ui-state-hover","mouseover"===t.type)}),this.options.content.button&&this._createButton()},y._removeTitle=function(t){var e=this.elements;e.title&&(e.titlebar.remove(),e.titlebar=e.title=e.button=C,t!==T&&this.reposition())},y.reposition=function(i,o){if(!this.rendered||this.positioning||this.destroyed)return this;this.positioning=x;var n,r,a=this.cache,h=this.tooltip,d=this.options.position,l=d.target,c=d.my,u=d.at,p=d.viewport,f=d.container,g=d.adjust,m=g.method.split(" "),v=h.outerWidth(T),y=h.outerHeight(T),b=0,w=0,_=h.css("position"),C={left:0,top:0},j=h[0].offsetWidth>0,q=i&&"scroll"===i.type,z=s(t),L=f[0].ownerDocument,k=this.mouse;if(s.isArray(l)&&2===l.length)u={x:E,y:W},C={left:l[0],top:l[1]};else if("mouse"===l&&(i&&i.pageX||a.event.pageX))u={x:E,y:W},i=!k||!k.pageX||!g.mouse&&i&&i.pageX?(!i||"resize"!==i.type&&"scroll"!==i.type?i&&i.pageX&&"mousemove"===i.type?i:(!g.mouse||this.options.show.distance)&&a.origin&&a.origin.pageX?a.origin:i:a.event)||i||a.event||k||{}:k,"static"!==_&&(C=f.offset()),L.body.offsetWidth!==(t.innerWidth||L.documentElement.clientWidth)&&(r=s(L.body).offset()),C={left:i.pageX-C.left+(r&&r.left||0),top:i.pageY-C.top+(r&&r.top||0)},g.mouse&&q&&(C.left-=k.scrollX-z.scrollLeft(),C.top-=k.scrollY-z.scrollTop());else{if("event"===l&&i&&i.target&&"scroll"!==i.type&&"resize"!==i.type?a.target=s(i.target):"event"!==l&&(a.target=s(l.jquery?l:elements.target)),l=a.target,l=s(l).eq(0),0===l.length)return this;l[0]===e||l[0]===t?(b=BROWSER.iOS?t.innerWidth:l.width(),w=BROWSER.iOS?t.innerHeight:l.height(),l[0]===t&&(C={top:(p||l).scrollTop(),left:(p||l).scrollLeft()})):B.imagemap&&l.is("area")?n=B.imagemap(this,l,u,B.viewport?m:T):B.svg&&l[0].ownerSVGElement?n=B.svg(this,l,u,B.viewport?m:T):(b=l.outerWidth(T),w=l.outerHeight(T),C=l.offset()),n&&(b=n.width,w=n.height,r=n.offset,C=n.position),C=this.reposition.offset(l,C,f),(BROWSER.iOS>3.1&&4.1>BROWSER.iOS||BROWSER.iOS>=4.3&&4.33>BROWSER.iOS||!BROWSER.iOS&&"fixed"===_)&&(C.left-=z.scrollLeft(),C.top-=z.scrollTop()),(!n||n&&n.adjustable!==T)&&(C.left+=u.x===O?b:u.x===R?b/2:0,C.top+=u.y===S?w:u.y===R?w/2:0)}return C.left+=g.x+(c.x===O?-v:c.x===R?-v/2:0),C.top+=g.y+(c.y===S?-y:c.y===R?-y/2:0),B.viewport?(C.adjusted=B.viewport(this,C,d,b,w,v,y),r&&C.adjusted.left&&(C.left+=r.left),r&&C.adjusted.top&&(C.top+=r.top)):C.adjusted={left:0,top:0},this._trigger("move",[C,p.elem||p],i)?(delete C.adjusted,o===T||!j||isNaN(C.left)||isNaN(C.top)||"mouse"===l||!s.isFunction(d.effect)?h.css(C):s.isFunction(d.effect)&&(d.effect.call(h,this,s.extend({},C)),h.queue(function(t){s(this).css({opacity:"",height:""}),BROWSER.ie&&this.style.removeAttribute("filter"),t()})),this.positioning=T,this):this},y.reposition.offset=function(t,i,o){function n(t,e){i.left+=e*t.scrollLeft(),i.top+=e*t.scrollTop()}if(!o[0])return i;var r,a,h,d,l=s(t[0].ownerDocument),c=!!BROWSER.ie&&"CSS1Compat"!==e.compatMode,u=o[0];do"static"!==(a=s.css(u,"position"))&&("fixed"===a?(h=u.getBoundingClientRect(),n(l,-1)):(h=s(u).position(),h.left+=parseFloat(s.css(u,"borderLeftWidth"))||0,h.top+=parseFloat(s.css(u,"borderTopWidth"))||0),i.left-=h.left+(parseFloat(s.css(u,"marginLeft"))||0),i.top-=h.top+(parseFloat(s.css(u,"marginTop"))||0),r||"hidden"===(d=s.css(u,"overflow"))||"visible"===d||(r=s(u)));while(u=u.offsetParent);return r&&(r[0]!==l[0]||c)&&n(r,1),i};var U=(b=y.reposition.Corner=function(t,e){t=(""+t).replace(/([A-Z])/," $1").replace(/middle/gi,R).toLowerCase(),this.x=(t.match(/left|right/i)||t.match(/center/)||["inherit"])[0].toLowerCase(),this.y=(t.match(/top|bottom|center/i)||["inherit"])[0].toLowerCase(),this.forceY=!!e;var i=t.charAt(0);this.precedance="t"===i||"b"===i?q:j}).prototype;U.invert=function(t,e){this[t]=this[t]===E?O:this[t]===O?E:e||this[t]},U.string=function(){var t=this.x,e=this.y;return t===e?t:this.precedance===q||this.forceY&&"center"!==e?e+" "+t:t+" "+e},U.abbrev=function(){var t=this.string().split(" ");return t[0].charAt(0)+(t[1]&&t[1].charAt(0)||"")},U.clone=function(){return new b(this.string(),this.forceY)},y.toggle=function(t,i){var o=this.cache,n=this.options,r=this.tooltip;if(i){if(/over|enter/.test(i.type)&&/out|leave/.test(o.event.type)&&n.show.target.add(i.target).length===n.show.target.length&&r.has(i.relatedTarget).length)return this;o.event=s.extend({},i)}if(this.waiting&&!t&&(this.hiddenDuringWait=x),!this.rendered)return t?this.render(1):this;if(this.destroyed||this.disabled)return this;var a,h,d=t?"show":"hide",l=this.options[d],c=(this.options[t?"hide":"show"],this.options.position),u=this.options.content,p=this.tooltip.css("width"),f=this.tooltip[0].offsetWidth>0,g=t||1===l.target.length,m=!i||2>l.target.length||o.target[0]===i.target;return(typeof t).search("boolean|number")&&(t=!f),a=!r.is(":animated")&&f===t&&m,h=a?C:!!this._trigger(d,[90]),h!==T&&t&&this.focus(i),!h||a?this:(s.attr(r[0],"aria-hidden",!t),t?(o.origin=s.extend({},this.mouse),s.isFunction(u.text)&&this._updateContent(u.text,T),s.isFunction(u.title)&&this._updateTitle(u.title,T),!_&&"mouse"===c.target&&c.adjust.mouse&&(s(e).bind("mousemove."+z,this._storeMouse),_=x),p||r.css("width",r.outerWidth(T)),this.reposition(i,arguments[2]),p||r.css("width",""),l.solo&&("string"==typeof l.solo?s(l.solo):s(F,l.solo)).not(r).not(l.target).qtip("hide",s.Event("tooltipsolo"))):(clearTimeout(this.timers.show),delete o.origin,_&&!s(F+'[tracking="true"]:visible',l.solo).not(r).length&&(s(e).unbind("mousemove."+z),_=T),this.blur(i)),after=s.proxy(function(){t?(BROWSER.ie&&r[0].style.removeAttribute("filter"),r.css("overflow",""),"string"==typeof l.autofocus&&s(this.options.show.autofocus,r).focus(),this.options.show.target.trigger("qtip-"+this.id+"-inactive")):r.css({display:"",visibility:"",opacity:"",left:"",top:""}),this._trigger(t?"visible":"hidden")},this),l.effect===T||g===T?(r[d](),after()):s.isFunction(l.effect)?(r.stop(1,1),l.effect.call(r,this),r.queue("fx",function(t){after(),t()})):r.fadeTo(90,t?1:0,after),t&&l.target.trigger("qtip-"+this.id+"-inactive"),this)},y.show=function(t){return this.toggle(x,t)},y.hide=function(t){return this.toggle(T,t)},y.focus=function(t){if(!this.rendered||this.destroyed)return this;var e=s(F),i=this.tooltip,o=parseInt(i[0].style.zIndex,10),n=v.zindex+e.length;return i.hasClass(Y)||this._trigger("focus",[n],t)&&(o!==n&&(e.each(function(){this.style.zIndex>o&&(this.style.zIndex=this.style.zIndex-1)}),e.filter("."+Y).qtip("blur",t)),i.addClass(Y)[0].style.zIndex=n),this},y.blur=function(t){return!this.rendered||this.destroyed?this:(this.tooltip.removeClass(Y),this._trigger("blur",[this.tooltip.css("zIndex")],t),this)},y.disable=function(t){return this.destroyed?this:("boolean"!=typeof t&&(t=!(this.tooltip.hasClass(M)||this.disabled)),this.rendered&&this.tooltip.toggleClass(M,t).attr("aria-disabled",t),this.disabled=!!t,this)},y.enable=function(){return this.disable(T)},y._createButton=function(){var t=this,e=this.elements,i=e.tooltip,o=this.options.content.button,n="string"==typeof o,r=n?o:"Close tooltip";e.button&&e.button.remove(),e.button=o.jquery?o:s("<a />",{"class":"qtip-close "+(this.options.style.widget?"":z+"-icon"),title:r,"aria-label":r}).prepend(s("<span />",{"class":"ui-icon ui-icon-close",html:"&times;"})),e.button.appendTo(e.titlebar||i).attr("role","button").click(function(e){return i.hasClass(M)||t.hide(e),T})},y._updateButton=function(t){if(!this.rendered)return T;var e=this.elements.button;t?this._createButton():e.remove()},y._setWidget=function(){var t=this.options.style.widget,e=this.elements,i=e.tooltip,s=i.hasClass(M);i.removeClass(M),M=t?"ui-state-disabled":"qtip-disabled",i.toggleClass(M,s),i.toggleClass("ui-helper-reset "+l(),t).toggleClass($,this.options.style.def&&!t),e.content&&e.content.toggleClass(l("content"),t),e.titlebar&&e.titlebar.toggleClass(l("header"),t),e.button&&e.button.toggleClass(z+"-icon",!t)},y._storeMouse=function(i){this.mouse={pageX:i.pageX,pageY:i.pageY,type:"mousemove",scrollX:t.pageXOffset||e.body.scrollLeft||e.documentElement.scrollLeft,scrollY:t.pageYOffset||e.body.scrollTop||e.documentElement.scrollTop}},y._bind=function(t,e,i,o,n){var r="."+this._id+(o?"-"+o:"");e.length&&s(t).bind((e.split?e:e.join(r+" "))+r,s.proxy(i,n||this))},y._unbind=function(t,e){s(t).unbind("."+this._id+(e?"-"+e:""))};var V="."+z;s(function(){g(F,["mouseenter","mouseleave"],function(t){var e="mouseenter"===t.type,i=s(t.currentTarget),o=s(t.relatedTarget||t.target),n=this.options;e?(this.focus(t),i.hasClass(X)&&!i.hasClass(M)&&clearTimeout(this.timers.hide)):"mouse"===n.position.target&&n.hide.event&&n.show.target&&!o.closest(n.show.target[0]).length&&this.hide(t),i.toggleClass(I,e)}),g("["+k+"]",D,p)}),y._trigger=function(t,e,i){var o=s.Event("tooltip"+t);return o.originalEvent=i&&s.extend({},i)||this.cache.event||C,this.triggering=x,this.tooltip.trigger(o,[this].concat(e||[])),this.triggering=T,!o.isDefaultPrevented()},y._assignEvents=function(){var o=this.options,n=o.position,r=this.tooltip,a=o.show.target,h=o.hide.target,d=n.container,l=n.viewport,g=s(e),m=(s(e.body),s(t)),y=o.show.event?s.trim(""+o.show.event).split(" "):[],b=o.hide.event?s.trim(""+o.hide.event).split(" "):[],w=[];/mouse(out|leave)/i.test(o.hide.event)&&"window"===o.hide.leave&&this._bind(g,["mouseout","blur"],function(t){/select|option/.test(t.target.nodeName)||t.relatedTarget||this.hide(t)}),o.hide.fixed?h=h.add(r.addClass(X)):/mouse(over|enter)/i.test(o.show.event)&&this._bind(h,"mouseleave",function(){clearTimeout(this.timers.show)}),(""+o.hide.event).indexOf("unfocus")>-1&&this._bind(d.closest("html"),["mousedown","touchstart"],function(t){var e=s(t.target),i=this.rendered&&!this.tooltip.hasClass(M)&&this.tooltip[0].offsetWidth>0,o=e.parents(F).filter(this.tooltip[0]).length>0;e[0]===this.target[0]||e[0]===this.tooltip[0]||o||this.target.has(e[0]).length||!i||this.hide(t)}),"number"==typeof o.hide.inactive&&(this._bind(a,"qtip-"+this.id+"-inactive",p),this._bind(h.add(r),v.inactiveEvents,p,"-inactive")),b=s.map(b,function(t){var e=s.inArray(t,y);return e>-1&&h.add(a).length===h.length?(w.push(y.splice(e,1)[0]),i):t}),this._bind(a,y,c),this._bind(h,b,u),this._bind(a,w,function(t){(this.tooltip[0].offsetWidth>0?u:c).call(this,t)}),this._bind(a.add(r),"mousemove",function(t){if("number"==typeof o.hide.distance){var e=this.cache.origin||{},i=this.options.hide.distance,s=Math.abs;(s(t.pageX-e.pageX)>=i||s(t.pageY-e.pageY)>=i)&&this.hide(t)}this._storeMouse(t)}),"mouse"===n.target&&n.adjust.mouse&&(o.hide.event&&this._bind(a,["mouseenter","mouseleave"],function(t){this.cache.onTarget="mouseenter"===t.type}),this._bind(g,"mousemove",function(t){this.rendered&&this.cache.onTarget&&!this.tooltip.hasClass(M)&&this.tooltip[0].offsetWidth>0&&this.reposition(t)})),(n.adjust.resize||l.length)&&this._bind(s.event.special.resize?l:m,"resize",f),n.adjust.scroll&&this._bind(m.add(n.container),"scroll",f)},y._unassignEvents=function(){var i=[this.options.show.target[0],this.options.hide.target[0],this.rendered&&this.tooltip[0],this.options.position.container[0],this.options.position.viewport[0],this.options.position.container.closest("html")[0],t,e];this.rendered?this._unbind(s([]).pushStack(s.grep(i,function(t){return"object"==typeof t}))):s(i[0]).unbind("."+this._id+"-create")},v=s.fn.qtip=function(t,e,o){var n=(""+t).toLowerCase(),r=C,h=s.makeArray(arguments).slice(1),d=h[h.length-1],l=this[0]?s.data(this[0],z):C;return!arguments.length&&l||"api"===n?l:"string"==typeof t?(this.each(function(){var t=s.data(this,z);if(!t)return x;if(d&&d.timeStamp&&(t.cache.event=d),!e||"option"!==n&&"options"!==n)t[n]&&t[n].apply(t,h);else{if(o===i&&!s.isPlainObject(e))return r=t.get(e),T;t.set(e,o)}}),r!==C?r:this):"object"!=typeof t&&arguments.length?i:(l=a(s.extend(x,{},t)),v.bind.call(this,l,d))},v.bind=function(t,e){return this.each(function(o){function n(t){function e(){l.render("object"==typeof t||r.show.ready),a.show.add(a.hide).unbind(d)}return l.disabled?T:(l.cache.event=s.extend({},t),l.cache.target=t?s(t.target):[i],r.show.delay>0?(clearTimeout(l.timers.show),l.timers.show=setTimeout(e,r.show.delay),h.show!==h.hide&&a.hide.bind(h.hide,function(){clearTimeout(l.timers.show)})):e(),i)}var r,a,h,d,l,c;return c=s.isArray(t.id)?t.id[o]:t.id,c=!c||c===T||1>c.length||v.api[c]?v.nextid++:c,d=".qtip-"+c+"-create",l=m(s(this),c,t),l===T?x:(v.api[c]=l,r=l.options,s.each(B,function(){"initialize"===this.initialize&&this(l)}),a={show:r.show.target,hide:r.hide.target},h={show:s.trim(""+r.show.event).replace(/ /g,d+" ")+d,hide:s.trim(""+r.hide.event).replace(/ /g,d+" ")+d},/mouse(over|enter)/i.test(h.show)&&!/mouse(out|leave)/i.test(h.hide)&&(h.hide+=" mouseleave"+d),a.show.bind("mousemove"+d,function(t){l._storeMouse(t),l.cache.onTarget=x}),a.show.bind(h.show,n),(r.show.ready||r.prerender)&&n(e),i)})},v.api={},s.each({attr:function(t,e){if(this.length){var i=this[0],o="title",n=s.data(i,"qtip");if(t===o&&n&&"object"==typeof n&&n.options.suppress)return 2>arguments.length?s.attr(i,P):(n&&n.options.content.attr===o&&n.cache.attr&&n.set("content.text",e),this.attr(P,e))}return s.fn["attr"+N].apply(this,arguments)},clone:function(t){var e=(s([]),s.fn["clone"+N].apply(this,arguments));return t||e.filter("["+P+"]").attr("title",function(){return s.attr(this,P)}).removeAttr(P),e}},function(t,e){if(!e||s.fn[t+N])return x;var i=s.fn[t+N]=s.fn[t];s.fn[t]=function(){return e.apply(this,arguments)||i.apply(this,arguments)}}),s.ui||(s["cleanData"+N]=s.cleanData,s.cleanData=function(t){for(var e,i=0;(e=s(t[i])).length;i++)if(e.attr(L))try{e.triggerHandler("removeqtip")}catch(o){}s["cleanData"+N].apply(this,arguments)}),v.version="2.1.1",v.nextid=0,v.inactiveEvents=D,v.zindex=15e3,v.defaults={prerender:T,id:T,overwrite:x,suppress:x,content:{text:x,attr:"title",title:T,button:T},position:{my:"top left",at:"bottom right",target:T,container:T,viewport:T,adjust:{x:0,y:0,mouse:x,scroll:x,resize:x,method:"flipinvert flipinvert"},effect:function(t,e){s(this).animate(e,{duration:200,queue:T})}},show:{target:T,event:"mouseenter",effect:x,delay:90,solo:T,ready:T,autofocus:T},hide:{target:T,event:"mouseleave",effect:x,delay:0,fixed:T,inactive:T,leave:"window",distance:T},style:{classes:"",widget:T,width:T,height:T,def:x},events:{render:C,move:C,show:C,hide:C,toggle:C,visible:C,hidden:C,focus:C,blur:C}}})})(window,document);
New to GrepCode? Check out our FAQ X