Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: enyo/opentip
base: 44c7049a5f
...
head fork: enyo/opentip
compare: f14878a340
  • 3 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
Showing with 12 additions and 8 deletions.
  1. +5 −1 README.md
  2. +2 −2 opentip.js
  3. +1 −1  opentip.min.js
  4. +4 −4 test/index.html
View
6 README.md
@@ -1,4 +1,4 @@
-# Opentip Version 1.4.4-dev
+# Opentip Version 1.4.5-dev
The [opentip][opentip]-class is a free opensource Java-Script tooltip class based on the [prototype][prototype] framework.
@@ -75,6 +75,10 @@ Thanks to the following people for providing bug reports, feature requests and f
If I forgot somebody, please just tell me.
+### Related projects
+
+You might also be interested in my [formwatcher](http://www.formwatcher.org/).
+
## License
Copyright (c) 2012 Matias Meno<br>
Licenced under the MIT Licence.
View
4 opentip.js
@@ -44,7 +44,7 @@
*/
var Opentip = {
- Version: '1.4.4-dev',
+ Version: '1.4.5-dev',
REQUIRED_PROTOTYPE_VERSION: '1.6.0',
REQUIRED_SCRIPTACULOUS_VERSION: '1.8.0',
STICKS_OUT_TOP: 1,
@@ -265,7 +265,7 @@ Event.observe(window, Opentip.IEVersion() ? 'load' : 'dom:loaded', function() {
htmlOptionNames.each(function(optionName) {
var optionValue;
- if (optionValue = element.readAttribute('ot-' + optionName)) {
+ if (optionValue = element.readAttribute('data-ot-' + optionName)) {
try {
// See if it's a JSON string.
optionValue = optionValue.gsub("'", '"').evalJSON();
View
2  opentip.min.js
@@ -34,4 +34,4 @@
** For a full documentation, please visit http://www.opentip.org/documentation
**//**
* Namespace and helper functions for opentips.
- */var Opentip={Version:"1.4.3-dev",REQUIRED_PROTOTYPE_VERSION:"1.6.0",REQUIRED_SCRIPTACULOUS_VERSION:"1.8.0",STICKS_OUT_TOP:1,STICKS_OUT_BOTTOM:2,STICKS_OUT_LEFT:1,STICKS_OUT_RIGHT:2,cached:{},debugging:!1,load:function(){function a(a){var b=a.split(".");return parseInt(b[0])*1e5+parseInt(b[1])*1e3+parseInt(b[2])}if(typeof Prototype=="undefined"||typeof Element=="undefined"||typeof Element.Methods=="undefined"||a(Prototype.Version)<a(Opentip.REQUIRED_PROTOTYPE_VERSION))throw"Opentip requires the Prototype JavaScript framework >= "+Opentip.REQUIRED_PROTOTYPE_VERSION;Opentip.useCss3Transitions=Opentip.supports("transition"),Opentip.useScriptaculousTransitions=!Opentip.useCss3Transitions,Opentip.useCss3Transitions&&Opentip.debug("Using CSS3 transitions.");if(typeof Scriptaculous=="undefined"||typeof Effect=="undefined"||a(Scriptaculous.Version)<a(Opentip.REQUIRED_SCRIPTACULOUS_VERSION))Opentip.debug("No scriptaculous available. Disabling scriptaculous transitions."),Opentip.useScriptaculousTransitions=!1},debug:function(){this.debugging&&typeof console!="undefined"&&typeof console.debug!="undefined"&&console.debug.apply(console,arguments)},IEVersion:function(){if(typeof Opentip.cached.IEVersion!="undefined")return Opentip.cached.IEVersion;if(Prototype.Browser.IE)var a=navigator.userAgent.match("MSIE ([\\d.]+)"),b=a?parseFloat(a[1]):!1;else b=!1;return Opentip.cached.IEVersion=b,b},objectIsEvent:function(a){return typeof a=="object"&&a.type&&a.screenX},useIFrame:function(){return Opentip.IEVersion()?Opentip.IEVersion()<=6:!1},lastTipId:1,lastZIndex:100,documentIsLoaded:!1,postponeCreation:function(a){Opentip.documentIsLoaded||!Opentip.IEVersion()?a():Event.observe(window,"load",a)},element:function(a,b,c){if(Object.isArray(b)||Object.isString(b)||Object.isElement(b))c=b,b=null;var d=new Element(a,b||{});return b&&b.className&&b.className.split(" ").each(function(a){d.addClassName(a)}),c&&(Object.isArray(c)?c.each(function(a){d.insert({bottom:a})}):d.insert({bottom:c})),d},sanitizePosition:function(a){var b;if(Object.isArray(a)){var c="";a[0]=="center"?c=a[1]:a[1]=="middle"?c=a[0]:c=a[1]+a[0].capitalize();if(Opentip.position[c]===undefined)throw"Unknown position: "+c;b=Opentip.position[c]}else if(Object.isString(a)){if(Opentip.position[a]===undefined)throw"Unknown position: "+a;b=Opentip.position[a]}return parseInt(b)},vendors:"Khtml Ms O Moz Webkit".split(" "),testDiv:document.createElement("div"),supports:function(a){return a in Opentip.testDiv.style?!0:(a=a.ot_ucfirst(),Opentip.vendors.any(function(b){return b+a in Opentip.testDiv.style}))}};String.prototype.ot_ucfirst=function(){return this.replace(/^\w/,function(a){return a.toUpperCase()})},Opentip.load(),Opentip.styles={standard:{title:null,className:"standard",stem:!1,delay:null,hideDelay:.1,fixed:!1,showOn:"mouseover",hideTrigger:"trigger",hideOn:null,offset:[0,0],containInViewport:!0,autoOffset:!0,showEffect:"appear",fallbackShowEffect:"appear",hideEffect:"fade",fallbackHideEffect:"appear",showEffectDuration:.3,hideEffectDuration:.2,stemSize:8,tipJoint:["left","top"],target:null,targetJoint:null,ajax:!1,group:null,escapeHtml:!1,style:null},slick:{className:"slick",stem:!0},rounded:{className:"rounded",stem:!0},glass:{className:"glass"}},Opentip.defaultStyle="standard",Opentip.position={top:0,topRight:1,right:2,bottomRight:3,bottom:4,bottomLeft:5,left:6,topLeft:7},Event.observe(window,Opentip.IEVersion()?"load":"dom:loaded",function(){Opentip.documentIsLoaded=!0;var a=[];for(var b in Opentip.styles.standard)a.push(b.underscore().dasherize());$$("[data-ot]").each(function(b){var c={};b=$(b);var d=b.readAttribute("data-ot");if(d===""||d==="true"||d==="yes")d=b.readAttribute("title"),b.title="";d||(d=""),a.each(function(a){var d;if(d=b.readAttribute("ot-"+a)){try{d=d.gsub("'",'"').evalJSON()}catch(e){}c[a.camelize()]=d}}),b.addTip(d,c)})});var Tips={list:[],append:function(a){this.list.push(a)},remove:function(a){if(!a.element)var b=this.list.find(function(b){return b.triggerElement===a});else var b=this.list.find(function(b){return b===a});b&&(b.deactivate(),b.destroyAllElements(),this.list=this.list.without(b))},add:function(a){if(a._opentipAddedTips){var b=this.list.find(function(b){return b.triggerElement===a});b.options.showOn=="creation"&&b.show(),b.debug("Using an existing opentip.");return}setTimeout(function(){a._opentipAddedTips=!0},1),Opentip.debug("Creating new opentip");var c=[];$A(arguments).each(function(a,b){b==1&&!Opentip.objectIsEvent(a)&&c.push(null),c.push(a)});var d=new TipClass(c[0],c[1],c[2],c[3],c[4]);this.append(d);var e=this,f=function(){d.create(c[1])};return Opentip.postponeCreation(f),d},hideGroup:function(a){this.list.findAll(function(b){return b.options.group==a}).invoke("doHide")},abortShowingGroup:function(a){this.list.findAll(function(b){return b.options.group==a}).invoke("abortShowing")}},Tip=function(){return Tips.add.apply(Tips,arguments)};Element.addMethods({addTip:function(a){return a=$(a),Tips.add.apply(Tips,arguments),a},setCss3Style:function(a){a=$(a);var b={};for(var c in arguments[1]){var d=c.ot_ucfirst(),e=arguments[1][c];Opentip.vendors.each(function(c){b[c+d]=e,a.setStyle(b)})}return a}});var TipClass=Class.create({debug:function(){var a=Array.from(arguments);a.unshift("ID:",this.id,"|"),Opentip.debug.apply(Opentip,a)},initialize:function(a,b){this.id=Opentip.lastTipId++,a=$(a),this.triggerElement=a,this.loaded=!1,this.loading=!1,this.visible=!1,this.waitingToShow=!1,this.waitingToHide=!1,this.lastPosition={left:0,top:0},this.dimensions=[100,50];var c={};this.content="",typeof arguments[2]=="object"?c=Object.clone(arguments[2]):typeof arguments[3]=="object"?(this.setContent(arguments[2]),c=Object.clone(arguments[3])):typeof arguments[4]=="object"?(this.setContent(arguments[2]),c=Object.clone(arguments[4]),c.title=arguments[3]):((Object.isString(arguments[2])||Object.isFunction(arguments[2]))&&this.setContent(arguments[2]),Object.isString(arguments[3])&&(c.title=arguments[3])),!c.showOn&&b&&(c.showOn=b.type),c.ajax&&!c.ajax.url&&(this.triggerElement.tagName.toLowerCase()=="a"?(typeof c.ajax!="object"&&(c.ajax={}),c.ajax.url=this.triggerElement.href):c.ajax=!1),c.showOn=="click"&&this.triggerElement.tagName.toLowerCase()=="a"&&(b&&b.stop(),this.triggerElement.observe("click",function(a){a.stop()})),c.style||(c.style=Opentip.defaultStyle);var d=Object.extend({},Opentip.styles.standard);c.style!="standard"&&Object.extend(d,Opentip.styles[c.style]),c=Object.extend(d,c),c.target&&(c.fixed=!0),c.stem===!0&&(c.stem=c.tipJoint),c.target===!0?c.target=this.triggerElement:c.target&&(c.target=$(c.target)),this.currentStemPosition=c.stem,c.delay===null&&(c.showOn=="mouseover"?c.delay=.2:c.delay=0),Opentip.useScriptaculousTransitions&&(c.showEffect&&!Effect[c.showEffect.ot_ucfirst()]&&(this.debug('Using fallback show effect "'+c.fallbackShowEffect+'" instead of "'+c.showEffect+'"'),c.showEffect=c.fallbackShowEffect),c.hideEffect&&!Effect[c.hideEffect.ot_ucfirst()]&&(this.debug('Using fallback hide effect "'+c.fallbackHideEffect+'" instead of "'+c.hideEffect+'"'),c.hideEffect=c.fallbackHideEffect)),c.targetJoint==null&&(c.targetJoint=[],c.targetJoint[0]=c.tipJoint[0]=="left"?"right":c.tipJoint[0]=="right"?"left":"center",c.targetJoint[1]=c.tipJoint[1]=="top"?"bottom":c.tipJoint[1]=="bottom"?"top":"middle"),this.options=c,this.options.showTriggerElementsWhenHidden=[],this.options.showOn&&this.options.showOn!="creation"&&this.options.showTriggerElementsWhenHidden.push({element:this.triggerElement,event:this.options.showOn}),this.options.showTriggerElementsWhenVisible=[],this.options.hideTriggerElements=[]},create:function(a){this.buildContainer();if(this.options.hideTrigger){var b=null,c=null;this.options.hideTrigger instanceof Array||(this.options.hideTrigger=[this.options.hideTrigger]),this.options.hideTrigger.each(function(a,d){var e=this.options.hideOn instanceof Array?this.options.hideOn[d]:this.options.hideOn;switch(a){case"trigger":b=e?e:"mouseout",c=this.triggerElement;break;case"tip":b=e?e:"mouseover",c=this.container;break;case"target":b=e?e:"mouseover",c=this.options.target;break;case"closeButton":break;default:b=e?e:"mouseover",c=$(a)}c&&(this.options.hideTriggerElements.push({element:c,event:b}),b=="mouseout"&&this.options.showTriggerElementsWhenVisible.push({element:c,event:"mouseover"}))}.bind(this))}this.activate(),(a||this.options.showOn=="creation")&&this.show(a)},activate:function(){this.bound={},this.bound.doShow=this.doShow.bindAsEventListener(this),this.bound.show=this.show.bindAsEventListener(this),this.bound.doHide=this.doHide.bindAsEventListener(this),this.bound.hide=this.hide.bindAsEventListener(this),this.bound.position=this.position.bindAsEventListener(this);if(this.options.showEffect||this.options.hideEffect)this.queue={limit:1,position:"end",scope:this.container.identify()};this.setupObserversForReallyHiddenTip(),this.setupObserversForHiddenTip()},deactivate:function(){this.debug("Deactivating tooltip."),this.doHide(),this.setupObserversForReallyHiddenTip()},buildContainer:function(){this.container=$(Opentip.element("div",{className:"ot-container ot-completely-hidden style-"+this.options.className+(this.options.ajax?" ot-loading":"")+(this.options.fixed?" ot-fixed":"")})),Opentip.useCss3Transitions&&(this.container.setCss3Style({transitionDuration:"0s"}),this.container.addClassName("ot-css3"),this.options.showEffect&&this.container.addClassName("ot-show-"+this.options.showEffect),this.options.hideEffect&&this.container.addClassName("ot-hide-"+this.options.hideEffect)),Opentip.useScriptaculousTransitions&&this.container.setStyle({display:"none"})},buildElements:function(){var a,b;if(this.options.stem){var c="-"+this.options.stemSize+"px";this.container.appendChild(Opentip.element("div",{className:"stem-container "+this.options.stem[0]+" "+this.options.stem[1]},a=Opentip.element("canvas",{className:"stem"})))}var d=this,e=[],f=[];this.options.title&&f.push(Opentip.element("div",{className:"title"},this.options.title)),e.push(Opentip.element("div",{className:"header"},f)),e.push($(Opentip.element("div",{className:"content"}))),this.options.ajax&&e.push($(Opentip.element("div",{className:"loadingIndication"},Opentip.element("span","Loading...")))),this.tooltipElement=$(Opentip.element("div",{className:"opentip"},e)),this.container.appendChild(this.tooltipElement);var g=this.container.appendChild(Opentip.element("div",{className:"ot-buttons"})),h=!1;this.options.hideTrigger&&this.options.hideTrigger.include("closeButton")&&(g.appendChild(Opentip.element("a",{href:"javascript:undefined",className:"close"},b=Opentip.element("canvas",{className:"canvas"}))),h=!0),Opentip.useIFrame()&&(this.iFrameElement=this.container.appendChild($(Opentip.element("iframe",{className:"opentipIFrame",src:"javascript:false;"})).setStyle({display:"none",zIndex:100}).setOpacity(0))),document.body.appendChild(this.container),typeof G_vmlCanvasManager!="undefined"&&(a&&G_vmlCanvasManager.initElement(a),b&&G_vmlCanvasManager.initElement(b)),h&&this.drawCloseButton()},drawCloseButton:function(){var a=this.container.down(".ot-buttons canvas"),b=this.container.down(".ot-buttons .close"),c=parseInt(b.getStyle("width"))||20,d=a.getStyle("color");if(!d||d=="transparent")d="white";var e=a.getStyle("backgroundColor");if(!e||e=="transparent")e="rgba(0, 0, 0, 0.2)";a.setStyle({backgroundColor:"transparent"}),a.width=c,a.height=c;var f=a.getContext("2d");f.clearRect(0,0,c,c),f.beginPath();var g=c/2.95;f.fillStyle=e,f.lineWidth=c/5.26,f.strokeStyle=d,f.lineCap="round",f.arc(c/2,c/2,c/2,0,Math.PI*2,!1),f.fill(),f.beginPath(),f.moveTo(g,g),f.lineTo(c-g,c-g),f.stroke(),f.beginPath(),f.moveTo(c-g,g),f.lineTo(g,c-g),f.stroke()},setContent:function(a){this.content=a,this.visible&&this.updateElementContent()},updateElementContent:function(){var a=this.container.down(".content");a&&(Object.isFunction(this.content)&&(this.debug("Executing content function."),this.content=this.content(this)),a.update(this.options.escapeHtml?this.content.escapeHTML():this.content)),this.storeAndFixDimensions()},storeAndFixDimensions:function(){this.container.setStyle({width:"auto",left:"0px",top:"0px"}),this.dimensions=this.container.getDimensions(),this.container.setStyle({width:this.dimensions.width+"px",left:this.lastPosition.left+"px",top:this.lastPosition.top+"px"})},destroyAllElements:function(){this.container&&this.container.remove()},clearShowTimeout:function(){window.clearTimeout(this.timeoutId)},clearHideTimeout:function(){window.clearTimeout(this.hideTimeoutId)},clearTimeouts:function(){window.clearTimeout(this.visibilityStateTimeoutId),this.clearShowTimeout(),this.clearHideTimeout()},setupObserversForReallyVisibleTip:function(){this.options.showTriggerElementsWhenVisible.each(function(a){$(a.element).observe(a.event,this.bound.show)},this)},setupObserversForVisibleTip:function(){this.options.hideTriggerElements.each(function(a){$(a.element).observe(a.event,this.bound.hide)},this),this.options.showTriggerElementsWhenHidden.each(function(a){$(a.element).stopObserving(a.event,this.bound.show)},this),Event.observe(document.onresize?document:window,"resize",this.bound.position),Event.observe(window,"scroll",this.bound.position)},setupObserversForReallyHiddenTip:function(){this.options.showTriggerElementsWhenVisible.each(function(a){$(a.element).stopObserving(a.event,this.bound.show)},this)},setupObserversForHiddenTip:function(){this.options.showTriggerElementsWhenHidden.each(function(a){$(a.element).observe(a.event,this.bound.show)},this),this.options.hideTriggerElements.each(function(a){$(a.element).stopObserving(a.event,this.bound.hide)},this),Event.stopObserving(document.onresize?document:window,"resize",this.bound.position),Event.stopObserving(window,"scroll",this.bound.position)},show:function(a){this.abortHiding();if(this.visible)return;this.debug("Showing in "+this.options.delay+"s."),this.options.group&&Tips.abortShowingGroup(this.options.group),this.waitingToShow=!0,this.setupObserversForVisibleTip(),this.followMousePosition(),this.position(a),this.options.delay?this.timeoutId=this.bound.doShow.delay(this.options.delay):this.bound.doShow(a)},abortShowing:function(){this.waitingToShow&&(this.debug("Aborting showing."),this.clearTimeouts(),this.stopFollowingMousePosition(),this.waitingToShow=!1,this.setupObserversForHiddenTip())},doShow:function(){this.clearTimeouts();if(this.visible)return;if(!this.triggerElementExists()){this.deactivate();return}this.debug("Showing!"),this.options.group&&Tips.hideGroup(this.options.group),this.visible=!0,this.waitingToShow=!1,this.tooltipElement||this.buildElements(),this.updateElementContent(),this.options.ajax&&!this.loaded&&this.loadAjax(),this.searchAndActivateHideButtons(),this.ensureElement(),this.container.setStyle({zIndex:Opentip.lastZIndex+=1}),this.setupObserversForReallyVisibleTip(),this.setupObserversForVisibleTip(),Opentip.useScriptaculousTransitions&&((this.options.showEffect||this.options.hideEffect)&&this.cancelEffects(),!this.options.showEffect||!this.container[this.options.showEffect]?this.container.show():this.container[this.options.showEffect]({duration:this.options.showEffectDuration,queue:this.queue,afterFinish:this.afterShowEffect.bind(this)}),Opentip.useIFrame()&&this.iFrameElement.show()),this.position(),this.container.removeClassName("ot-hidden").addClassName("ot-becoming-visible");var a=function(){Opentip.useCss3Transitions&&this.container.setCss3Style({transitionDuration:this.options.showEffectDuration+"s"}),this.container.removeClassName("ot-becoming-visible").addClassName("ot-visible"),this.options.showEffect&&this.options.showEffectDuration?this.visibilityStateTimeoutId=function(){this.removeClassName("ot-visible").addClassName("ot-completely-visible")}.bind(this.container).delay(this.options.showEffectDuration):this.container.removeClassName("ot-visible").addClassName("ot-completely-visible"),this.activateFirstInput()};((function(){this.container.removeClassName("ot-completely-hidden"),a.bind(this).defer()})).bind(this).defer()},loadAjax:function(){if(this.loading)return;this.loading=!0,this.container.addClassName("ot-loading"),this.debug("Loading content from "+this.options.ajax.url+"."),new Ajax.Request(this.options.ajax.url,Object.extend({onComplete:function(){this.container.removeClassName("ot-loading"),this.loaded=!0,this.loading=!1,this.updateElementContent(),this.searchAndActivateHideButtons(),this.activateFirstInput(),this.position()}.bind(this),onSuccess:function(a){this.debug("Loading successfull."),this.content=a.responseText}.bind(this),onFailure:function(){this.debug("There was a problem downloading the file."),this.options.escapeHtml=!1,this.content='<a class="close">There was a problem downloading the content.</a>'}.bind(this)},this.options.ajax.options||{}))},afterShowEffect:function(){this.activateFirstInput(),this.position()},activateFirstInput:function(){var a=this.container.down("input"),b=this.container.down("textarea");a?a.focus():b&&b.focus()},searchAndActivateHideButtons:function(){if(!this.options.hideTrigger||this.options.hideTrigger.include("closeButton"))this.options.hideTriggerElements=[],this.container.select(".close").each(function(a){this.options.hideTriggerElements.push({element:a,event:"click"})},this),this.visible&&this.setupObserversForVisibleTip()},hide:function(a){this.abortShowing();if(!this.visible)return;this.debug("Hiding in "+this.options.hideDelay+"s."),this.waitingToHide=!0,this.setupObserversForHiddenTip(),this.hideTimeoutId=this.bound.doHide.delay(this.options.hideDelay,a)},abortHiding:function(){this.waitingToHide&&(this.debug("Aborting hiding."),this.clearTimeouts(),this.waitingToHide=!1,this.setupObserversForVisibleTip())},doHide:function(a){this.clearTimeouts();if(!this.visible)return;this.debug("Hiding!"),this.visible=!1,this.waitingToHide=!1,this.deactivateElementEnsurance(),this.setupObserversForReallyHiddenTip(),this.setupObserversForHiddenTip(),this.options.fixed||this.stopFollowingMousePosition();if(Opentip.useScriptaculousTransitions){(this.options.showEffect||this.options.hideEffect)&&this.cancelEffects();if(!this.options.hideEffect||!this.container[this.options.hideEffect])this.container.hide();else{var b={duration:this.options.hideEffectDuration,queue:this.queue};a&&Object.isFunction(a)&&(b.afterFinish=a),this.container[this.options.hideEffect](b)}Opentip.useIFrame()&&this.iFrameElement.hide()}Opentip.useCss3Transitions&&this.container.setCss3Style({transitionDuration:this.options.hideEffectDuration+"s"}),this.container.removeClassName("ot-visible").removeClassName("ot-completely-visible").addClassName("ot-hidden"),this.options.hideEffect&&this.options.hideEffectDuration?this.visibilityStateTimeoutId=function(){this.setCss3Style({transitionDuration:"0s"}),this.removeClassName("ot-hidden").addClassName("ot-completely-hidden")}.bind(this.container).delay(this.options.showEffectDuration):this.container.removeClassName("ot-hidden").addClassName("ot-completely-hidden")},cancelEffects:function(){Effect.Queues.get(this.queue.scope).invoke("cancel")},followMousePosition:function(){this.options.fixed||$(document.body).observe("mousemove",this.bound.position)},stopFollowingMousePosition:function(){this.options.fixed||$(document.body).stopObserving("mousemove",this.bound.position)},positionsEqual:function(a,b){return a.left==b.left&&a.top==b.top},position:function(a){var a=a||this.lastEvt;this.currentStemPosition=this.options.stem;var b=this.ensureViewportContainment(a,this.getPosition(a));if(this.positionsEqual(b,this.lastPosition)){this.positionStem();return}this.lastPosition=b;if(b){var c={left:b.left+"px",top:b.top+"px"};this.container.setStyle(c),Opentip.useIFrame()&&this.iFrameElement&&this.iFrameElement.setStyle({width:this.container.getWidth()+"px",height:this.container.getHeight()+"px"});var d=this.container;((function(){d.style.visibility="hidden";var a=d.offsetHeight;d.style.visibility="visible"})).defer()}this.positionStem()},getPosition:function(a,b,c,d){var b=b||this.options.tipJoint,c=c||this.options.targetJoint,e={};if(this.options.target){var f=this.options.target.cumulativeOffset();e.left=f[0],e.top=f[1],c[0]=="right"?typeof this.options.target.getBoundingClientRect!="undefined"?e.left=this.options.target.getBoundingClientRect().right+$(document.viewport).getScrollOffsets().left:e.left=e.left+this.options.target.getWidth():c[0]=="center"&&(e.left+=Math.round(this.options.target.getWidth()/2)),c[1]=="bottom"?e.top+=this.options.target.getHeight():c[1]=="middle"&&(e.top+=Math.round(this.options.target.getHeight()/2))}else{if(!a)return;this.lastEvt=a,e.left=Event.pointerX(a),e.top=Event.pointerY(a)}if(this.options.autoOffset){var g=this.options.stem?this.options.stemSize:0,h=g&&this.options.fixed?2:10,i=b[1]=="middle"&&!this.options.fixed?15:0,j=b[0]=="center"&&!this.options.fixed?15:0;b[0]=="right"?e.left-=h+i:b[0]=="left"&&(e.left+=h+i),b[1]=="bottom"?e.top-=h+j:b[1]=="top"&&(e.top+=h+j);if(g){var d=d||this.options.stem;d[0]=="right"?e.left-=g:d[0]=="left"&&(e.left+=g),d[1]=="bottom"?e.top-=g:d[1]=="top"&&(e.top+=g)}}return e.left+=this.options.offset[0],e.top+=this.options.offset[1],b[0]=="right"&&(e.left-=this.container.getWidth()),b[0]=="center"&&(e.left-=Math.round(this.container.getWidth()/2)),b[1]=="bottom"&&(e.top-=this.container.getHeight()),b[1]=="middle"&&(e.top-=Math.round(this.container.getHeight()/2)),e},ensureViewportContainment:function(a,b){if(!this.visible)return b;var c=[this.sticksOutX(b),this.sticksOutY(b)];if(!c[0]&&!c[1])return b;var d=this.options.tipJoint.clone(),e=this.options.targetJoint.clone(),f=$(document.viewport).getScrollOffsets(),g=this.dimensions,h={left:b.left-f.left,top:b.top-f.top},i=document.viewport.getDimensions(),j=!1;i.width>=g.width&&(h.left<0?(j=!0,d[0]="left",this.options.target&&e[0]=="left"&&(e[0]="right")):h.left+g.width>i.width&&(j=!0,d[0]="right",this.options.target&&e[0]=="right"&&(e[0]="left"))),i.height>=g.height&&(h.top<0?(j=!0,d[1]="top",this.options.target&&e[1]=="top"&&(e[1]="bottom")):h.top+g.height>i.height&&(j=!0,d[1]="bottom",this.options.target&&e[1]=="bottom"&&(e[1]="top")));if(j){var k=this.getPosition(a,d,e,d),l=[this.sticksOutX(k),this.sticksOutY(k)],m=0;for(var n=0;n<=1;n++)l[n]&&l[n]!=c[n]&&(m++,d[n]=this.options.tipJoint[n],this.options.target&&(e[n]=this.options.targetJoint[n]));if(m<2)return this.currentStemPosition=d,this.getPosition(a,d,e,d)}return b},sticksOut:function(a){return this.sticksOutX(a)||this.sticksOutY(a)},sticksOutX:function(a){var b=$(document.viewport).getScrollOffsets(),c={left:a.left-b.left,top:a.top-b.top};if(c.left<0)return Opentip.STICKS_OUT_LEFT;if(c.left+this.dimensions.width>document.viewport.getDimensions().width)return Opentip.STICKS_OUT_RIGHT},sticksOutY:function(a){var b=$(document.viewport).getScrollOffsets(),c={left:a.left-b.left,top:a.top-b.top};if(c.top<0)return Opentip.STICKS_OUT_TOP;if(c.top+this.dimensions.height>document.viewport.getDimensions().height)return Opentip.STICKS_OUT_BOTTOM},getStemCanvas:function(){return this.container.down(".stem")},stemPositionsEqual:function(a,b){return a&&b&&a[0]==b[0]&&a[1]==b[1]},positionStem:function(){if(this.options.stem){var a=this.getStemCanvas();if(a&&!this.stemPositionsEqual(this.lastStemPosition,this.currentStemPosition)){this.debug("Setting stem style"),this.lastStemPosition=this.currentStemPosition;var b=Opentip.sanitizePosition(this.currentStemPosition),c=this.options.stemSize,d=b*Math.PI/4,e=Math.round(c*1.5),f={w:e,h:c},g=!1;if(b%2==1){g=!0;var h=Math.round(.707106781*e);f={w:c+h,h:c+h}}var i=Object.clone(f);if(b==Opentip.position.left||b==Opentip.position.right)f.h=i.w,f.w=i.h;var j=a.getStyle("color")||"black";a.width=f.w,a.height=f.h;var k=a.getContext("2d");k.clearRect(0,0,a.width,a.height),k.beginPath(),k.fillStyle=j,k.save(),k.translate(f.w/2,f.h/2);var l=Math.floor(b/2);k.rotate(l*Math.PI/2),f.w==i.w?k.translate(-f.w/2,-f.h/2):k.translate(-f.h/2,-f.w/2),g?(k.moveTo(h,i.h),k.lineTo(i.w,0),k.lineTo(0,i.h-h)):(k.moveTo(i.w/2-e/2,i.h),k.lineTo(i.w/2,0),k.lineTo(i.w/2+e/2,i.h)),k.fill(),k.restore();var m={width:f.w+"px",height:f.h+"px",left:"",right:"",top:"",bottom:""};switch(b){case Opentip.position.top:m.top=-f.h+"px",m.left=-Math.round(f.w/2)+"px";break;case Opentip.position.right:m.top=-Math.round(f.h/2)+"px",m.left=0;break;case Opentip.position.bottom:m.top=0,m.left=-Math.round(f.w/2)+"px";break;case Opentip.position.left:m.top=-Math.round(f.h/2)+"px",m.left=-f.w+"px";break;case Opentip.position.topRight:m.top=-c+"px",m.left=-h+"px";break;case Opentip.position.bottomRight:m.top=-h+"px",m.left=-h+"px";break;case Opentip.position.bottomLeft:m.top=-h+"px",m.left=-c+"px";break;case Opentip.position.topLeft:m.top=-c+"px",m.left=-c+"px";break;default:throw"Unknown stem position: "+b}a.setStyle(m);var n=a.up(".stem-container");n.removeClassName("left").removeClassName("right").removeClassName("center").removeClassName("top").removeClassName("bottom").removeClassName("middle");switch(b){case Opentip.position.top:case Opentip.position.topLeft:case Opentip.position.topRight:n.addClassName("top");break;case Opentip.position.bottom:case Opentip.position.bottomLeft:case Opentip.position.bottomRight:n.addClassName("bottom");break;default:n.addClassName("middle")}switch(b){case Opentip.position.left:case Opentip.position.topLeft:case Opentip.position.bottomLeft:n.addClassName("left");break;case Opentip.position.right:case Opentip.position.topRight:case Opentip.position.bottomRight:n.addClassName("right");break;default:n.addClassName("center")}}}},triggerElementExists:function(a){return this.triggerElement.parentNode&&this.triggerElement.visible()&&this.triggerElement.descendantOf(document.body)},ensureElementInterval:1e3,ensureElement:function(){this.deactivateElementEnsurance(),this.triggerElementExists()||this.deactivate(),this.ensureElementTimeoutId=setTimeout(this.ensureElement.bind(this),this.ensureElementInterval)},deactivateElementEnsurance:function(){clearTimeout(this.ensureElementTimeoutId)}});
+ */var Opentip={Version:"1.4.4-dev",REQUIRED_PROTOTYPE_VERSION:"1.6.0",REQUIRED_SCRIPTACULOUS_VERSION:"1.8.0",STICKS_OUT_TOP:1,STICKS_OUT_BOTTOM:2,STICKS_OUT_LEFT:1,STICKS_OUT_RIGHT:2,cached:{},debugging:!1,load:function(){function a(a){var b=a.split(".");return parseInt(b[0])*1e5+parseInt(b[1])*1e3+parseInt(b[2])}if(typeof Prototype=="undefined"||typeof Element=="undefined"||typeof Element.Methods=="undefined"||a(Prototype.Version)<a(Opentip.REQUIRED_PROTOTYPE_VERSION))throw"Opentip requires the Prototype JavaScript framework >= "+Opentip.REQUIRED_PROTOTYPE_VERSION;Opentip.useCss3Transitions=Opentip.supports("transition"),Opentip.useScriptaculousTransitions=!Opentip.useCss3Transitions,Opentip.useCss3Transitions&&Opentip.debug("Using CSS3 transitions.");if(typeof Scriptaculous=="undefined"||typeof Effect=="undefined"||a(Scriptaculous.Version)<a(Opentip.REQUIRED_SCRIPTACULOUS_VERSION))Opentip.debug("No scriptaculous available. Disabling scriptaculous transitions."),Opentip.useScriptaculousTransitions=!1},debug:function(){this.debugging&&typeof console!="undefined"&&typeof console.debug!="undefined"&&console.debug.apply(console,arguments)},IEVersion:function(){if(typeof Opentip.cached.IEVersion!="undefined")return Opentip.cached.IEVersion;if(Prototype.Browser.IE)var a=navigator.userAgent.match("MSIE ([\\d.]+)"),b=a?parseFloat(a[1]):!1;else b=!1;return Opentip.cached.IEVersion=b,b},objectIsEvent:function(a){return typeof a=="object"&&a.type&&a.screenX},useIFrame:function(){return Opentip.IEVersion()?Opentip.IEVersion()<=6:!1},lastTipId:1,lastZIndex:100,documentIsLoaded:!1,postponeCreation:function(a){Opentip.documentIsLoaded||!Opentip.IEVersion()?a():Event.observe(window,"load",a)},element:function(a,b,c){if(Object.isArray(b)||Object.isString(b)||Object.isElement(b))c=b,b=null;var d=new Element(a,b||{});return b&&b.className&&b.className.split(" ").each(function(a){d.addClassName(a)}),c&&(Object.isArray(c)?c.each(function(a){d.insert({bottom:a})}):d.insert({bottom:c})),d},sanitizePosition:function(a){var b;if(Object.isArray(a)){var c="";a[0]=="center"?c=a[1]:a[1]=="middle"?c=a[0]:c=a[1]+a[0].capitalize();if(Opentip.position[c]===undefined)throw"Unknown position: "+c;b=Opentip.position[c]}else if(Object.isString(a)){if(Opentip.position[a]===undefined)throw"Unknown position: "+a;b=Opentip.position[a]}return parseInt(b)},vendors:"Khtml Ms O Moz Webkit".split(" "),testDiv:document.createElement("div"),supports:function(a){return a in Opentip.testDiv.style?!0:(a=a.ot_ucfirst(),Opentip.vendors.any(function(b){return b+a in Opentip.testDiv.style}))}};String.prototype.ot_ucfirst=function(){return this.replace(/^\w/,function(a){return a.toUpperCase()})},Opentip.load(),Opentip.styles={standard:{title:null,className:"standard",stem:!1,delay:null,hideDelay:.1,fixed:!1,showOn:"mouseover",hideTrigger:"trigger",hideOn:null,offset:[0,0],containInViewport:!0,autoOffset:!0,showEffect:"appear",fallbackShowEffect:"appear",hideEffect:"fade",fallbackHideEffect:"appear",showEffectDuration:.3,hideEffectDuration:.2,stemSize:8,tipJoint:["left","top"],target:null,targetJoint:null,ajax:!1,group:null,escapeHtml:!1,style:null},slick:{className:"slick",stem:!0},rounded:{className:"rounded",stem:!0},glass:{className:"glass"}},Opentip.defaultStyle="standard",Opentip.position={top:0,topRight:1,right:2,bottomRight:3,bottom:4,bottomLeft:5,left:6,topLeft:7},Event.observe(window,Opentip.IEVersion()?"load":"dom:loaded",function(){Opentip.documentIsLoaded=!0;var a=[];for(var b in Opentip.styles.standard)a.push(b.underscore().dasherize());$$("[data-ot]").each(function(b){var c={};b=$(b);var d=b.readAttribute("data-ot");if(d===""||d==="true"||d==="yes")d=b.readAttribute("title"),b.title="";d||(d=""),a.each(function(a){var d;if(d=b.readAttribute("data-ot-"+a)){try{d=d.gsub("'",'"').evalJSON()}catch(e){}c[a.camelize()]=d}}),b.addTip(d,c)})});var Tips={list:[],append:function(a){this.list.push(a)},remove:function(a){if(!a.element)var b=this.list.find(function(b){return b.triggerElement===a});else var b=this.list.find(function(b){return b===a});b&&(b.deactivate(),b.destroyAllElements(),this.list=this.list.without(b))},add:function(a){if(a._opentipAddedTips){var b=this.list.find(function(b){return b.triggerElement===a});b.options.showOn=="creation"&&b.show(),b.debug("Using an existing opentip.");return}setTimeout(function(){a._opentipAddedTips=!0},1),Opentip.debug("Creating new opentip");var c=[];$A(arguments).each(function(a,b){b==1&&!Opentip.objectIsEvent(a)&&c.push(null),c.push(a)});var d=new TipClass(c[0],c[1],c[2],c[3],c[4]);this.append(d);var e=this,f=function(){d.create(c[1])};return Opentip.postponeCreation(f),d},hideGroup:function(a){this.list.findAll(function(b){return b.options.group==a}).invoke("doHide")},abortShowingGroup:function(a){this.list.findAll(function(b){return b.options.group==a}).invoke("abortShowing")}},Tip=function(){return Tips.add.apply(Tips,arguments)};Element.addMethods({addTip:function(a){return a=$(a),Tips.add.apply(Tips,arguments),a},setCss3Style:function(a){a=$(a);var b={};for(var c in arguments[1]){var d=c.ot_ucfirst(),e=arguments[1][c];Opentip.vendors.each(function(c){b[c+d]=e,a.setStyle(b)})}return a}});var TipClass=Class.create({debug:function(){var a=Array.from(arguments);a.unshift("ID:",this.id,"|"),Opentip.debug.apply(Opentip,a)},initialize:function(a,b){this.id=Opentip.lastTipId++,a=$(a),this.triggerElement=a,this.loaded=!1,this.loading=!1,this.visible=!1,this.waitingToShow=!1,this.waitingToHide=!1,this.lastPosition={left:0,top:0},this.dimensions=[100,50];var c={};this.content="",typeof arguments[2]=="object"?c=Object.clone(arguments[2]):typeof arguments[3]=="object"?(this.setContent(arguments[2]),c=Object.clone(arguments[3])):typeof arguments[4]=="object"?(this.setContent(arguments[2]),c=Object.clone(arguments[4]),c.title=arguments[3]):((Object.isString(arguments[2])||Object.isFunction(arguments[2]))&&this.setContent(arguments[2]),Object.isString(arguments[3])&&(c.title=arguments[3])),!c.showOn&&b&&(c.showOn=b.type),c.ajax&&!c.ajax.url&&(this.triggerElement.tagName.toLowerCase()=="a"?(typeof c.ajax!="object"&&(c.ajax={}),c.ajax.url=this.triggerElement.href):c.ajax=!1),c.showOn=="click"&&this.triggerElement.tagName.toLowerCase()=="a"&&(b&&b.stop(),this.triggerElement.observe("click",function(a){a.stop()})),c.style||(c.style=Opentip.defaultStyle);var d=Object.extend({},Opentip.styles.standard);c.style!="standard"&&Object.extend(d,Opentip.styles[c.style]),c=Object.extend(d,c),c.target&&(c.fixed=!0),c.stem===!0&&(c.stem=c.tipJoint),c.target===!0?c.target=this.triggerElement:c.target&&(c.target=$(c.target)),this.currentStemPosition=c.stem,c.delay===null&&(c.showOn=="mouseover"?c.delay=.2:c.delay=0),Opentip.useScriptaculousTransitions&&(c.showEffect&&!Effect[c.showEffect.ot_ucfirst()]&&(this.debug('Using fallback show effect "'+c.fallbackShowEffect+'" instead of "'+c.showEffect+'"'),c.showEffect=c.fallbackShowEffect),c.hideEffect&&!Effect[c.hideEffect.ot_ucfirst()]&&(this.debug('Using fallback hide effect "'+c.fallbackHideEffect+'" instead of "'+c.hideEffect+'"'),c.hideEffect=c.fallbackHideEffect)),c.targetJoint==null&&(c.targetJoint=[],c.targetJoint[0]=c.tipJoint[0]=="left"?"right":c.tipJoint[0]=="right"?"left":"center",c.targetJoint[1]=c.tipJoint[1]=="top"?"bottom":c.tipJoint[1]=="bottom"?"top":"middle"),this.options=c,this.options.showTriggerElementsWhenHidden=[],this.options.showOn&&this.options.showOn!="creation"&&this.options.showTriggerElementsWhenHidden.push({element:this.triggerElement,event:this.options.showOn}),this.options.showTriggerElementsWhenVisible=[],this.options.hideTriggerElements=[]},create:function(a){this.buildContainer();if(this.options.hideTrigger){var b=null,c=null;this.options.hideTrigger instanceof Array||(this.options.hideTrigger=[this.options.hideTrigger]),this.options.hideTrigger.each(function(a,d){var e=this.options.hideOn instanceof Array?this.options.hideOn[d]:this.options.hideOn;switch(a){case"trigger":b=e?e:"mouseout",c=this.triggerElement;break;case"tip":b=e?e:"mouseover",c=this.container;break;case"target":b=e?e:"mouseover",c=this.options.target;break;case"closeButton":break;default:b=e?e:"mouseover",c=$(a)}c&&(this.options.hideTriggerElements.push({element:c,event:b}),b=="mouseout"&&this.options.showTriggerElementsWhenVisible.push({element:c,event:"mouseover"}))}.bind(this))}this.activate(),(a||this.options.showOn=="creation")&&this.show(a)},activate:function(){this.bound={},this.bound.doShow=this.doShow.bindAsEventListener(this),this.bound.show=this.show.bindAsEventListener(this),this.bound.doHide=this.doHide.bindAsEventListener(this),this.bound.hide=this.hide.bindAsEventListener(this),this.bound.position=this.position.bindAsEventListener(this);if(this.options.showEffect||this.options.hideEffect)this.queue={limit:1,position:"end",scope:this.container.identify()};this.setupObserversForReallyHiddenTip(),this.setupObserversForHiddenTip()},deactivate:function(){this.debug("Deactivating tooltip."),this.doHide(),this.setupObserversForReallyHiddenTip()},buildContainer:function(){this.container=$(Opentip.element("div",{className:"ot-container ot-completely-hidden style-"+this.options.className+(this.options.ajax?" ot-loading":"")+(this.options.fixed?" ot-fixed":"")})),Opentip.useCss3Transitions&&(this.container.setCss3Style({transitionDuration:"0s"}),this.container.addClassName("ot-css3"),this.options.showEffect&&this.container.addClassName("ot-show-"+this.options.showEffect),this.options.hideEffect&&this.container.addClassName("ot-hide-"+this.options.hideEffect)),Opentip.useScriptaculousTransitions&&this.container.setStyle({display:"none"})},buildElements:function(){var a,b;if(this.options.stem){var c="-"+this.options.stemSize+"px";this.container.appendChild(Opentip.element("div",{className:"stem-container "+this.options.stem[0]+" "+this.options.stem[1]},a=Opentip.element("canvas",{className:"stem"})))}var d=this,e=[],f=[];this.options.title&&f.push(Opentip.element("div",{className:"title"},this.options.title)),e.push(Opentip.element("div",{className:"header"},f)),e.push($(Opentip.element("div",{className:"content"}))),this.options.ajax&&e.push($(Opentip.element("div",{className:"loadingIndication"},Opentip.element("span","Loading...")))),this.tooltipElement=$(Opentip.element("div",{className:"opentip"},e)),this.container.appendChild(this.tooltipElement);var g=this.container.appendChild(Opentip.element("div",{className:"ot-buttons"})),h=!1;this.options.hideTrigger&&this.options.hideTrigger.include("closeButton")&&(g.appendChild(Opentip.element("a",{href:"javascript:undefined",className:"close"},b=Opentip.element("canvas",{className:"canvas"}))),h=!0),Opentip.useIFrame()&&(this.iFrameElement=this.container.appendChild($(Opentip.element("iframe",{className:"opentipIFrame",src:"javascript:false;"})).setStyle({display:"none",zIndex:100}).setOpacity(0))),document.body.appendChild(this.container),typeof G_vmlCanvasManager!="undefined"&&(a&&G_vmlCanvasManager.initElement(a),b&&G_vmlCanvasManager.initElement(b)),h&&this.drawCloseButton()},drawCloseButton:function(){var a=this.container.down(".ot-buttons canvas"),b=this.container.down(".ot-buttons .close"),c=parseInt(b.getStyle("width"))||20,d=a.getStyle("color");if(!d||d=="transparent")d="white";var e=a.getStyle("backgroundColor");if(!e||e=="transparent")e="rgba(0, 0, 0, 0.2)";a.setStyle({backgroundColor:"transparent"}),a.width=c,a.height=c;var f=a.getContext("2d");f.clearRect(0,0,c,c),f.beginPath();var g=c/2.95;f.fillStyle=e,f.lineWidth=c/5.26,f.strokeStyle=d,f.lineCap="round",f.arc(c/2,c/2,c/2,0,Math.PI*2,!1),f.fill(),f.beginPath(),f.moveTo(g,g),f.lineTo(c-g,c-g),f.stroke(),f.beginPath(),f.moveTo(c-g,g),f.lineTo(g,c-g),f.stroke()},setContent:function(a){this.content=a,this.visible&&this.updateElementContent()},updateElementContent:function(){var a=this.container.down(".content");a&&(Object.isFunction(this.content)&&(this.debug("Executing content function."),this.content=this.content(this)),a.update(this.options.escapeHtml?this.content.escapeHTML():this.content)),this.storeAndFixDimensions()},storeAndFixDimensions:function(){this.container.setStyle({width:"auto",left:"0px",top:"0px"}),this.dimensions=this.container.getDimensions(),this.container.setStyle({width:this.dimensions.width+"px",left:this.lastPosition.left+"px",top:this.lastPosition.top+"px"})},destroyAllElements:function(){this.container&&this.container.remove()},clearShowTimeout:function(){window.clearTimeout(this.timeoutId)},clearHideTimeout:function(){window.clearTimeout(this.hideTimeoutId)},clearTimeouts:function(){window.clearTimeout(this.visibilityStateTimeoutId),this.clearShowTimeout(),this.clearHideTimeout()},setupObserversForReallyVisibleTip:function(){this.options.showTriggerElementsWhenVisible.each(function(a){$(a.element).observe(a.event,this.bound.show)},this)},setupObserversForVisibleTip:function(){this.options.hideTriggerElements.each(function(a){$(a.element).observe(a.event,this.bound.hide)},this),this.options.showTriggerElementsWhenHidden.each(function(a){$(a.element).stopObserving(a.event,this.bound.show)},this),Event.observe(document.onresize?document:window,"resize",this.bound.position),Event.observe(window,"scroll",this.bound.position)},setupObserversForReallyHiddenTip:function(){this.options.showTriggerElementsWhenVisible.each(function(a){$(a.element).stopObserving(a.event,this.bound.show)},this)},setupObserversForHiddenTip:function(){this.options.showTriggerElementsWhenHidden.each(function(a){$(a.element).observe(a.event,this.bound.show)},this),this.options.hideTriggerElements.each(function(a){$(a.element).stopObserving(a.event,this.bound.hide)},this),Event.stopObserving(document.onresize?document:window,"resize",this.bound.position),Event.stopObserving(window,"scroll",this.bound.position)},show:function(a){this.abortHiding();if(this.visible)return;this.debug("Showing in "+this.options.delay+"s."),this.options.group&&Tips.abortShowingGroup(this.options.group),this.waitingToShow=!0,this.setupObserversForVisibleTip(),this.followMousePosition(),this.position(a),this.options.delay?this.timeoutId=this.bound.doShow.delay(this.options.delay):this.bound.doShow(a)},abortShowing:function(){this.waitingToShow&&(this.debug("Aborting showing."),this.clearTimeouts(),this.stopFollowingMousePosition(),this.waitingToShow=!1,this.setupObserversForHiddenTip())},doShow:function(){this.clearTimeouts();if(this.visible)return;if(!this.triggerElementExists()){this.deactivate();return}this.debug("Showing!"),this.options.group&&Tips.hideGroup(this.options.group),this.visible=!0,this.waitingToShow=!1,this.tooltipElement||this.buildElements(),this.updateElementContent(),this.options.ajax&&!this.loaded&&this.loadAjax(),this.searchAndActivateHideButtons(),this.ensureElement(),this.container.setStyle({zIndex:Opentip.lastZIndex+=1}),this.setupObserversForReallyVisibleTip(),this.setupObserversForVisibleTip(),Opentip.useScriptaculousTransitions&&((this.options.showEffect||this.options.hideEffect)&&this.cancelEffects(),!this.options.showEffect||!this.container[this.options.showEffect]?this.container.show():this.container[this.options.showEffect]({duration:this.options.showEffectDuration,queue:this.queue,afterFinish:this.afterShowEffect.bind(this)}),Opentip.useIFrame()&&this.iFrameElement.show()),this.position(),this.container.removeClassName("ot-hidden").addClassName("ot-becoming-visible");var a=function(){Opentip.useCss3Transitions&&this.container.setCss3Style({transitionDuration:this.options.showEffectDuration+"s"}),this.container.removeClassName("ot-becoming-visible").addClassName("ot-visible"),this.options.showEffect&&this.options.showEffectDuration?this.visibilityStateTimeoutId=function(){this.removeClassName("ot-visible").addClassName("ot-completely-visible")}.bind(this.container).delay(this.options.showEffectDuration):this.container.removeClassName("ot-visible").addClassName("ot-completely-visible"),this.activateFirstInput()};((function(){this.container.removeClassName("ot-completely-hidden"),a.bind(this).defer()})).bind(this).defer()},loadAjax:function(){if(this.loading)return;this.loading=!0,this.container.addClassName("ot-loading"),this.debug("Loading content from "+this.options.ajax.url+"."),new Ajax.Request(this.options.ajax.url,Object.extend({onComplete:function(){this.container.removeClassName("ot-loading"),this.loaded=!0,this.loading=!1,this.updateElementContent(),this.searchAndActivateHideButtons(),this.activateFirstInput(),this.position()}.bind(this),onSuccess:function(a){this.debug("Loading successfull."),this.content=a.responseText}.bind(this),onFailure:function(){this.debug("There was a problem downloading the file."),this.options.escapeHtml=!1,this.content='<a class="close">There was a problem downloading the content.</a>'}.bind(this)},this.options.ajax.options||{}))},afterShowEffect:function(){this.activateFirstInput(),this.position()},activateFirstInput:function(){var a=this.container.down("input"),b=this.container.down("textarea");a?a.focus():b&&b.focus()},searchAndActivateHideButtons:function(){if(!this.options.hideTrigger||this.options.hideTrigger.include("closeButton"))this.options.hideTriggerElements=[],this.container.select(".close").each(function(a){this.options.hideTriggerElements.push({element:a,event:"click"})},this),this.visible&&this.setupObserversForVisibleTip()},hide:function(a){this.abortShowing();if(!this.visible)return;this.debug("Hiding in "+this.options.hideDelay+"s."),this.waitingToHide=!0,this.setupObserversForHiddenTip(),this.hideTimeoutId=this.bound.doHide.delay(this.options.hideDelay,a)},abortHiding:function(){this.waitingToHide&&(this.debug("Aborting hiding."),this.clearTimeouts(),this.waitingToHide=!1,this.setupObserversForVisibleTip())},doHide:function(a){this.clearTimeouts();if(!this.visible)return;this.debug("Hiding!"),this.visible=!1,this.waitingToHide=!1,this.deactivateElementEnsurance(),this.setupObserversForReallyHiddenTip(),this.setupObserversForHiddenTip(),this.options.fixed||this.stopFollowingMousePosition();if(Opentip.useScriptaculousTransitions){(this.options.showEffect||this.options.hideEffect)&&this.cancelEffects();if(!this.options.hideEffect||!this.container[this.options.hideEffect])this.container.hide();else{var b={duration:this.options.hideEffectDuration,queue:this.queue};a&&Object.isFunction(a)&&(b.afterFinish=a),this.container[this.options.hideEffect](b)}Opentip.useIFrame()&&this.iFrameElement.hide()}Opentip.useCss3Transitions&&this.container.setCss3Style({transitionDuration:this.options.hideEffectDuration+"s"}),this.container.removeClassName("ot-visible").removeClassName("ot-completely-visible").addClassName("ot-hidden"),this.options.hideEffect&&this.options.hideEffectDuration?this.visibilityStateTimeoutId=function(){this.setCss3Style({transitionDuration:"0s"}),this.removeClassName("ot-hidden").addClassName("ot-completely-hidden")}.bind(this.container).delay(this.options.showEffectDuration):this.container.removeClassName("ot-hidden").addClassName("ot-completely-hidden")},cancelEffects:function(){Effect.Queues.get(this.queue.scope).invoke("cancel")},followMousePosition:function(){this.options.fixed||$(document.body).observe("mousemove",this.bound.position)},stopFollowingMousePosition:function(){this.options.fixed||$(document.body).stopObserving("mousemove",this.bound.position)},positionsEqual:function(a,b){return a.left==b.left&&a.top==b.top},position:function(a){var a=a||this.lastEvt;this.currentStemPosition=this.options.stem;var b=this.ensureViewportContainment(a,this.getPosition(a));if(this.positionsEqual(b,this.lastPosition)){this.positionStem();return}this.lastPosition=b;if(b){var c={left:b.left+"px",top:b.top+"px"};this.container.setStyle(c),Opentip.useIFrame()&&this.iFrameElement&&this.iFrameElement.setStyle({width:this.container.getWidth()+"px",height:this.container.getHeight()+"px"});var d=this.container;((function(){d.style.visibility="hidden";var a=d.offsetHeight;d.style.visibility="visible"})).defer()}this.positionStem()},getPosition:function(a,b,c,d){var b=b||this.options.tipJoint,c=c||this.options.targetJoint,e={};if(this.options.target){var f=this.options.target.cumulativeOffset();e.left=f[0],e.top=f[1],c[0]=="right"?typeof this.options.target.getBoundingClientRect!="undefined"?e.left=this.options.target.getBoundingClientRect().right+$(document.viewport).getScrollOffsets().left:e.left=e.left+this.options.target.getWidth():c[0]=="center"&&(e.left+=Math.round(this.options.target.getWidth()/2)),c[1]=="bottom"?e.top+=this.options.target.getHeight():c[1]=="middle"&&(e.top+=Math.round(this.options.target.getHeight()/2))}else{if(!a)return;this.lastEvt=a,e.left=Event.pointerX(a),e.top=Event.pointerY(a)}if(this.options.autoOffset){var g=this.options.stem?this.options.stemSize:0,h=g&&this.options.fixed?2:10,i=b[1]=="middle"&&!this.options.fixed?15:0,j=b[0]=="center"&&!this.options.fixed?15:0;b[0]=="right"?e.left-=h+i:b[0]=="left"&&(e.left+=h+i),b[1]=="bottom"?e.top-=h+j:b[1]=="top"&&(e.top+=h+j);if(g){var d=d||this.options.stem;d[0]=="right"?e.left-=g:d[0]=="left"&&(e.left+=g),d[1]=="bottom"?e.top-=g:d[1]=="top"&&(e.top+=g)}}return e.left+=this.options.offset[0],e.top+=this.options.offset[1],b[0]=="right"&&(e.left-=this.container.getWidth()),b[0]=="center"&&(e.left-=Math.round(this.container.getWidth()/2)),b[1]=="bottom"&&(e.top-=this.container.getHeight()),b[1]=="middle"&&(e.top-=Math.round(this.container.getHeight()/2)),e},ensureViewportContainment:function(a,b){if(!this.visible)return b;var c=[this.sticksOutX(b),this.sticksOutY(b)];if(!c[0]&&!c[1])return b;var d=this.options.tipJoint.clone(),e=this.options.targetJoint.clone(),f=$(document.viewport).getScrollOffsets(),g=this.dimensions,h={left:b.left-f.left,top:b.top-f.top},i=document.viewport.getDimensions(),j=!1;i.width>=g.width&&(h.left<0?(j=!0,d[0]="left",this.options.target&&e[0]=="left"&&(e[0]="right")):h.left+g.width>i.width&&(j=!0,d[0]="right",this.options.target&&e[0]=="right"&&(e[0]="left"))),i.height>=g.height&&(h.top<0?(j=!0,d[1]="top",this.options.target&&e[1]=="top"&&(e[1]="bottom")):h.top+g.height>i.height&&(j=!0,d[1]="bottom",this.options.target&&e[1]=="bottom"&&(e[1]="top")));if(j){var k=this.getPosition(a,d,e,d),l=[this.sticksOutX(k),this.sticksOutY(k)],m=0;for(var n=0;n<=1;n++)l[n]&&l[n]!=c[n]&&(m++,d[n]=this.options.tipJoint[n],this.options.target&&(e[n]=this.options.targetJoint[n]));if(m<2)return this.currentStemPosition=d,this.getPosition(a,d,e,d)}return b},sticksOut:function(a){return this.sticksOutX(a)||this.sticksOutY(a)},sticksOutX:function(a){var b=$(document.viewport).getScrollOffsets(),c={left:a.left-b.left,top:a.top-b.top};if(c.left<0)return Opentip.STICKS_OUT_LEFT;if(c.left+this.dimensions.width>document.viewport.getDimensions().width)return Opentip.STICKS_OUT_RIGHT},sticksOutY:function(a){var b=$(document.viewport).getScrollOffsets(),c={left:a.left-b.left,top:a.top-b.top};if(c.top<0)return Opentip.STICKS_OUT_TOP;if(c.top+this.dimensions.height>document.viewport.getDimensions().height)return Opentip.STICKS_OUT_BOTTOM},getStemCanvas:function(){return this.container.down(".stem")},stemPositionsEqual:function(a,b){return a&&b&&a[0]==b[0]&&a[1]==b[1]},positionStem:function(){if(this.options.stem){var a=this.getStemCanvas();if(a&&!this.stemPositionsEqual(this.lastStemPosition,this.currentStemPosition)){this.debug("Setting stem style"),this.lastStemPosition=this.currentStemPosition;var b=Opentip.sanitizePosition(this.currentStemPosition),c=this.options.stemSize,d=b*Math.PI/4,e=Math.round(c*1.5),f={w:e,h:c},g=!1;if(b%2==1){g=!0;var h=Math.round(.707106781*e);f={w:c+h,h:c+h}}var i=Object.clone(f);if(b==Opentip.position.left||b==Opentip.position.right)f.h=i.w,f.w=i.h;var j=a.getStyle("color")||"black";a.width=f.w,a.height=f.h;var k=a.getContext("2d");k.clearRect(0,0,a.width,a.height),k.beginPath(),k.fillStyle=j,k.save(),k.translate(f.w/2,f.h/2);var l=Math.floor(b/2);k.rotate(l*Math.PI/2),f.w==i.w?k.translate(-f.w/2,-f.h/2):k.translate(-f.h/2,-f.w/2),g?(k.moveTo(h,i.h),k.lineTo(i.w,0),k.lineTo(0,i.h-h)):(k.moveTo(i.w/2-e/2,i.h),k.lineTo(i.w/2,0),k.lineTo(i.w/2+e/2,i.h)),k.fill(),k.restore();var m={width:f.w+"px",height:f.h+"px",left:"",right:"",top:"",bottom:""};switch(b){case Opentip.position.top:m.top=-f.h+"px",m.left=-Math.round(f.w/2)+"px";break;case Opentip.position.right:m.top=-Math.round(f.h/2)+"px",m.left=0;break;case Opentip.position.bottom:m.top=0,m.left=-Math.round(f.w/2)+"px";break;case Opentip.position.left:m.top=-Math.round(f.h/2)+"px",m.left=-f.w+"px";break;case Opentip.position.topRight:m.top=-c+"px",m.left=-h+"px";break;case Opentip.position.bottomRight:m.top=-h+"px",m.left=-h+"px";break;case Opentip.position.bottomLeft:m.top=-h+"px",m.left=-c+"px";break;case Opentip.position.topLeft:m.top=-c+"px",m.left=-c+"px";break;default:throw"Unknown stem position: "+b}a.setStyle(m);var n=a.up(".stem-container");n.removeClassName("left").removeClassName("right").removeClassName("center").removeClassName("top").removeClassName("bottom").removeClassName("middle");switch(b){case Opentip.position.top:case Opentip.position.topLeft:case Opentip.position.topRight:n.addClassName("top");break;case Opentip.position.bottom:case Opentip.position.bottomLeft:case Opentip.position.bottomRight:n.addClassName("bottom");break;default:n.addClassName("middle")}switch(b){case Opentip.position.left:case Opentip.position.topLeft:case Opentip.position.bottomLeft:n.addClassName("left");break;case Opentip.position.right:case Opentip.position.topRight:case Opentip.position.bottomRight:n.addClassName("right");break;default:n.addClassName("center")}}}},triggerElementExists:function(a){return this.triggerElement.parentNode&&this.triggerElement.visible()&&this.triggerElement.descendantOf(document.body)},ensureElementInterval:1e3,ensureElement:function(){this.deactivateElementEnsurance(),this.triggerElementExists()||this.deactivate(),this.ensureElementTimeoutId=setTimeout(this.ensureElement.bind(this),this.ensureElementInterval)},deactivateElementEnsurance:function(){clearTimeout(this.ensureElementTimeoutId)}});
View
8 test/index.html
@@ -448,10 +448,10 @@
<br />
<div class="test">
<div data-ot="Hi this is a very simple tooltip.">Just defining ot.</div>
- <div data-ot="Hi" ot-delay="0.99" ot-style="glass">Delay 0.99, style glass.</div>
- <a href="ajaxtest.html" data-ot="true" ot-show-on="click" ot-ajax="true" ot-stem="true" ot-tip-joint="[ 'center', 'bottom' ]">Testing AJAX. tip joint: center/bottom</a>
- <div data-ot="Hi" ot-show-effect="condense" ot-hide-effect="puff">Testing the inline HTML options.</div>
- <div data-ot="Hi" ot-show-effect-duration="1" ot-hide-effect-duration="1" ot-show-effect="rotate" ot-hide-effect="rotate" ot-fallback-show-effect="appear" ot-fallback-hide-effect="fade">Testing fallback effects. Should appear/fade with CSS3 disabled.</div>
+ <div data-ot="Hi" data-ot-delay="0.99" data-ot-style="glass">Delay 0.99, style glass.</div>
+ <a href="ajaxtest.html" data-ot="true" data-ot-show-on="click" data-ot-ajax="true" data-ot-stem="true" data-ot-tip-joint="[ 'center', 'bottom' ]">Testing AJAX. tip joint: center/bottom</a>
+ <div data-ot="Hi" data-ot-show-effect="condense" data-ot-hide-effect="puff">Testing the inline HTML options.</div>
+ <div data-ot="Hi" data-ot-show-effect-duration="1" data-ot-hide-effect-duration="1" data-ot-show-effect="rotate" data-ot-hide-effect="rotate" data-ot-fallback-show-effect="appear" data-ot-fallback-hide-effect="fade">Testing fallback effects. Should appear/fade with CSS3 disabled.</div>
</div>

No commit comments for this range

Something went wrong with that request. Please try again.