From b2601b1437e6c9708caeac4ee91dbb532ea16514 Mon Sep 17 00:00:00 2001 From: Gordon Koo Date: Tue, 21 Aug 2012 15:01:55 -0700 Subject: [PATCH] gah. need to hide bubble if not starting tour right awy --- js/hopscotch-min.js | 2 +- js/hopscotch.js | 1 + js/hopscotch_jquery-min.js | 2 +- js/hopscotch_jquery.js | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/js/hopscotch-min.js b/js/hopscotch-min.js index 10ef754c..21659847 100644 --- a/js/hopscotch-min.js +++ b/js/hopscotch-min.js @@ -1 +1 @@ -(function(){var k,d,i,h,f,a,g="undefined",b=false,j=(typeof window.sessionStorage!==g),e=document.body.style,c=(typeof e.MozTransition!==g||typeof e.MsTransition!==g||typeof e.webkitTransition!==g||typeof e.OTransition!==g||typeof e.transition!==g);if(window.hopscotch){return}a=function(){docLoaded=true;if(b){window.hopscotch.startTour()}};if(window.addEventListener){window.addEventListener("load",a)}else{if(window.attachEvent){window.attachEvent("onload",a)}}h={addClass:function(n,p){var m,o,l;if(n.className.length===0){n.className=p}else{m=n.className.split(" ");for(o=0,l=m.length;o=0){h.addClass(r,"prev")}else{h.addClass(r,"next")}return r},n=function(s,r,u){var t="hide";if(u){t="hide-all"}if(typeof r===g){r=true}if(r){h.removeClass(s,t)}else{h.addClass(s,t)}},o=function(y,u,F){var B,r,z,t,w,x,A,v,E=h.getStepTarget(u),s=y.element,D=y.arrowEl,C=h.getPixelValue(u.arrowOffset);F=h.valOrDefault(F,true);B=h.getPixelValue(u.width)||q.bubbleWidth;z=h.valOrDefault(u.padding,q.bubblePadding);bubbleBorder=h.valOrDefault(u.padding,q.bubbleBorder);h.removeClass(s,"bounce-down bounce-up bounce-left bounce-right");t=E.getBoundingClientRect();if(u.orientation==="top"){r=s.offsetHeight;A=(t.top-r)-q.arrowWidth;v=t.left;x="bounce-down"}else{if(u.orientation==="bottom"){A=t.bottom+q.arrowWidth;v=t.left;x="bounce-up"}else{if(u.orientation==="left"){A=t.top;v=t.left-B-2*z-2*bubbleBorder-q.arrowWidth;x="bounce-right"}else{if(u.orientation==="right"){A=t.top;v=t.right+q.arrowWidth;x="bounce-left"}}}}if(!C){D.style.top="";D.style.left=""}else{if(u.orientation==="top"||u.orientation==="bottom"){D.style.left=C+"px"}else{if(u.orientation==="left"||u.orientation==="right"){D.style.top=C+"px"}}}v+=h.getPixelValue(u.xOffset);A+=h.getPixelValue(u.yOffset);A+=h.getScrollTop();v+=h.getScrollLeft();if(q.animate){s.style.top=A+"px";s.style.left=v+"px"}else{s.style.top=A+"px";s.style.left=v+"px";if(F){w=q.smoothScroll?q.scrollDuration:0;setTimeout(function(){h.addClass(s,x)},w);setTimeout(function(){h.removeClass(s,x)},w+2000)}}};this.init=function(){var u=document.createElement("div"),v=document.createElement("div"),t=document.createElement("div"),s=this,w=false,r;this.element=u;this.containerEl=v;this.titleEl=document.createElement("h3");this.numberEl=document.createElement("span");this.contentEl=document.createElement("p");u.setAttribute("id","hopscotch-bubble");h.addClass(u,"animated");v.setAttribute("id","hopscotch-bubble-container");this.numberEl.setAttribute("id","hopscotch-bubble-number");v.appendChild(this.numberEl);t.appendChild(this.titleEl);t.appendChild(this.contentEl);t.setAttribute("id","hopscotch-bubble-content");v.appendChild(t);u.appendChild(v);this.initNavButtons();if(q&&q.showCloseButton){this.initCloseButton()}this.initArrow();window.onresize=function(){if(w||!m){return}w=true;r=setTimeout(function(){o(s,l,false);w=false},200)};document.body.appendChild(u);return this};this.initNavButtons=function(){var r=document.createElement("div");this.prevBtnEl=p("hopscotch-prev",i.prevBtn);this.nextBtnEl=p("hopscotch-next",i.nextBtn);this.doneBtnEl=p("hopscotch-done",i.doneBtn);h.addClass(this.doneBtnEl,"hide");r.appendChild(this.prevBtnEl);r.appendChild(this.nextBtnEl);r.appendChild(this.doneBtnEl);h.addClickListener(this.prevBtnEl,function(s){window.hopscotch.prevStep()});h.addClickListener(this.nextBtnEl,function(s){window.hopscotch.nextStep()});h.addClickListener(this.doneBtnEl,window.hopscotch.endTour);r.setAttribute("id","hopscotch-actions");this.buttonsEl=r;this.containerEl.appendChild(r);return this};this.initCloseButton=function(){var r=document.createElement("a");r.setAttribute("id","hopscotch-bubble-close");r.setAttribute("href","#");r.setAttribute("title",i.closeTooltip);r.innerHTML="x";h.addClickListener(r,function(t){var s=hopscotch.getCurrStepNum(),u=hopscotch.getCurrTour(),v=(s===u.steps.length-1);h.invokeCallbacks("close",[u.id,s]);window.hopscotch.endTour(true,v);if(t.preventDefault){t.preventDefault()}else{if(event){event.returnValue=false}}});this.closeBtnEl=r;this.containerEl.appendChild(r);return this};this.initArrow=function(){var r,s;this.arrowEl=document.createElement("div");this.arrowEl.setAttribute("id","hopscotch-bubble-arrow-container");s=document.createElement("div");s.className="hopscotch-bubble-arrow-border";r=document.createElement("div");r.className="hopscotch-bubble-arrow";this.arrowEl.appendChild(s);this.arrowEl.appendChild(r);this.element.appendChild(this.arrowEl);return this};this.renderStep=function(t,y,u,v,z){var A=this,s=h.valOrDefault(t.showNextButton,q.showNextButton),r=h.valOrDefault(t.showPrevButton,q.showPrevButton),x,w;l=t;this.setTitle(t.title?t.title:"");this.setContent(t.content?t.content:"");this.setNum(y);this.showPrevButton(this.prevBtnEl&&r&&(y>0||u>0));this.showNextButton(this.nextBtnEl&&s&&!v);this.nextBtnEl.setAttribute("value",t.showSkip?i.skipBtn:i.nextBtn);if(t.showSkip){}if(v){h.removeClass(this.doneBtnEl,"hide")}else{h.addClass(this.doneBtnEl,"hide")}this.setArrow(t.orientation);x=h.getPixelValue(t.width)||q.bubbleWidth;w=h.valOrDefault(t.padding,q.bubblePadding);this.containerEl.style.width=x+"px";this.containerEl.style.padding=w+"px";if(t.orientation==="top"){setTimeout(function(){o(A,t);if(z){z()}},5)}else{o(this,t);if(z){z()}}return this};this.setTitle=function(r){if(r){this.titleEl.innerHTML=r;h.removeClass(this.titleEl,"hide")}else{h.addClass(this.titleEl,"hide")}return this};this.setContent=function(r){if(r){this.contentEl.innerHTML=r;h.removeClass(this.contentEl,"hide")}else{h.addClass(this.contentEl,"hide")}return this};this.setNum=function(r){if(i.stepNums&&r0)?B[x]:B},y=function(){var B=s.steps[n].length;if(x0){--x;return true}else{if(n>0){B=s.steps[--n].length;if(B){x=B-1}else{x=undefined}return true}}return false},l=function(){return s.steps[n].length>0},u=function(){var R=q().element,N=h.getPixelValue(R.style.top),M=N+h.getPixelValue(R.offsetHeight),K=h.getStepTarget(z()),S=K.getBoundingClientRect(),P=S.top+h.getScrollTop(),L=S.bottom+h.getScrollTop(),I=(NL)?M:L,O=h.getScrollTop(),D=O+h.getWindowHeight(),E=I-o.scrollTopMargin,C,H,G,Q,F,J;if(typeof YAHOO!==g&&typeof YAHOO.env!==g&&typeof YAHOO.env.ua!==g&&typeof YAHOO.util!==g&&typeof YAHOO.util.Scroll!==g){C=YAHOO.env.ua.webkit?document.body:document.documentElement;G=YAHOO.util.Easing?YAHOO.util.Easing.easeOut:undefined;H=new YAHOO.util.Scroll(C,{scroll:{to:[0,E]}},o.scrollDuration/1000,G);H.animate();return}if(E<0){E=0}if(I>=O&&I<=O+o.scrollTopMargin){return}if(ID){if(o.smoothScroll){Q=(O>I)?-1:1;F=Math.abs(O-E)/(o.scrollDuration/10);J=setInterval(function(){var U=h.getScrollTop(),T=U+(Q*F);if((Q>0&&T>=E)||Q<0&&T<=E){T=E;clearInterval(J)}window.scrollTo(0,T);if(h.getScrollTop()===U){clearInterval(J)}},10)}else{window.scrollTo(0,E)}}};this.init=function(){if(m){this.configure(m)}return this};this.loadTour=function(G){var E={},C,H,D,B,F;s=G;for(H in G){if(G.hasOwnProperty(H)&&H!=="id"&&H!=="steps"){E[H]=G[H]}}o={};p.call(this,E,true);B=h.getState(o.cookieName);if(B){F=B.split(":");A=F[0];r=F[1];t=undefined;D=r.split("-");if(D.length>1){r=parseInt(D[0],10);t=parseInt(D[1],10)}else{r=parseInt(r,10)}if(F.length>2&&F[2]==="mp"){if(t&&t0){t=0}else{t=undefined}}}}}C=q();C.showPrevButton(o.showPrevButton,true);C.showNextButton(o.showNextButton,true);return this};this.startTour=function(E,D){var B,C;if(!s){throw"Need to load a tour before you start it!"}if(document.readyState!=="complete"){b=true;return}if(typeof E!==g){n=E;x=D}else{if(s.id===A&&typeof r!==g){n=r;x=t;C=z();if(!h.getStepTarget(C)){v();C=z();if(!h.getStepTarget(C)){this.endTour(false);return}}}else{n=0}}if(!x&&l()){x=0}if(n===0&&!x){h.invokeCallbacks("start",[s.id])}this.showStep(n,x);B=q().show();if(o.animate){B.initAnimate()}this.isActive=true;return this};this.showStep=function(F,D){var I=s.steps,G=I[F],E=I.length,C=s.id+":"+F,B=q(),H;n=F;x=D;if(typeof D!==g&&l()){G=G[D];C+="-"+D}H=(F===E-1)||(D>=G.length-1);B.renderStep(G,F,D,H,u);if(G.multiPage){C+=":mp"}h.setState(o.cookieName,C,1);return this};this.prevStep=function(){var C=z(),B=false;h.invokeCallbacks("prev",[s.id,n]);if(C.onPrev){C.onPrev()}if(o.skipIfNoElement){while(!B&&v()){C=z();B=h.getStepTarget(C)}if(!B){this.endTour()}}else{if(v()){C=z();if(!h.getStepTarget(C)){h.invokeCallbacks("error",[s.id,n]);return}}}this.showStep(n,x);return this};this.nextStep=function(){var C=z(),B=false;h.invokeCallbacks("next",[s.id,n]);if(C.onNext){C.onNext()}if(o.skipIfNoElement){while(!B&&y()){C=z();B=h.getStepTarget(C)}if(!B){this.endTour()}}else{if(y()){C=z();if(!h.getStepTarget(C)){h.invokeCallbacks("error",[s.id,n]);this.endTour();return}}}this.showStep(n,x);return this};this.endTour=function(D,C){var B=q();D=h.valOrDefault(D,true);C=h.valOrDefault(C,true);n=0;x=undefined;r=undefined;B.hide();if(D){h.clearState(o.cookieName)}this.isActive=false;if(C){h.invokeCallbacks("end",[s.id])}hopscotch.removeCallbacks(true);return this};this.getCurrTour=function(){return s};this.getCurrStepNum=function(){return n};this.getCurrSubstepNum=function(){return x};this.addCallback=function(D,B,C){if(B){f[D].push({cb:B,fromTour:C})}return this};this.removeCallbacks=function(C){var F,D,B,E;for(E in f){if(C){F=f[E];for(D=0,B=F.length;D=0){h.addClass(r,"prev")}else{h.addClass(r,"next")}return r},n=function(s,r,u){var t="hide";if(u){t="hide-all"}if(typeof r===g){r=true}if(r){h.removeClass(s,t)}else{h.addClass(s,t)}},o=function(y,u,F){var B,r,z,t,w,x,A,v,E=h.getStepTarget(u),s=y.element,D=y.arrowEl,C=h.getPixelValue(u.arrowOffset);F=h.valOrDefault(F,true);B=h.getPixelValue(u.width)||q.bubbleWidth;z=h.valOrDefault(u.padding,q.bubblePadding);bubbleBorder=h.valOrDefault(u.padding,q.bubbleBorder);h.removeClass(s,"bounce-down bounce-up bounce-left bounce-right");t=E.getBoundingClientRect();if(u.orientation==="top"){r=s.offsetHeight;A=(t.top-r)-q.arrowWidth;v=t.left;x="bounce-down"}else{if(u.orientation==="bottom"){A=t.bottom+q.arrowWidth;v=t.left;x="bounce-up"}else{if(u.orientation==="left"){A=t.top;v=t.left-B-2*z-2*bubbleBorder-q.arrowWidth;x="bounce-right"}else{if(u.orientation==="right"){A=t.top;v=t.right+q.arrowWidth;x="bounce-left"}}}}if(!C){D.style.top="";D.style.left=""}else{if(u.orientation==="top"||u.orientation==="bottom"){D.style.left=C+"px"}else{if(u.orientation==="left"||u.orientation==="right"){D.style.top=C+"px"}}}v+=h.getPixelValue(u.xOffset);A+=h.getPixelValue(u.yOffset);A+=h.getScrollTop();v+=h.getScrollLeft();if(q.animate){s.style.top=A+"px";s.style.left=v+"px"}else{s.style.top=A+"px";s.style.left=v+"px";if(F){w=q.smoothScroll?q.scrollDuration:0;setTimeout(function(){h.addClass(s,x)},w);setTimeout(function(){h.removeClass(s,x)},w+2000)}}};this.init=function(){var u=document.createElement("div"),v=document.createElement("div"),t=document.createElement("div"),s=this,w=false,r;this.element=u;this.containerEl=v;this.titleEl=document.createElement("h3");this.numberEl=document.createElement("span");this.contentEl=document.createElement("p");u.setAttribute("id","hopscotch-bubble");h.addClass(u,"animated");v.setAttribute("id","hopscotch-bubble-container");this.numberEl.setAttribute("id","hopscotch-bubble-number");v.appendChild(this.numberEl);t.appendChild(this.titleEl);t.appendChild(this.contentEl);t.setAttribute("id","hopscotch-bubble-content");v.appendChild(t);u.appendChild(v);this.initNavButtons();if(q&&q.showCloseButton){this.initCloseButton()}this.initArrow();window.onresize=function(){if(w||!m){return}w=true;r=setTimeout(function(){o(s,l,false);w=false},200)};this.hide();document.body.appendChild(u);return this};this.initNavButtons=function(){var r=document.createElement("div");this.prevBtnEl=p("hopscotch-prev",i.prevBtn);this.nextBtnEl=p("hopscotch-next",i.nextBtn);this.doneBtnEl=p("hopscotch-done",i.doneBtn);h.addClass(this.doneBtnEl,"hide");r.appendChild(this.prevBtnEl);r.appendChild(this.nextBtnEl);r.appendChild(this.doneBtnEl);h.addClickListener(this.prevBtnEl,function(s){window.hopscotch.prevStep()});h.addClickListener(this.nextBtnEl,function(s){window.hopscotch.nextStep()});h.addClickListener(this.doneBtnEl,window.hopscotch.endTour);r.setAttribute("id","hopscotch-actions");this.buttonsEl=r;this.containerEl.appendChild(r);return this};this.initCloseButton=function(){var r=document.createElement("a");r.setAttribute("id","hopscotch-bubble-close");r.setAttribute("href","#");r.setAttribute("title",i.closeTooltip);r.innerHTML="x";h.addClickListener(r,function(t){var s=hopscotch.getCurrStepNum(),u=hopscotch.getCurrTour(),v=(s===u.steps.length-1);h.invokeCallbacks("close",[u.id,s]);window.hopscotch.endTour(true,v);if(t.preventDefault){t.preventDefault()}else{if(event){event.returnValue=false}}});this.closeBtnEl=r;this.containerEl.appendChild(r);return this};this.initArrow=function(){var r,s;this.arrowEl=document.createElement("div");this.arrowEl.setAttribute("id","hopscotch-bubble-arrow-container");s=document.createElement("div");s.className="hopscotch-bubble-arrow-border";r=document.createElement("div");r.className="hopscotch-bubble-arrow";this.arrowEl.appendChild(s);this.arrowEl.appendChild(r);this.element.appendChild(this.arrowEl);return this};this.renderStep=function(t,y,u,v,z){var A=this,s=h.valOrDefault(t.showNextButton,q.showNextButton),r=h.valOrDefault(t.showPrevButton,q.showPrevButton),x,w;l=t;this.setTitle(t.title?t.title:"");this.setContent(t.content?t.content:"");this.setNum(y);this.showPrevButton(this.prevBtnEl&&r&&(y>0||u>0));this.showNextButton(this.nextBtnEl&&s&&!v);this.nextBtnEl.setAttribute("value",t.showSkip?i.skipBtn:i.nextBtn);if(t.showSkip){}if(v){h.removeClass(this.doneBtnEl,"hide")}else{h.addClass(this.doneBtnEl,"hide")}this.setArrow(t.orientation);x=h.getPixelValue(t.width)||q.bubbleWidth;w=h.valOrDefault(t.padding,q.bubblePadding);this.containerEl.style.width=x+"px";this.containerEl.style.padding=w+"px";if(t.orientation==="top"){setTimeout(function(){o(A,t);if(z){z()}},5)}else{o(this,t);if(z){z()}}return this};this.setTitle=function(r){if(r){this.titleEl.innerHTML=r;h.removeClass(this.titleEl,"hide")}else{h.addClass(this.titleEl,"hide")}return this};this.setContent=function(r){if(r){this.contentEl.innerHTML=r;h.removeClass(this.contentEl,"hide")}else{h.addClass(this.contentEl,"hide")}return this};this.setNum=function(r){if(i.stepNums&&r0)?B[x]:B},y=function(){var B=s.steps[n].length;if(x0){--x;return true}else{if(n>0){B=s.steps[--n].length;if(B){x=B-1}else{x=undefined}return true}}return false},l=function(){return s.steps[n].length>0},u=function(){var R=q().element,N=h.getPixelValue(R.style.top),M=N+h.getPixelValue(R.offsetHeight),K=h.getStepTarget(z()),S=K.getBoundingClientRect(),P=S.top+h.getScrollTop(),L=S.bottom+h.getScrollTop(),I=(NL)?M:L,O=h.getScrollTop(),D=O+h.getWindowHeight(),E=I-o.scrollTopMargin,C,H,G,Q,F,J;if(typeof YAHOO!==g&&typeof YAHOO.env!==g&&typeof YAHOO.env.ua!==g&&typeof YAHOO.util!==g&&typeof YAHOO.util.Scroll!==g){C=YAHOO.env.ua.webkit?document.body:document.documentElement;G=YAHOO.util.Easing?YAHOO.util.Easing.easeOut:undefined;H=new YAHOO.util.Scroll(C,{scroll:{to:[0,E]}},o.scrollDuration/1000,G);H.animate();return}if(E<0){E=0}if(I>=O&&I<=O+o.scrollTopMargin){return}if(ID){if(o.smoothScroll){Q=(O>I)?-1:1;F=Math.abs(O-E)/(o.scrollDuration/10);J=setInterval(function(){var U=h.getScrollTop(),T=U+(Q*F);if((Q>0&&T>=E)||Q<0&&T<=E){T=E;clearInterval(J)}window.scrollTo(0,T);if(h.getScrollTop()===U){clearInterval(J)}},10)}else{window.scrollTo(0,E)}}};this.init=function(){if(m){this.configure(m)}return this};this.loadTour=function(G){var E={},C,H,D,B,F;s=G;for(H in G){if(G.hasOwnProperty(H)&&H!=="id"&&H!=="steps"){E[H]=G[H]}}o={};p.call(this,E,true);B=h.getState(o.cookieName);if(B){F=B.split(":");A=F[0];r=F[1];t=undefined;D=r.split("-");if(D.length>1){r=parseInt(D[0],10);t=parseInt(D[1],10)}else{r=parseInt(r,10)}if(F.length>2&&F[2]==="mp"){if(t&&t0){t=0}else{t=undefined}}}}}C=q();C.showPrevButton(o.showPrevButton,true);C.showNextButton(o.showNextButton,true);return this};this.startTour=function(E,D){var B,C;if(!s){throw"Need to load a tour before you start it!"}if(document.readyState!=="complete"){b=true;return}if(typeof E!==g){n=E;x=D}else{if(s.id===A&&typeof r!==g){n=r;x=t;C=z();if(!h.getStepTarget(C)){v();C=z();if(!h.getStepTarget(C)){this.endTour(false);return}}}else{n=0}}if(!x&&l()){x=0}if(n===0&&!x){h.invokeCallbacks("start",[s.id])}this.showStep(n,x);B=q().show();if(o.animate){B.initAnimate()}this.isActive=true;return this};this.showStep=function(F,D){var I=s.steps,G=I[F],E=I.length,C=s.id+":"+F,B=q(),H;n=F;x=D;if(typeof D!==g&&l()){G=G[D];C+="-"+D}H=(F===E-1)||(D>=G.length-1);B.renderStep(G,F,D,H,u);if(G.multiPage){C+=":mp"}h.setState(o.cookieName,C,1);return this};this.prevStep=function(){var C=z(),B=false;h.invokeCallbacks("prev",[s.id,n]);if(C.onPrev){C.onPrev()}if(o.skipIfNoElement){while(!B&&v()){C=z();B=h.getStepTarget(C)}if(!B){this.endTour()}}else{if(v()){C=z();if(!h.getStepTarget(C)){h.invokeCallbacks("error",[s.id,n]);return}}}this.showStep(n,x);return this};this.nextStep=function(){var C=z(),B=false;h.invokeCallbacks("next",[s.id,n]);if(C.onNext){C.onNext()}if(o.skipIfNoElement){while(!B&&y()){C=z();B=h.getStepTarget(C)}if(!B){this.endTour()}}else{if(y()){C=z();if(!h.getStepTarget(C)){h.invokeCallbacks("error",[s.id,n]);this.endTour();return}}}this.showStep(n,x);return this};this.endTour=function(D,C){var B=q();D=h.valOrDefault(D,true);C=h.valOrDefault(C,true);n=0;x=undefined;r=undefined;B.hide();if(D){h.clearState(o.cookieName)}this.isActive=false;if(C){h.invokeCallbacks("end",[s.id])}hopscotch.removeCallbacks(true);return this};this.getCurrTour=function(){return s};this.getCurrStepNum=function(){return n};this.getCurrSubstepNum=function(){return x};this.addCallback=function(D,B,C){if(B){f[D].push({cb:B,fromTour:C})}return this};this.removeCallbacks=function(C){var F,D,B,E;for(E in f){if(C){F=f[E];for(D=0,B=F.length;D");q.attr({id:s,type:"button",value:r});q.addClass("hopscotch-nav-button");if(s.indexOf("prev")>=0){q.addClass("prev")}else{q.addClass("next")}return q},m=function(r,q,t){var s=t?"hide-all":"hide";if(typeof q===f){q=true}if(q){r.removeClass(s)}else{r.addClass(s)}},n=function(x,s,E){var A,q,y,r,v,w,z,t,C=g.getStepTarget(s)[0],D=x.$element,u=x.$arrowEl,B=g.getPixelValue(s.arrowOffset);E=g.valOrDefault(E,true);A=g.getPixelValue(s.width)||p.bubbleWidth;y=g.valOrDefault(s.padding,p.bubblePadding);bubbleBorder=g.valOrDefault(s.padding,p.bubbleBorder);D.removeClass("bounce-down bounce-up bounce-left bounce-right");r=C.getBoundingClientRect();if(s.orientation==="top"){q=D.height();z=(r.top-q)-p.arrowWidth;t=r.left;w="bounce-down"}else{if(s.orientation==="bottom"){z=r.bottom+p.arrowWidth;t=r.left;w="bounce-up"}else{if(s.orientation==="left"){z=r.top;t=r.left-A-2*y-2*bubbleBorder-p.arrowWidth;w="bounce-right"}else{if(s.orientation==="right"){z=r.top;t=r.right+p.arrowWidth;w="bounce-left"}}}}if(!B){u.css({top:"",left:""})}else{if(s.orientation==="top"||s.orientation==="bottom"){u.css("left",B+"px")}else{if(s.orientation==="left"||s.orientation==="right"){u.css("top",B+"px")}}}t+=g.getPixelValue(s.xOffset);z+=g.getPixelValue(s.yOffset);z+=g.getScrollTop();t+=g.getScrollLeft();if(p.animate){if(!b&&p.animate){D.animate({top:z+"px",left:t+"px"})}else{D.css("top",z+"px");D.css("left",t+"px")}}else{D.css("top",z+"px");D.css("left",t+"px");if(E){v=p.smoothScroll?p.scrollDuration:0;setTimeout(function(){D.addClass(w)},v);setTimeout(function(){D.removeClass(w)},v+2000)}}};this.init=function(){var t=$("
"),r=$("
"),u=$("
"),s=this,v=false,q;this.$element=t;this.$containerEl=r;this.$titleEl=$("

");this.$numberEl=$("");this.$contentEl=$("

");this.$numberEl.attr("id","hopscotch-bubble-number");u.append(this.$titleEl,this.$contentEl).attr("id","hopscotch-bubble-content");r.attr("id","hopscotch-bubble-container").append(this.$numberEl,u);t.attr("id","hopscotch-bubble").addClass("animated").append(r);this.initNavButtons();if(p&&p.showCloseButton){this.initCloseButton()}this.initArrow();window.onresize=function(){if(v||!l){return}v=true;q=setTimeout(function(){n(s,k,false);v=false},200)};$("body").append(t);return this};this.initNavButtons=function(){var q=$("

");this.$prevBtnEl=o("hopscotch-prev",h.prevBtn);this.$nextBtnEl=o("hopscotch-next",h.nextBtn);this.$doneBtnEl=o("hopscotch-done",h.doneBtn);this.$doneBtnEl.addClass("hide");this.$prevBtnEl.click(function(r){window.hopscotch.prevStep()});this.$nextBtnEl.click(function(r){window.hopscotch.nextStep()});this.$doneBtnEl.click(window.hopscotch.endTour);q.attr("id","hopscotch-actions").append(this.$prevBtnEl,this.$nextBtnEl,this.$doneBtnEl);this.buttonsEl=q;this.$containerEl.append(q);return this};this.initCloseButton=function(){var q=$("");q.text(h.closeTooltip).attr({id:"hopscotch-bubble-close",href:"#",title:h.closeTooltip}).click(function(s){var r=hopscotch.getCurrStepNum(),t=hopscotch.getCurrTour(),u=(r===t.steps.length-1);g.invokeCallbacks("close",[t.id,r]);window.hopscotch.endTour(true,u);if(s.preventDefault){s.preventDefault()}else{if(event){event.returnValue=false}}});this.closeBtnEl=q;this.$containerEl.append(q);return this};this.initArrow=function(){var r,q;this.$arrowEl=$("
").attr("id","hopscotch-bubble-arrow-container");q=$("
").addClass("hopscotch-bubble-arrow-border");r=$("
").addClass("hopscotch-bubble-arrow");this.$arrowEl.append(q,r);this.$element.append(this.$arrowEl);return this};this.renderStep=function(s,x,t,u,y){var z=this,r=g.valOrDefault(s.showNextButton,p.showNextButton),q=g.valOrDefault(s.showPrevButton,p.showPrevButton),w,v;k=s;this.setTitle(s.title?s.title:"");this.setContent(s.content?s.content:"");this.setNum(x);this.showPrevButton(this.$prevBtnEl&&q&&(x>0||t>0));this.showNextButton(this.$nextBtnEl&&r&&!u);if(u){this.$doneBtnEl.removeClass("hide")}else{this.$doneBtnEl.addClass("hide")}this.setArrow(s.orientation);w=g.getPixelValue(s.width)||p.bubbleWidth;v=g.valOrDefault(s.padding,p.bubblePadding);this.$containerEl.css({width:w+"px",padding:v+"px"});if(s.orientation==="top"){setTimeout(function(){n(z,s);if(y){y()}},5)}else{n(this,s);if(y){y()}}return this};this.setTitle=function(q){if(q){this.$titleEl.html(q).removeClass("hide")}else{this.$titleEl.addClass("hide")}return this};this.setContent=function(q){if(q){this.$contentEl.html(q).removeClass("hide")}else{this.$contentEl.addClass("hide")}return this};this.setNum=function(q){if(h.stepNums&&q0)?A[w]:A},x=function(){var A=r.steps[m].length;if(w0){--w;return true}else{if(m>0){A=r.steps[--m].length;if(A){w=A-1}else{w=undefined}return true}}return false},k=function(){return r.steps[m].length>0},t=function(){var E=p().$element,A=g.getPixelValue(E.css("top")),F=g.getStepTarget(y())[0],D=F.getBoundingClientRect(),G=D.top+g.getScrollTop(),C=(A1){q=parseInt(B[0],10);s=parseInt(B[1],10)}else{q=parseInt(q,10)}if(tourPair.length>2&&tourPair[2]==="mp"){if(s&&s0){s=0}else{s=undefined}}}}}A=p();A.showPrevButton(n.showPrevButton,true);A.showNextButton(n.showNextButton,true);return this};this.startTour=function(F,E){var B,D,C,A;if(!r){throw"Need to load a tour before you start it!"}if(document.readyState!=="complete"){a=true;return}if(typeof F!==f){m=F;w=E}else{if(r.id===z&&typeof q!==f){m=q;w=s;D=y();if(!g.getStepTarget(D)){u();D=y();if(!g.getStepTarget(D)){this.endTour(false);return}}}else{m=0}}if(!w&&k()){w=0}if(m===0&&!w){g.invokeCallbacks("start",[r.id])}this.showStep(m,w);B=p().show();if(n.animate){B.initAnimate()}this.isActive=true;return this};this.showStep=function(E,C){var H=r.steps,F=H[E],D=H.length,B=r.id+":"+E,A=p(),G;m=E;w=C;if(typeof C!==f&&k()){F=F[C];B+="-"+C}G=(E===D-1)||(C>=F.length-1);A.renderStep(F,E,C,G,t);if(F.multiPage){B+=":mp"}g.setState(n.cookieName,B,1);return this};this.prevStep=function(){var B=y(),A=false;g.invokeCallbacks("prev",[r.id,m]);if(B.onPrev){B.onPrev()}if(n.skipIfNoElement){while(!A&&u()){B=y();A=g.getStepTarget(B)}if(!A){this.endTour()}}else{if(u()){B=y();if(!g.getStepTarget(B)){g.invokeCallbacks("error",[r.id,m]);return}}}this.showStep(m,w);return this};this.nextStep=function(){var B=y(),A=false;g.invokeCallbacks("next",[r.id,m]);if(B.onNext){B.onNext()}if(n.skipIfNoElement){while(!A&&x()){B=y();A=g.getStepTarget(B)}if(!A){this.endTour()}}else{if(x()){B=y();if(!g.getStepTarget(B)){g.invokeCallbacks("error",[r.id,m]);this.endTour();return}}}this.showStep(m,w);return this};this.endTour=function(C,B){var A=p();C=g.valOrDefault(C,true);B=g.valOrDefault(B,true);m=0;w=undefined;q=undefined;A.hide();if(C){g.clearState(n.cookieName)}this.isActive=false;if(B){g.invokeCallbacks("end",[r.id])}hopscotch.removeCallbacks(true);return this};this.getCurrTour=function(){return r};this.getCurrStepNum=function(){return m};this.getCurrSubstepNum=function(){return w};this.hasTakenTour=function(A){if(i){g.getState(n.cookieName+"_history")}return false};this.setHasTakenTour=function(B){var A;if(i&&!this.hasTakenTour(B)){A=g.getState(n.cookieName+"_history");if(A){A+=";"+B}else{A=B}}};this.clearHasTakenTour=function(G){var F,E,B,A,C=n.cookieName+"_history",D=false;if(i){F=g.getState(C);if(F){E=F.split(";");for(B=0,A=E.length;B");q.attr({id:s,type:"button",value:r});q.addClass("hopscotch-nav-button");if(s.indexOf("prev")>=0){q.addClass("prev")}else{q.addClass("next")}return q},m=function(r,q,t){var s=t?"hide-all":"hide";if(typeof q===f){q=true}if(q){r.removeClass(s)}else{r.addClass(s)}},n=function(x,s,E){var A,q,y,r,v,w,z,t,C=g.getStepTarget(s)[0],D=x.$element,u=x.$arrowEl,B=g.getPixelValue(s.arrowOffset);E=g.valOrDefault(E,true);A=g.getPixelValue(s.width)||p.bubbleWidth;y=g.valOrDefault(s.padding,p.bubblePadding);bubbleBorder=g.valOrDefault(s.padding,p.bubbleBorder);D.removeClass("bounce-down bounce-up bounce-left bounce-right");r=C.getBoundingClientRect();if(s.orientation==="top"){q=D.height();z=(r.top-q)-p.arrowWidth;t=r.left;w="bounce-down"}else{if(s.orientation==="bottom"){z=r.bottom+p.arrowWidth;t=r.left;w="bounce-up"}else{if(s.orientation==="left"){z=r.top;t=r.left-A-2*y-2*bubbleBorder-p.arrowWidth;w="bounce-right"}else{if(s.orientation==="right"){z=r.top;t=r.right+p.arrowWidth;w="bounce-left"}}}}if(!B){u.css({top:"",left:""})}else{if(s.orientation==="top"||s.orientation==="bottom"){u.css("left",B+"px")}else{if(s.orientation==="left"||s.orientation==="right"){u.css("top",B+"px")}}}t+=g.getPixelValue(s.xOffset);z+=g.getPixelValue(s.yOffset);z+=g.getScrollTop();t+=g.getScrollLeft();if(p.animate){if(!b&&p.animate){D.animate({top:z+"px",left:t+"px"})}else{D.css("top",z+"px");D.css("left",t+"px")}}else{D.css("top",z+"px");D.css("left",t+"px");if(E){v=p.smoothScroll?p.scrollDuration:0;setTimeout(function(){D.addClass(w)},v);setTimeout(function(){D.removeClass(w)},v+2000)}}};this.init=function(){var t=$("
"),r=$("
"),u=$("
"),s=this,v=false,q;this.$element=t;this.$containerEl=r;this.$titleEl=$("

");this.$numberEl=$("");this.$contentEl=$("

");this.$numberEl.attr("id","hopscotch-bubble-number");u.append(this.$titleEl,this.$contentEl).attr("id","hopscotch-bubble-content");r.attr("id","hopscotch-bubble-container").append(this.$numberEl,u);t.attr("id","hopscotch-bubble").addClass("animated").append(r);this.initNavButtons();if(p&&p.showCloseButton){this.initCloseButton()}this.initArrow();window.onresize=function(){if(v||!l){return}v=true;q=setTimeout(function(){n(s,k,false);v=false},200)};this.hide();$("body").append(t);return this};this.initNavButtons=function(){var q=$("

");this.$prevBtnEl=o("hopscotch-prev",h.prevBtn);this.$nextBtnEl=o("hopscotch-next",h.nextBtn);this.$doneBtnEl=o("hopscotch-done",h.doneBtn);this.$doneBtnEl.addClass("hide");this.$prevBtnEl.click(function(r){window.hopscotch.prevStep()});this.$nextBtnEl.click(function(r){window.hopscotch.nextStep()});this.$doneBtnEl.click(window.hopscotch.endTour);q.attr("id","hopscotch-actions").append(this.$prevBtnEl,this.$nextBtnEl,this.$doneBtnEl);this.buttonsEl=q;this.$containerEl.append(q);return this};this.initCloseButton=function(){var q=$("");q.text(h.closeTooltip).attr({id:"hopscotch-bubble-close",href:"#",title:h.closeTooltip}).click(function(s){var r=hopscotch.getCurrStepNum(),t=hopscotch.getCurrTour(),u=(r===t.steps.length-1);g.invokeCallbacks("close",[t.id,r]);window.hopscotch.endTour(true,u);if(s.preventDefault){s.preventDefault()}else{if(event){event.returnValue=false}}});this.closeBtnEl=q;this.$containerEl.append(q);return this};this.initArrow=function(){var r,q;this.$arrowEl=$("
").attr("id","hopscotch-bubble-arrow-container");q=$("
").addClass("hopscotch-bubble-arrow-border");r=$("
").addClass("hopscotch-bubble-arrow");this.$arrowEl.append(q,r);this.$element.append(this.$arrowEl);return this};this.renderStep=function(s,x,t,u,y){var z=this,r=g.valOrDefault(s.showNextButton,p.showNextButton),q=g.valOrDefault(s.showPrevButton,p.showPrevButton),w,v;k=s;this.setTitle(s.title?s.title:"");this.setContent(s.content?s.content:"");this.setNum(x);this.showPrevButton(this.$prevBtnEl&&q&&(x>0||t>0));this.showNextButton(this.$nextBtnEl&&r&&!u);if(u){this.$doneBtnEl.removeClass("hide")}else{this.$doneBtnEl.addClass("hide")}this.setArrow(s.orientation);w=g.getPixelValue(s.width)||p.bubbleWidth;v=g.valOrDefault(s.padding,p.bubblePadding);this.$containerEl.css({width:w+"px",padding:v+"px"});if(s.orientation==="top"){setTimeout(function(){n(z,s);if(y){y()}},5)}else{n(this,s);if(y){y()}}return this};this.setTitle=function(q){if(q){this.$titleEl.html(q).removeClass("hide")}else{this.$titleEl.addClass("hide")}return this};this.setContent=function(q){if(q){this.$contentEl.html(q).removeClass("hide")}else{this.$contentEl.addClass("hide")}return this};this.setNum=function(q){if(h.stepNums&&q0)?A[w]:A},x=function(){var A=r.steps[m].length;if(w0){--w;return true}else{if(m>0){A=r.steps[--m].length;if(A){w=A-1}else{w=undefined}return true}}return false},k=function(){return r.steps[m].length>0},t=function(){var E=p().$element,A=g.getPixelValue(E.css("top")),F=g.getStepTarget(y())[0],D=F.getBoundingClientRect(),G=D.top+g.getScrollTop(),C=(A1){q=parseInt(B[0],10);s=parseInt(B[1],10)}else{q=parseInt(q,10)}if(tourPair.length>2&&tourPair[2]==="mp"){if(s&&s0){s=0}else{s=undefined}}}}}A=p();A.showPrevButton(n.showPrevButton,true);A.showNextButton(n.showNextButton,true);return this};this.startTour=function(F,E){var B,D,C,A;if(!r){throw"Need to load a tour before you start it!"}if(document.readyState!=="complete"){a=true;return}if(typeof F!==f){m=F;w=E}else{if(r.id===z&&typeof q!==f){m=q;w=s;D=y();if(!g.getStepTarget(D)){u();D=y();if(!g.getStepTarget(D)){this.endTour(false);return}}}else{m=0}}if(!w&&k()){w=0}if(m===0&&!w){g.invokeCallbacks("start",[r.id])}this.showStep(m,w);B=p().show();if(n.animate){B.initAnimate()}this.isActive=true;return this};this.showStep=function(E,C){var H=r.steps,F=H[E],D=H.length,B=r.id+":"+E,A=p(),G;m=E;w=C;if(typeof C!==f&&k()){F=F[C];B+="-"+C}G=(E===D-1)||(C>=F.length-1);A.renderStep(F,E,C,G,t);if(F.multiPage){B+=":mp"}g.setState(n.cookieName,B,1);return this};this.prevStep=function(){var B=y(),A=false;g.invokeCallbacks("prev",[r.id,m]);if(B.onPrev){B.onPrev()}if(n.skipIfNoElement){while(!A&&u()){B=y();A=g.getStepTarget(B)}if(!A){this.endTour()}}else{if(u()){B=y();if(!g.getStepTarget(B)){g.invokeCallbacks("error",[r.id,m]);return}}}this.showStep(m,w);return this};this.nextStep=function(){var B=y(),A=false;g.invokeCallbacks("next",[r.id,m]);if(B.onNext){B.onNext()}if(n.skipIfNoElement){while(!A&&x()){B=y();A=g.getStepTarget(B)}if(!A){this.endTour()}}else{if(x()){B=y();if(!g.getStepTarget(B)){g.invokeCallbacks("error",[r.id,m]);this.endTour();return}}}this.showStep(m,w);return this};this.endTour=function(C,B){var A=p();C=g.valOrDefault(C,true);B=g.valOrDefault(B,true);m=0;w=undefined;q=undefined;A.hide();if(C){g.clearState(n.cookieName)}this.isActive=false;if(B){g.invokeCallbacks("end",[r.id])}hopscotch.removeCallbacks(true);return this};this.getCurrTour=function(){return r};this.getCurrStepNum=function(){return m};this.getCurrSubstepNum=function(){return w};this.hasTakenTour=function(A){if(i){g.getState(n.cookieName+"_history")}return false};this.setHasTakenTour=function(B){var A;if(i&&!this.hasTakenTour(B)){A=g.getState(n.cookieName+"_history");if(A){A+=";"+B}else{A=B}}};this.clearHasTakenTour=function(G){var F,E,B,A,C=n.cookieName+"_history",D=false;if(i){F=g.getState(C);if(F){E=F.split(";");for(B=0,A=E.length;B