mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
23 lines
33 KiB
JavaScript
23 lines
33 KiB
JavaScript
/*!
|
|
* jquery.qtip. The jQuery tooltip plugin
|
|
*
|
|
* Copyright (c) 2009 Craig Thompson
|
|
* http://craigsworks.com
|
|
*
|
|
* Licensed under MIT
|
|
* http://www.opensource.org/licenses/mit-license.php
|
|
*
|
|
* Launch : February 2009
|
|
* Version : 1.0.0-rc3
|
|
* Released: Tuesday 12th May, 2009 - 00:00
|
|
* Debug: jquery.qtip.debug.js
|
|
* A few minor fixes added by Dustin Moore, dustmoo@gmail.com---
|
|
* ---Added Craigs opacity fix for to the afterShow function to prevent the tip opacity rendering
|
|
* ---Raised the z-index to a higher maximum to prevent z-index conflicts
|
|
* ---Added functionality so that unfocus can be used with other hide actions, i.e. unfocus and mouseout
|
|
* ---Various IE fixes as well as jQuery 1.4.1 compatability updates.
|
|
*
|
|
* sabello : Updated to remove .browser use (deprecated in jQuery 1.3 and removed in 1.9)
|
|
*
|
|
*/
|
|
!function(t){function e(){var e,i,s,r,p;(e=this).beforeRender.call(e),e.status.rendered=!0,e.elements.tooltip='<div qtip="'+e.id+'" class="qtip '+(e.options.style.classes.tooltip||e.options.style)+'"style="display:none; -moz-border-radius:0; -webkit-border-radius:0; border-radius:0;position:'+e.options.position.type+';"> <div class="qtip-wrapper" style="position:relative; overflow:hidden; text-align:left;"> <div class="qtip-contentWrapper" style="overflow:hidden;"> <div class="qtip-content '+e.options.style.classes.content+'"></div></div></div></div>',e.elements.tooltip=t(e.elements.tooltip),e.elements.tooltip.appendTo(e.options.position.container),e.elements.tooltip.data("qtip",{current:0,interfaces:[e]}),e.elements.wrapper=e.elements.tooltip.children("div:first"),e.elements.contentWrapper=e.elements.wrapper.children("div:first").css({background:e.options.style.background}),e.elements.content=e.elements.contentWrapper.children("div:first").css(l(e.options.style)),/unfocus/i.test(e.options.hide.when.event)&&e.elements.tooltip.attr("unfocus",!0),"number"==typeof e.options.style.width.value&&e.updateWidth(),t("<canvas>").get(0).getContext?(e.options.style.border.radius>0?function(){var e,i,n,s,r,l,p,a,c,h,f,u,g,m;(e=this).elements.wrapper.find(".qtip-borderBottom, .qtip-borderTop").remove(),n=e.options.style.border.width,s=e.options.style.border.radius,r=e.options.style.border.color||e.options.style.tip.color,l=d(s),p={};for(i in l)p[i]='<div rel="'+i+'" style="'+(/Left/.test(i)?"left":"right")+":0; position:absolute; height:"+s+"px; width:"+s+'px; overflow:hidden; line-height:0.1px; font-size:1px">',t("<canvas>").get(0).getContext&&(p[i]+='<canvas height="'+s+'" width="'+s+'" style="vertical-align: top"></canvas>'),p[i]+="</div>";a=e.getDimensions().width-2*Math.max(n,s),c='<div class="qtip-betweenCorners" style="height:'+s+"px; width:"+a+"px; overflow:hidden; background-color:"+r+'; line-height:0.1px; font-size:1px;">',h='<div class="qtip-borderTop" dir="ltr" style="height:'+s+"px; margin-left:"+s+'px; line-height:0.1px; font-size:1px; padding:0;">'+p.topLeft+p.topRight+c,e.elements.wrapper.prepend(h),f='<div class="qtip-borderBottom" dir="ltr" style="height:'+s+"px; margin-left:"+s+'px; line-height:0.1px; font-size:1px; padding:0;">'+p.bottomLeft+p.bottomRight+c,e.elements.wrapper.append(f),t("<canvas>").get(0).getContext&&e.elements.wrapper.find("canvas").each(function(){u=l[t(this).parent("[rel]:first").attr("rel")],o.call(e,t(this),u,s,r)});g=Math.max(s,s+(n-s)),m=Math.max(n-s,0),e.elements.contentWrapper.css({border:"0px solid "+r,borderWidth:m+"px "+g+"px"})}.call(e):e.elements.contentWrapper.css({border:e.options.style.border.width+"px solid "+e.options.style.border.color}),!1!==e.options.style.tip.corner&&n.call(e)):(e.elements.contentWrapper.css({border:e.options.style.border.width+"px solid "+e.options.style.border.color}),e.options.style.border.radius=0,e.options.style.tip.corner=!1,t.fn.qtip.log.error.call(e,2,t.fn.qtip.constants.CANVAS_VML_NOT_SUPPORTED,"render")),"string"==typeof e.options.content.text&&e.options.content.text.length>0||e.options.content.text.jquery&&e.options.content.text.length>0?i=e.options.content.text:"string"==typeof e.elements.target.attr("title")&&e.elements.target.attr("title").length>0?(i=e.elements.target.attr("title").replace("\\n","<br />"),e.elements.target.attr("title","")):"string"==typeof e.elements.target.attr("alt")&&e.elements.target.attr("alt").length>0?(i=e.elements.target.attr("alt").replace("\\n","<br />"),e.elements.target.attr("alt","")):(i=" ",t.fn.qtip.log.error.call(e,1,t.fn.qtip.constants.NO_VALID_CONTENT,"render")),!1!==e.options.content.title.text&&function(){var e=this;null!==e.elements.title&&e.elements.title.remove();e.elements.title=t('<div class="'+e.options.style.classes.title+'">').css(l(e.options.style.title,!0)).css({zoom:0}).prependTo(e.elements.contentWrapper),e.options.content.title.text&&e.updateTitle.call(e,e.options.content.title.text);!1!==e.options.content.title.button&&"string"==typeof e.options.content.title.button&&(e.elements.button=t('<a class="'+e.options.style.classes.button+'" style="float:right; position: relative"></a>').css(l(e.options.style.button,!0)).html(e.options.content.title.button).prependTo(e.elements.title).click(function(t){e.status.disabled||e.hide(t)}))}.call(e),e.updateContent(i),function(){var e,o,i,n;o=(e=this).options.show.when.target,i=e.options.hide.when.target,e.options.hide.fixed&&(i=i.add(e.elements.tooltip));if("inactive"==e.options.hide.when.event){function s(o){!0!==e.status.disabled&&(clearTimeout(e.timers.inactive),e.timers.inactive=setTimeout(function(){t(n).each(function(){i.unbind(this+".qtip-inactive"),e.elements.content.unbind(this+".qtip-inactive")}),e.hide(o)},e.options.hide.delay))}n=["click","dblclick","mousedown","mouseup","mousemove","mouseout","mouseenter","mouseleave","mouseover","touchstart"]}else!0===e.options.hide.fixed&&e.elements.tooltip.bind("mouseover.qtip",function(){!0!==e.status.disabled&&clearTimeout(e.timers.hide)});function r(o){!0!==e.status.disabled&&("inactive"==e.options.hide.when.event&&(t(n).each(function(){i.bind(this+".qtip-inactive",s),e.elements.content.bind(this+".qtip-inactive",s)}),s()),clearTimeout(e.timers.show),clearTimeout(e.timers.hide),e.options.show.delay>0?e.timers.show=setTimeout(function(){e.show(o)},e.options.show.delay):e.show(o))}function l(o){if(!0!==e.status.disabled){if(!0===e.options.hide.fixed&&/mouse(out|leave)/i.test(e.options.hide.when.event)&&t(o.relatedTarget).parents("div.qtip[qtip]").length>0)return o.stopPropagation(),o.preventDefault(),clearTimeout(e.timers.hide),!1;clearTimeout(e.timers.show),clearTimeout(e.timers.hide),e.elements.tooltip.stop(!0,!0),e.timers.hide=setTimeout(function(){e.hide(o)},e.options.hide.delay)}}1===e.options.show.when.target.add(e.options.hide.when.target).length&&e.options.show.when.event==e.options.hide.when.event&&"inactive"!==e.options.hide.when.event||"unfocus"==e.options.hide.when.event?(e.cache.toggle=0,o.bind(e.options.show.when.event+".qtip",function(t){0==e.cache.toggle?r(t):l(t)})):(o.bind(e.options.show.when.event+".qtip",r),"inactive"!==e.options.hide.when.event&&i.bind(e.options.hide.when.event+".qtip",l));/(fixed|absolute)/.test(e.options.position.type)&&e.elements.tooltip.bind("mouseover.qtip",e.focus);"mouse"===e.options.position.target&&"static"!==e.options.position.type&&o.bind("mousemove.qtip",function(t){e.cache.mouse={x:t.pageX,y:t.pageY},!1===e.status.disabled&&!0===e.options.position.adjust.mouse&&"static"!==e.options.position.type&&"none"!==e.elements.tooltip.css("display")&&e.updatePosition(t)})}.call(e),!0===e.options.show.ready&&e.show(),!1!==e.options.content.url&&(s=e.options.content.url,r=e.options.content.data,p=e.options.content.method||"get",e.loadContent(s,r,p)),e.onRender.call(e),t.fn.qtip.log.error.call(e,1,t.fn.qtip.constants.EVENT_RENDERED,"render")}function o(t,e,o,i){var n=t.get(0).getContext("2d");n.fillStyle=i,n.beginPath(),n.arc(e[0],e[1],o,0,2*Math.PI,!1),n.fill()}function n(e){var o,i,n,l;null!==(o=this).elements.tip&&o.elements.tip.remove(),i=o.options.style.tip.color||o.options.style.border.color,!1!==o.options.style.tip.corner&&(e||(e=o.options.style.tip.corner),n=c(e,o.options.style.tip.size.width,o.options.style.tip.size.height),o.elements.tip='<div class="'+o.options.style.classes.tip+'" dir="ltr" rel="'+e+'" style="position:absolute; height:'+o.options.style.tip.size.height+"px; width:"+o.options.style.tip.size.width+'px; margin:0 auto; line-height:0.1px; font-size:1px;"></div>',o.elements.tooltip.prepend(o.elements.tip),t("<canvas>").get(0).getContext&&(l='<canvas height="'+o.options.style.tip.size.height+'" width="'+o.options.style.tip.size.width+'"></canvas>'),o.elements.tip=o.elements.tooltip.find("."+o.options.style.classes.tip).eq(0),o.elements.tip.html(l),t("<canvas>").get(0).getContext&&s.call(o,o.elements.tip.find("canvas:first"),n,i),r.call(o,e))}function s(t,e,o){var i=t.get(0).getContext("2d");i.fillStyle=o,i.beginPath(),i.moveTo(e[0][0],e[0][1]),i.lineTo(e[1][0],e[1][1]),i.lineTo(e[2][0],e[2][1]),i.fill()}function r(t){var e,o,i,n;!1!==(e=this).options.style.tip.corner&&e.elements.tip&&(t||(t=e.elements.tip.attr("rel")),o=positionAdjust=0,e.elements.tip.css(t.match(/left|right|top|bottom/)[0],0),/top|bottom/.test(t)?(/Middle/.test(t)?e.elements.tip.css({left:"50%",marginLeft:-e.options.style.tip.size.width/2}):/Left/.test(t)?e.elements.tip.css({left:e.options.style.border.radius-o}):/Right/.test(t)&&e.elements.tip.css({right:e.options.style.border.radius+o}),/top/.test(t)?e.elements.tip.css({top:-positionAdjust}):e.elements.tip.css({bottom:positionAdjust})):/left|right/.test(t)&&(/Middle/.test(t)?e.elements.tip.css({top:"50%",marginTop:-e.options.style.tip.size.height/2}):/Top/.test(t)?e.elements.tip.css({top:e.options.style.border.radius-o}):/Bottom/.test(t)&&e.elements.tip.css({bottom:e.options.style.border.radius+o}),/left/.test(t)?e.elements.tip.css({left:-positionAdjust}):e.elements.tip.css({right:positionAdjust})),i="padding-"+t.match(/left|right|top|bottom/)[0],n=e.options.style.tip.size[/left|right/.test(i)?"width":"height"],e.elements.tooltip.css("padding",0),e.elements.tooltip.css(i,n))}function l(e,o){var i,n;i=t.extend(!0,{},e);for(n in i)!0===o&&/(tip|classes)/i.test(n)?delete i[n]:!o&&/(width|border|tip|title|classes|user)/i.test(n)&&delete i[n];return i}function p(t){return"object"!=typeof t.tip&&(t.tip={corner:t.tip}),"object"!=typeof t.tip.size&&(t.tip.size={width:t.tip.size,height:t.tip.size}),"object"!=typeof t.border&&(t.border={width:t.border}),"object"!=typeof t.width&&(t.width={value:t.width}),"string"==typeof t.width.max&&(t.width.max=parseInt(t.width.max.replace(/([0-9]+)/i,"$1"))),"string"==typeof t.width.min&&(t.width.min=parseInt(t.width.min.replace(/([0-9]+)/i,"$1"))),"number"==typeof t.tip.size.x&&(t.tip.size.width=t.tip.size.x,delete t.tip.size.x),"number"==typeof t.tip.size.y&&(t.tip.size.height=t.tip.size.y,delete t.tip.size.y),t}function a(){var e,o,i,n;for(this,o=[!0,{}],e=0;e<arguments.length;e++)o.push(arguments[e]);for(i=[t.extend.apply(t,o)];"string"==typeof i[0].name;)i.unshift(p(t.fn.qtip.styles[i[0].name]));return i.unshift(!0,{classes:{tooltip:"qtip-"+(arguments[0].name||"defaults")}},t.fn.qtip.styles.defaults),0,(n=t.extend.apply(t,i)).tip.size.width+=0,n.tip.size.height+=0,n.tip.size.width%2>0&&(n.tip.size.width+=1),n.tip.size.height%2>0&&(n.tip.size.height+=1),!0===n.tip.corner&&(n.tip.corner="center"!==this.options.position.corner.tooltip&&this.options.position.corner.tooltip),n}function c(t,e,o){var i={bottomRight:[[0,0],[e,o],[e,0]],bottomLeft:[[0,0],[e,0],[0,o]],topRight:[[0,o],[e,0],[e,o]],topLeft:[[0,0],[0,o],[e,o]],topMiddle:[[0,o],[e/2,0],[e,o]],bottomMiddle:[[0,0],[e,0],[e/2,o]],rightMiddle:[[0,0],[e,o/2],[0,o]],leftMiddle:[[e,0],[e,o],[0,o/2]]};return i.leftTop=i.bottomRight,i.rightTop=i.bottomLeft,i.leftBottom=i.topRight,i.rightBottom=i.topLeft,i[t]}function d(e){var o;return t("<canvas>").get(0).getContext&&(o={topLeft:[e,e],topRight:[0,e],bottomLeft:[e,0],bottomRight:[0,0]}),o}t.fn.qtip=function(i,h){var f,u,g,m,w,b,y,q;if("string"==typeof i){if(t.isPlainObject(t(this).data("qtip"))&&t.fn.qtip.log.error.call(self,1,t.fn.qtip.constants.NO_TOOLTIP_PRESENT,!1),"api"==i)return t(this).data("qtip").interfaces[t(this).data("qtip").current];if("interfaces"==i)return t(this).data("qtip").interfaces}else i||(i={}),("object"!=typeof i.content||i.content.jquery&&i.content.length>0)&&(i.content={text:i.content}),"object"!=typeof i.content.title&&(i.content.title={text:i.content.title}),"object"!=typeof i.position&&(i.position={corner:i.position}),"object"!=typeof i.position.corner&&(i.position.corner={target:i.position.corner,tooltip:i.position.corner}),"object"!=typeof i.show&&(i.show={when:i.show}),"object"!=typeof i.show.when&&(i.show.when={event:i.show.when}),"object"!=typeof i.show.effect&&(i.show.effect={type:i.show.effect}),"object"!=typeof i.hide&&(i.hide={when:i.hide}),"object"!=typeof i.hide.when&&(i.hide.when={event:i.hide.when}),"object"!=typeof i.hide.effect&&(i.hide.effect={type:i.hide.effect}),"object"!=typeof i.style&&(i.style={name:i.style}),i.style=p(i.style),(m=t.extend(!0,{},t.fn.qtip.defaults,i)).style=a.call({options:m},m.style),m.user=t.extend(!0,{},i);return t(this).each(function(){if("string"==typeof i){if(b=i.toLowerCase(),"object"==typeof(g=t(this).qtip("interfaces")))if(!0===h&&"destroy"==b)for(;g.length>0;)g[g.length-1].destroy();else for(!0!==h&&(g=[t(this).qtip("api")]),f=0;f<g.length;f++)"destroy"==b?g[f].destroy():!0===g[f].status.rendered&&("show"==b?g[f].show():"hide"==b?g[f].hide():"focus"==b?g[f].focus():"disable"==b?g[f].disable(!0):"enable"==b&&g[f].disable(!1))}else{for((y=t.extend(!0,{},m)).hide.effect.length=m.hide.effect.length,y.show.effect.length=m.show.effect.length,!1===y.position.container&&(y.position.container=t(document.body)),!1===y.position.target&&(y.position.target=t(this)),!1===y.show.when.target&&(y.show.when.target=t(this)),!1===y.hide.when.target&&(y.hide.when.target=t(this)),u=t.fn.qtip.interfaces.length,f=0;f<u;f++)"object"==typeof t(this).data("qtip")&&t(this).data("qtip");w=new function(e,i,p){var h=this;h.id=p,h.options=i,h.status={animated:!1,rendered:!1,disabled:!1,focused:!1},h.elements={target:e.addClass(h.options.style.classes.target),tooltip:null,wrapper:null,content:null,contentWrapper:null,title:null,button:null,tip:null,bgiframe:null},h.cache={mouse:{},position:{},toggle:0},h.timers={},t.extend(h,h.options.api,{show:function(e){var o;if(!h.status.rendered)return t.fn.qtip.log.error.call(h,2,t.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"show");if("none"!==h.elements.tooltip.css("display"))return h;if(h.elements.tooltip.stop(!0,!1),!1===h.beforeShow.call(h,e))return h;function i(){t(this).css({opacity:""}),"static"!==h.options.position.type&&h.focus(),h.onShow.call(h,e)}if(h.cache.toggle=1,"static"!==h.options.position.type&&h.updatePosition(e,h.options.show.effect.length>0),"object"==typeof h.options.show.solo?o=t(h.options.show.solo):!0===h.options.show.solo&&(o=t("div.qtip").not(h.elements.tooltip)),o&&o.each(function(){!0===t(this).qtip("api").status.rendered&&t(this).qtip("api").hide()}),"function"==typeof h.options.show.effect.type)h.options.show.effect.type.call(h.elements.tooltip,h.options.show.effect.length),h.elements.tooltip.queue(function(){i(),t(this).dequeue()});else{switch(h.options.show.effect.type.toLowerCase()){case"fade":h.elements.tooltip.fadeIn(h.options.show.effect.length,i);break;case"slide":h.elements.tooltip.slideDown(h.options.show.effect.length,function(){i(),"static"!==h.options.position.type&&h.updatePosition(e,!0)});break;case"grow":h.elements.tooltip.show(h.options.show.effect.length,i);break;default:h.elements.tooltip.show(null,i),h.elements.tooltip.css({opacity:""})}h.elements.tooltip.addClass(h.options.style.classes.active)}return t.fn.qtip.log.error.call(h,1,t.fn.qtip.constants.EVENT_SHOWN,"show")},hide:function(e){if(!h.status.rendered)return t.fn.qtip.log.error.call(h,2,t.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"hide");if("none"===h.elements.tooltip.css("display"))return h;if(clearTimeout(h.timers.show),h.elements.tooltip.stop(!0,!1),!1===h.beforeHide.call(h,e))return h;function o(){h.onHide.call(h,e)}if(h.cache.toggle=0,"function"==typeof h.options.hide.effect.type)h.options.hide.effect.type.call(h.elements.tooltip,h.options.hide.effect.length),h.elements.tooltip.queue(function(){o(),t(this).dequeue()});else{switch(h.options.hide.effect.type.toLowerCase()){case"fade":h.elements.tooltip.fadeOut(h.options.hide.effect.length,o);break;case"slide":h.elements.tooltip.slideUp(h.options.hide.effect.length,o);break;case"grow":h.elements.tooltip.hide(h.options.hide.effect.length,o);break;default:h.elements.tooltip.hide(null,o)}h.elements.tooltip.removeClass(h.options.style.classes.active)}return t.fn.qtip.log.error.call(h,1,t.fn.qtip.constants.EVENT_HIDDEN,"hide")},updatePosition:function(e,o){var i,s,r,l,p,a,c,d,f;if(!h.status.rendered)return t.fn.qtip.log.error.call(h,2,t.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updatePosition");if("static"==h.options.position.type)return t.fn.qtip.log.error.call(h,1,t.fn.qtip.constants.CANNOT_POSITION_STATIC,"updatePosition");if(s={position:{left:0,top:0},dimensions:{height:0,width:0},corner:h.options.position.corner.target},r={position:h.getPosition(),dimensions:h.getDimensions(),corner:h.options.position.corner.tooltip},"mouse"!==h.options.position.target){if("area"==h.options.position.target.get(0).nodeName.toLowerCase()){for(l=h.options.position.target.attr("coords").split(","),i=0;i<l.length;i++)l[i]=parseInt(l[i]);switch(p=h.options.position.target.parent("map").attr("name"),a=t('img[usemap="#'+p+'"]:first').offset(),s.position={left:Math.floor(a.left+l[0]),top:Math.floor(a.top+l[1])},h.options.position.target.attr("shape").toLowerCase()){case"rect":s.dimensions={width:Math.ceil(Math.abs(l[2]-l[0])),height:Math.ceil(Math.abs(l[3]-l[1]))};break;case"circle":s.dimensions={width:l[2]+1,height:l[2]+1};break;case"poly":for(s.dimensions={width:l[0],height:l[1]},i=0;i<l.length;i++)i%2==0?(l[i]>s.dimensions.width&&(s.dimensions.width=l[i]),l[i]<l[0]&&(s.position.left=Math.floor(a.left+l[i]))):(l[i]>s.dimensions.height&&(s.dimensions.height=l[i]),l[i]<l[1]&&(s.position.top=Math.floor(a.top+l[i])));s.dimensions.width=s.dimensions.width-(s.position.left-a.left),s.dimensions.height=s.dimensions.height-(s.position.top-a.top);break;default:return t.fn.qtip.log.error.call(h,4,t.fn.qtip.constants.INVALID_AREA_SHAPE,"updatePosition")}s.dimensions.width-=2,s.dimensions.height-=2}else 1===h.options.position.target.add(document.body).length?(s.position={left:t(document).scrollLeft(),top:t(document).scrollTop()},s.dimensions={height:t(window).height(),width:t(window).width()}):(void 0!==h.options.position.target.attr("qtip")?s.position=h.options.position.target.qtip("api").cache.position:s.position=h.options.position.target.offset(),s.dimensions={height:h.options.position.target.outerHeight(),width:h.options.position.target.outerWidth()});c=t.extend({},s.position),/right/i.test(s.corner)&&(c.left+=s.dimensions.width),/bottom/i.test(s.corner)&&(c.top+=s.dimensions.height),/((top|bottom)Middle)|center/.test(s.corner)&&(c.left+=s.dimensions.width/2),/((left|right)Middle)|center/.test(s.corner)&&(c.top+=s.dimensions.height/2)}else s.position=c={left:h.cache.mouse.x,top:h.cache.mouse.y},s.dimensions={height:1,width:1};if(/right/i.test(r.corner)&&(c.left-=r.dimensions.width),/bottom/i.test(r.corner)&&(c.top-=r.dimensions.height),/((top|bottom)Middle)|center/.test(r.corner)&&(c.left-=r.dimensions.width/2),/((left|right)Middle)|center/.test(r.corner)&&(c.top-=r.dimensions.height/2),0,0,h.options.style.border.radius>0&&(/Left/i.test(r.corner)?c.left-=h.options.style.border.radius:/Right/i.test(r.corner)&&(c.left+=h.options.style.border.radius),/Top/i.test(r.corner)?c.top-=h.options.style.border.radius:/Bottom/i.test(r.corner)&&(c.top+=h.options.style.border.radius)),!0===h.options.position.adjust.screen&&(c=function(e,o,i){var s,r,l,p,a;if(s=this,"center"==i.corner)return o.position;r=t.extend({},e),p={x:!1,y:!1},a={left:r.left<t.fn.qtip.cache.screen.scroll.left,right:r.left+i.dimensions.width+2>=t.fn.qtip.cache.screen.width+t.fn.qtip.cache.screen.scroll.left,top:r.top<t.fn.qtip.cache.screen.scroll.top,bottom:r.top+i.dimensions.height+2>=t.fn.qtip.cache.screen.height+t.fn.qtip.cache.screen.scroll.top},(l={left:a.left&&(/right/i.test(i.corner)||!a.right),right:a.right&&(/left/i.test(i.corner)||!a.left),top:a.top&&!/top/i.test(i.corner),bottom:a.bottom&&!/bottom/i.test(i.corner)}).left?("mouse"!==s.options.position.target?r.left=o.position.left+o.dimensions.width:r.left=s.cache.mouse.x,p.x="Left"):l.right&&("mouse"!==s.options.position.target?r.left=o.position.left-i.dimensions.width:r.left=s.cache.mouse.x-i.dimensions.width,p.x="Right");l.top?("mouse"!==s.options.position.target?r.top=o.position.top+o.dimensions.height:r.top=s.cache.mouse.y,p.y="top"):l.bottom&&("mouse"!==s.options.position.target?r.top=o.position.top-i.dimensions.height:r.top=s.cache.mouse.y-i.dimensions.height,p.y="bottom");r.left<0&&(r.left=e.left,p.x=!1);r.top<0&&(r.top=e.top,p.y=!1);!1!==s.options.style.tip.corner&&(r.corner=new String(i.corner),r.corner.match(/^(right|left)/)?!1!==p.x&&(r.corner=r.corner.replace(/(left|right)/,p.x.toLowerCase())):(!1!==p.x&&(r.corner=r.corner.replace(/Left|Right|Middle/,p.x)),!1!==p.y&&(r.corner=r.corner.replace(/top|bottom/,p.y))),r.corner!==s.elements.tip.attr("rel")&&n.call(s,r.corner));return r}.call(h,c,s,r)),"mouse"===h.options.position.target&&!0===h.options.position.adjust.mouse&&(d=!0===h.options.position.adjust.screen&&h.elements.tip?h.elements.tip.attr("rel"):h.options.position.corner.tooltip,c.left+=/right/i.test(d)?-6:6,c.top+=/bottom/i.test(d)?-6:6),c.left+=h.options.position.adjust.x,c.top+=h.options.position.adjust.y,f=h.getPosition(),c.left!=f.left||c.top!=f.top){if(!1===h.beforePositionUpdate.call(h,e))return h;h.cache.position=c,!0===o?(h.status.animated=!0,h.elements.tooltip.animate(c,200,"swing",function(){h.status.animated=!1})):h.elements.tooltip.css(c),h.onPositionUpdate.call(h,e),void 0!==e&&e.type&&"mousemove"!==e.type&&t.fn.qtip.log.error.call(h,1,t.fn.qtip.constants.EVENT_POSITION_UPDATED,"updatePosition")}return h},updateWidth:function(e){if(!h.status.rendered)return t.fn.qtip.log.error.call(h,2,t.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateWidth");if(void 0!=e&&"number"!=typeof e)return t.fn.qtip.log.error.call(h,2,"newWidth must be of type number","updateWidth");var o=h.elements.contentWrapper.siblings().add(h.elements.tip).add(h.elements.button),i=(h.elements.wrapper.add(h.elements.contentWrapper.children()),h.elements.tooltip,h.options.style.width.max),n=h.options.style.width.min;return e||("number"==typeof h.options.style.width.value?e=h.options.style.width.value:(h.elements.tooltip.css({width:"auto"}),o.hide(),e=h.getDimensions().width,h.options.style.width.value||(e=Math.min(Math.max(e,n),i)))),e%2&&(e-=1),h.elements.tooltip.width(e),o.show(),h.options.style.border.radius&&h.elements.tooltip.find(".qtip-betweenCorners").each(function(o){t(this).width(e-2*h.options.style.border.radius)}),t.fn.qtip.log.error.call(h,1,t.fn.qtip.constants.EVENT_WIDTH_UPDATED,"updateWidth")},updateStyle:function(e){var i,n,r,p;return h.status.rendered?"string"==typeof e&&t.fn.qtip.styles[e]?(h.options.style=a.call(h,t.fn.qtip.styles[e],h.options.user.style),h.elements.content.css(l(h.options.style)),!1!==h.options.content.title.text&&h.elements.title.css(l(h.options.style.title,!0)),h.elements.contentWrapper.css({borderColor:h.options.style.border.color}),!1!==h.options.style.tip.corner&&t("<canvas>").get(0).getContext&&(i=h.elements.tooltip.find(".qtip-tip canvas:first"),i.get(0).getContext("2d").clearRect(0,0,300,300),r=i.parent("div[rel]:first").attr("rel"),p=c(r,h.options.style.tip.size.width,h.options.style.tip.size.height),s.call(h,i,p,h.options.style.tip.color||h.options.style.border.color)),h.options.style.border.radius>0&&(h.elements.tooltip.find(".qtip-betweenCorners").css({backgroundColor:h.options.style.border.color}),t("<canvas>").get(0).getContext&&(n=d(h.options.style.border.radius),h.elements.tooltip.find(".qtip-wrapper canvas").each(function(){t(this).get(0).getContext("2d").clearRect(0,0,300,300),r=t(this).parent("div[rel]:first").attr("rel"),o.call(h,t(this),n[r],h.options.style.border.radius,h.options.style.border.color)}))),t.fn.qtip.log.error.call(h,1,t.fn.qtip.constants.EVENT_STYLE_UPDATED,"updateStyle")):t.fn.qtip.log.error.call(h,2,t.fn.qtip.constants.STYLE_NOT_DEFINED,"updateStyle"):t.fn.qtip.log.error.call(h,2,t.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateStyle")},updateContent:function(e,o){var i,n,s;if(!h.status.rendered)return t.fn.qtip.log.error.call(h,2,t.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateContent");if(!e)return t.fn.qtip.log.error.call(h,2,t.fn.qtip.constants.NO_CONTENT_PROVIDED,"updateContent");if("string"==typeof(i=h.beforeContentUpdate.call(h,e)))e=i;else if(!1===i)return;function l(){h.updateWidth(),!1!==o&&("static"!==h.options.position.type&&h.updatePosition(h.elements.tooltip.is(":visible"),!0),!1!==h.options.style.tip.corner&&r.call(h))}return e.jquery&&e.length>0?e.clone(!0).appendTo(h.elements.content).show():h.elements.content.html(e),s=0,(n=h.elements.content.find("img")).length?t.fn.qtip.preload?(n.each(function(){preloaded=t('body > img[src="'+t(this).attr("src")+'"]:first'),preloaded.length>0&&t(this).attr("width",preloaded.innerWidth()).attr("height",preloaded.innerHeight())}),l()):n.bind("load error",function(){++s===n.length&&l()}):l(),h.updateWidth(),!1!==o&&("static"!==h.options.position.type&&h.updatePosition(h.elements.tooltip.is(":visible"),!0),!1!==h.options.style.tip.corner&&r.call(h)),h.onContentUpdate.call(h),t.fn.qtip.log.error.call(h,1,t.fn.qtip.constants.EVENT_CONTENT_UPDATED,"loadContent")},loadContent:function(e,o,i){if(!h.status.rendered)return t.fn.qtip.log.error.call(h,2,t.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"loadContent");if(!1===h.beforeContentLoad.call(h))return h;function n(e){h.onContentLoad.call(h),t.fn.qtip.log.error.call(h,1,t.fn.qtip.constants.EVENT_CONTENT_LOADED,"loadContent"),h.updateContent(e)}return"post"==i?t.post(e,o,n):t.get(e,o,n),h},updateTitle:function(e){return h.status.rendered?e?(returned=h.beforeTitleUpdate.call(h),!1===returned?h:(h.elements.button&&(h.elements.button=h.elements.button.clone(!0)),h.elements.title.html(e),h.elements.button&&h.elements.title.prepend(h.elements.button),h.onTitleUpdate.call(h),t.fn.qtip.log.error.call(h,1,t.fn.qtip.constants.EVENT_TITLE_UPDATED,"updateTitle"))):t.fn.qtip.log.error.call(h,2,t.fn.qtip.constants.NO_CONTENT_PROVIDED,"updateTitle"):t.fn.qtip.log.error.call(h,2,t.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateTitle")},focus:function(e){var o,i,n;if(!h.status.rendered)return t.fn.qtip.log.error.call(h,2,t.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"focus");if("static"==h.options.position.type)return t.fn.qtip.log.error.call(h,1,t.fn.qtip.constants.CANNOT_FOCUS_STATIC,"focus");if(o=parseInt(h.elements.tooltip.css("z-index")),i=32001+t("div.qtip[qtip]").length-1,!h.status.focused&&o!==i){if(!1===h.beforeFocus.call(h,e))return h;t("div.qtip[qtip]").not(h.elements.tooltip).each(function(){!0===t(this).qtip("api").status.rendered&&("number"==typeof(n=parseInt(t(this).css("z-index")))&&n>-1&&t(this).css({zIndex:parseInt(t(this).css("z-index"))-1}),t(this).qtip("api").status.focused=!1)}),h.elements.tooltip.css({zIndex:i}),h.status.focused=!0,h.onFocus.call(h,e),t.fn.qtip.log.error.call(h,1,t.fn.qtip.constants.EVENT_FOCUSED,"focus")}return h},disable:function(e){return h.status.rendered?(e?h.status.disabled?t.fn.qtip.log.error.call(h,1,t.fn.qtip.constants.TOOLTIP_ALREADY_DISABLED,"disable"):(h.status.disabled=!0,t.fn.qtip.log.error.call(h,1,t.fn.qtip.constants.EVENT_DISABLED,"disable")):h.status.disabled?(h.status.disabled=!1,t.fn.qtip.log.error.call(h,1,t.fn.qtip.constants.EVENT_ENABLED,"disable")):t.fn.qtip.log.error.call(h,1,t.fn.qtip.constants.TOOLTIP_ALREADY_ENABLED,"disable"),h):t.fn.qtip.log.error.call(h,2,t.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"disable")},destroy:function(){var e,o;if(!1===h.beforeDestroy.call(h))return h;if(h.status.rendered?(h.options.show.when.target.unbind("mousemove.qtip",h.updatePosition),h.options.show.when.target.unbind("mouseout.qtip",h.hide),h.options.show.when.target.unbind(h.options.show.when.event+".qtip"),h.options.hide.when.target.unbind(h.options.hide.when.event+".qtip"),h.elements.tooltip.unbind(h.options.hide.when.event+".qtip"),h.elements.tooltip.unbind("mouseover.qtip",h.focus),h.elements.tooltip.remove()):h.options.show.when.target.unbind(h.options.show.when.event+".qtip-create"),"object"==typeof h.elements.target.data("qtip")&&"object"==typeof(o=h.elements.target.data("qtip").interfaces)&&o.length>0)for(e=0;e<o.length-1;e++)o[e].id==h.id&&o.splice(e,1);return t.fn.qtip.interfaces.splice(h.id,1),"object"==typeof o&&o.length>0?h.elements.target.data("qtip").current=o.length-1:h.elements.target.removeData("qtip"),h.onDestroy.call(h),t.fn.qtip.log.error.call(h,1,t.fn.qtip.constants.EVENT_DESTROYED,"destroy"),h.elements.target},getPosition:function(){var e,o;return h.status.rendered?((e="none"===h.elements.tooltip.css("display"))&&h.elements.tooltip.css({visiblity:"hidden"}).show(),o=h.elements.tooltip.offset(),e&&h.elements.tooltip.css({visiblity:"visible"}).hide(),o):t.fn.qtip.log.error.call(h,2,t.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"getPosition")},getDimensions:function(){var e,o;return h.status.rendered?((e=!h.elements.tooltip.is(":visible"))&&h.elements.tooltip.css({visiblity:"hidden"}).show(),o={height:h.elements.tooltip.outerHeight(),width:h.elements.tooltip.outerWidth()},e&&h.elements.tooltip.css({visiblity:"visible"}).hide(),o):t.fn.qtip.log.error.call(h,2,t.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"getDimensions")}})}(t(this),y,u),t.fn.qtip.interfaces[u]=w,t.isPlainObject(t(this).data("qtip"))?(void 0===t(this).attr("qtip")&&(t(this).data("qtip").current=t(this).data("qtip").interfaces.length),t(this).data("qtip").interfaces.push(w)):t(this).data("qtip",{current:0,interfaces:[w]}),!1===y.content.prerender&&!1!==y.show.when.event&&!0!==y.show.ready?y.show.when.target.bind(y.show.when.event+".qtip-"+u+"-create",{qtip:u},function(o){(q=t.fn.qtip.interfaces[o.data.qtip]).options.show.when.target.unbind(q.options.show.when.event+".qtip-"+o.data.qtip+"-create"),q.cache.mouse={x:o.pageX,y:o.pageY},e.call(q),q.options.show.when.target.trigger(q.options.show.when.event)}):(w.cache.mouse={x:y.show.when.target.offset().left,y:y.show.when.target.offset().top},e.call(w))}})},t(document).ready(function(){var e;t.fn.qtip.cache={screen:{scroll:{left:t(window).scrollLeft(),top:t(window).scrollTop()},width:t(window).width(),height:t(window).height()}},t(window).bind("resize scroll",function(o){clearTimeout(e),e=setTimeout(function(){for("scroll"===o.type?t.fn.qtip.cache.screen.scroll={left:t(window).scrollLeft(),top:t(window).scrollTop()}:(t.fn.qtip.cache.screen.width=t(window).width(),t.fn.qtip.cache.screen.height=t(window).height()),i=0;i<t.fn.qtip.interfaces.length;i++){var e=t.fn.qtip.interfaces[i];!0===e.status.rendered&&(e.options.position.adjust.scroll&&"scroll"===o.type||e.options.position.adjust.resize&&"resize"===o.type)&&e.updatePosition(o,!0)}},100)}),t(document).bind("touchstart.qtip",function(e){0===t(e.target).parents("div.qtip").length&&t(".qtip[unfocus]").each(function(){var o=t(this).qtip("api");t(this).is(":visible")&&!o.status.disabled&&t(e.target).add(o.elements.target).length>1&&o.hide(e)})}),t(document).bind("mousedown.qtip",function(e){0===t(e.target).parents("div.qtip").length&&t(".qtip[unfocus]").each(function(){var o=t(this).qtip("api");t(this).is(":visible")&&!o.status.disabled&&t(e.target).add(o.elements.target).length>1&&o.hide(e)})})}),t.fn.qtip.interfaces=[],t.fn.qtip.log={error:function(){return this}},t.fn.qtip.constants={},t.fn.qtip.defaults={content:{prerender:!1,text:!1,url:!1,data:null,title:{text:!1,button:!1}},position:{target:!1,corner:{target:"bottomRight",tooltip:"topLeft"},adjust:{x:0,y:0,mouse:!0,screen:!1,scroll:!0,resize:!0},type:"absolute",container:!1},show:{when:{target:!1,event:"mouseover"},effect:{type:"fade",length:100},delay:140,solo:!1,ready:!1},hide:{when:{target:!1,event:"mouseout"},effect:{type:"fade",length:100},delay:0,fixed:!1},api:{beforeRender:function(){},onRender:function(){},beforePositionUpdate:function(){},onPositionUpdate:function(){},beforeShow:function(){},onShow:function(){},beforeHide:function(){},onHide:function(){},beforeContentUpdate:function(){},onContentUpdate:function(){},beforeContentLoad:function(){},onContentLoad:function(){},beforeTitleUpdate:function(){},onTitleUpdate:function(){},beforeDestroy:function(){},onDestroy:function(){},beforeFocus:function(){},onFocus:function(){}}},t.fn.qtip.styles={defaults:{background:"white",color:"#111",overflow:"hidden",textAlign:"left",width:{min:0,max:250},padding:"5px 9px",border:{width:1,radius:0,color:"#d3d3d3"},tip:{corner:!1,color:!1,size:{width:13,height:13},opacity:1},title:{background:"#e1e1e1",fontWeight:"bold",padding:"7px 12px"},button:{cursor:"pointer"},classes:{target:"",tip:"qtip-tip",title:"qtip-title",button:"qtip-button",content:"qtip-content",active:"qtip-active"}},cream:{border:{width:3,radius:0,color:"#F9E98E"},title:{background:"#F0DE7D",color:"#A27D35"},background:"#FBF7AA",color:"#A27D35",classes:{tooltip:"qtip-cream"}},light:{border:{width:3,radius:0,color:"#E2E2E2"},title:{background:"#f1f1f1",color:"#454545"},background:"white",color:"#454545",classes:{tooltip:"qtip-light"}},dark:{border:{width:3,radius:0,color:"#303030"},title:{background:"#404040",color:"#f3f3f3"},background:"#505050",color:"#f3f3f3",classes:{tooltip:"qtip-dark"}},red:{border:{width:3,radius:0,color:"#CE6F6F"},title:{background:"#f28279",color:"#9C2F2F"},background:"#F79992",color:"#9C2F2F",classes:{tooltip:"qtip-red"}},green:{border:{width:3,radius:0,color:"#A9DB66"},title:{background:"#b9db8c",color:"#58792E"},background:"#CDE6AC",color:"#58792E",classes:{tooltip:"qtip-green"}},blue:{border:{width:3,radius:0,color:"#ADD9ED"},title:{background:"#D0E9F5",color:"#5E99BD"},background:"#E5F6FE",color:"#4D9FBF",classes:{tooltip:"qtip-blue"}}}}(jQuery); |