From bae5ebafc3f1fdd17de3107b41a630800f1dbf07 Mon Sep 17 00:00:00 2001 From: Gordon Koo Date: Tue, 4 Sep 2012 10:57:31 -0700 Subject: [PATCH] check delay for nextOnTargetClick --- js/hopscotch-min.js | 2 +- js/hopscotch.js | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/js/hopscotch-min.js b/js/hopscotch-min.js index e9bd29cb..472113bb 100644 --- a/js/hopscotch-min.js +++ b/js/hopscotch-min.js @@ -1 +1 @@ -(function(c,e){var o,g,l,k,i,a,n=c[e],j="undefined",b=false,d=(typeof window.jQuery!==j),m=(typeof window.sessionStorage!==j),h=document.body.style,f=(typeof h.MozTransition!==j||typeof h.MsTransition!==j||typeof h.webkitTransition!==j||typeof h.OTransition!==j||typeof h.transition!==j);if(n){return}a=function(){if(b){n.startTour()}};if(window.addEventListener){window.addEventListener("load",a)}else{if(window.attachEvent){window.attachEvent("onload",a)}}k={addClass:function(r,t){var q,s,p;if(r.className.length===0){r.className=t}else{q=r.className.split(" ");for(s=0,p=q.length;s=0){k.addClass(w,"prev")}else{k.addClass(w,"next")}return w},r=function(x,w,z){var y="hide";if(z){y="hide-all"}if(typeof w===j){w=true}if(w){k.removeClass(x,y)}else{k.addClass(x,y)}},s=function(C,z){var F,w,D,y,E,A,B=6,I=k.getStepTarget(z),x=C.element,H=C.arrowEl,G=k.getPixelValue(z.arrowOffset);F=k.getPixelValue(z.width)||u.bubbleWidth;D=k.valOrDefault(z.padding,u.bubblePadding);k.removeClass(x,"fade-in-down fade-in-up fade-in-left fade-in-right");y=I.getBoundingClientRect();if(z.orientation==="top"){w=x.offsetHeight;E=(y.top-w)-u.arrowWidth;A=y.left}else{if(z.orientation==="bottom"){E=y.bottom+u.arrowWidth;A=y.left}else{if(z.orientation==="left"){E=y.top;A=y.left-F-2*D-2*B-u.arrowWidth}else{if(z.orientation==="right"){E=y.top;A=y.right+u.arrowWidth}}}}if(!G){H.style.top="";H.style.left=""}else{if(z.orientation==="top"||z.orientation==="bottom"){H.style.top="";H.style.left=G+"px"}else{if(z.orientation==="left"||z.orientation==="right"){H.style.left="";H.style.top=G+"px"}}}A+=k.getPixelValue(z.xOffset);E+=k.getPixelValue(z.yOffset);if(!z.fixedElement){E+=k.getScrollTop();A+=k.getScrollLeft()}x.style.position=(z.fixedElement?"fixed":"absolute");if(u.animate&&d&&!f){$(x).animate({top:E+"px",left:A+"px"})}else{x.style.top=E+"px";x.style.left=A+"px"}},v=function(){var A=document.createElement("div"),B=document.createElement("div"),z=document.createElement("div"),y=this,C=false,x,w;this.element=A;this.containerEl=B;this.titleEl=document.createElement("h3");this.numberEl=document.createElement("span");this.contentEl=document.createElement("p");A.id="hopscotch-bubble";k.addClass(A,"animated");B.id="hopscotch-bubble-container";this.numberEl.id="hopscotch-bubble-number";B.appendChild(this.numberEl);z.appendChild(this.titleEl);z.appendChild(this.contentEl);z.id="hopscotch-bubble-content";B.appendChild(z);A.appendChild(B);this.initNavButtons();this.initCloseButton();this.initArrow();x=function(){if(C||!q){return}C=true;w=setTimeout(function(){s(y,p,false);C=false},200)};if(window.addEventListener){window.addEventListener("resize",x)}else{if(window.attachEvent){window.attachEvent("onresize",x)}}this.hide();document.body.appendChild(A);return this};this.initNavButtons=function(){var w=document.createElement("div");this.prevBtnEl=t("hopscotch-prev",l.prevBtn);this.nextBtnEl=t("hopscotch-next",l.nextBtn);this.doneBtnEl=t("hopscotch-done",l.doneBtn);k.addClass(this.doneBtnEl,"hide");w.appendChild(this.prevBtnEl);w.appendChild(this.nextBtnEl);w.appendChild(this.doneBtnEl);k.addClickListener(this.prevBtnEl,function(x){n.prevStep()});k.addClickListener(this.nextBtnEl,function(x){n.nextStep()});k.addClickListener(this.doneBtnEl,n.endTour);w.id="hopscotch-actions";this.buttonsEl=w;this.containerEl.appendChild(w);return this};this.initCloseButton=function(){var w=document.createElement("a");w.id="hopscotch-bubble-close";w.href="#";w.title=l.closeTooltip;w.innerHTML=l.closeTooltip;k.addClickListener(w,function(y){var x=n.getCurrStepNum(),z=n.getCurrTour(),A=(x===z.steps.length-1);k.invokeCallbacks("close",[z.id,x]);n.endTour(true,A);if(y.preventDefault){y.preventDefault()}else{if(event){event.returnValue=false}}});this.closeBtnEl=w;this.containerEl.appendChild(w);return this};this.initArrow=function(){var w,x;this.arrowEl=document.createElement("div");this.arrowEl.id="hopscotch-bubble-arrow-container";x=document.createElement("div");x.className="hopscotch-bubble-arrow-border";w=document.createElement("div");w.className="hopscotch-bubble-arrow";this.arrowEl.appendChild(x);this.arrowEl.appendChild(w);this.element.appendChild(this.arrowEl);return this};this.renderStep=function(y,D,z,A,E){var F=this,x=k.valOrDefault(y.showNextButton,u.showNextButton),w=k.valOrDefault(y.showPrevButton,u.showPrevButton),C,B;p=y;this.setTitle(y.title?y.title:"");this.setContent(y.content?y.content:"");this.setNum(D);this.orientation=y.orientation;this.showPrevButton(this.prevBtnEl&&w&&(D>0||z>0));this.showNextButton(this.nextBtnEl&&x&&!A);this.nextBtnEl.value=y.showSkip?l.skipBtn:l.nextBtn;if(A){k.removeClass(this.doneBtnEl,"hide")}else{k.addClass(this.doneBtnEl,"hide")}this.setArrow(y.orientation);C=k.getPixelValue(y.width)||u.bubbleWidth;B=k.valOrDefault(y.padding,u.bubblePadding);this.containerEl.style.width=C+"px";this.containerEl.style.padding=B+"px";this.element.style.zIndex=(y.zindex?y.zindex:"");if(y.orientation==="top"){setTimeout(function(){s(F,y);if(E){if(!y.fixedElement){E()}else{F.show()}}},5)}else{s(this,y);if(E){if(!y.fixedElement){E()}else{F.show()}}}return this};this.setTitle=function(w){if(w){this.titleEl.innerHTML=w;k.removeClass(this.titleEl,"hide")}else{k.addClass(this.titleEl,"hide")}return this};this.setContent=function(w){if(w){this.contentEl.innerHTML=w;k.removeClass(this.contentEl,"hide")}else{k.addClass(this.contentEl,"hide")}return this};this.setNum=function(w){if(l.stepNums&&w0)?I[H]:I},B=function(){return z.steps[t].length>0},v=function(){var I=z.steps[t].length;if(H0){--H;return true}else{if(t>0){I=z.steps[--t].length;if(I){H=I-1}else{H=undefined}return true}}return false},s=function(T){var R=x(),ab=R.element,X=k.getPixelValue(ab.style.top),W=X+k.getPixelValue(ab.offsetHeight),U=k.getStepTarget(C()),ac=U.getBoundingClientRect(),Z=ac.top+k.getScrollTop(),V=ac.bottom+k.getScrollTop(),P=(XV)?W:V,Y=k.getScrollTop(),K=Y+k.getWindowHeight(),L=P-q.scrollTopMargin,S=this,J,O,N,aa,M,Q;if(P>=Y&&(P<=Y+q.scrollTopMargin||I<=K)){if(T){T()}return}else{if(!q.smoothScroll){window.scrollTo(0,L);if(T){T()}return}else{if(typeof YAHOO!==j&&typeof YAHOO.env!==j&&typeof YAHOO.env.ua!==j&&typeof YAHOO.util!==j&&typeof YAHOO.util.Scroll!==j){J=YAHOO.env.ua.webkit?document.body:document.documentElement;N=YAHOO.util.Easing?YAHOO.util.Easing.easeOut:undefined;O=new YAHOO.util.Scroll(J,{scroll:{to:[0,L]}},q.scrollDuration/1000,N);O.onComplete.subscribe(T);O.animate()}else{if(d){$("body, html").animate({scrollTop:L},q.scrollDuration,T)}else{if(L<0){L=0}aa=(Y>P)?-1:1;M=Math.abs(Y-L)/(q.scrollDuration/10);Q=setInterval(function(){var ae=k.getScrollTop(),ad=ae+(aa*M);if((aa>0&&ad>=L)||aa<0&&ad<=L){ad=L;clearInterval(Q);if(T){T()}window.scrollTo(0,ad);return}window.scrollTo(0,ad);if(k.getScrollTop()===ae){clearInterval(Q);if(T){T()}}},10)}}}}},r=function(N){var L={},J,O,K,I,M;z=N;for(O in N){if(N.hasOwnProperty(O)&&O!=="id"&&O!=="steps"){L[O]=N[O]}}this.resetDefaultOptions();u.call(this,L,true);I=k.getState(q.cookieName);if(I){M=I.split(":");y=M[0];p=M[1];F=undefined;K=p.split("-");if(K.length>1){p=parseInt(K[0],10);F=parseInt(K[1],10)}else{p=parseInt(p,10)}if(M.length>2&&M[2]==="mp"){if(F&&F0){F=0}else{F=undefined}}}}}return this},D=function(){if(w){this.configure(w)}};this.startTour=function(M,L,K){var I,J;if(!z){r.call(this,M)}if(document.readyState!=="complete"){b=true;return this}if(typeof L!==j){t=L;H=K}else{if(z.id===y&&typeof p!==j){t=p;H=F;J=C();if(!k.getStepTarget(J)){G();J=C();if(!k.getStepTarget(J)){this.endTour(false,false);return this}}}else{t=0}}if(!H&&B()){H=0}k.invokeCallbacks("start",[z.id,t]);I=x();I.hide(false);this.isActive=true;if(q.animate){I.initAnimate()}if(!k.getStepTarget(C())){k.invokeCallbacks("error",[z.id,t]);if(q.skipIfNoElement){this.nextStep(false)}}else{this.showStep(t,H)}return this};this.showStep=function(T,J){var L=z.steps,K=L[T],I=L.length,Q=z.id+":"+T,P=x(),N=k.valOrDefault(K.delay,0),S=this,R=k.getStepTarget(K),O,M;t=T;H=J;if(!q.animate){P.hide(false)}if(typeof J!==j&&B()){K=K[J];Q+="-"+J}if(K.nextOnTargetClick){O=function(){S.nextStep();return R.removeEventListener?R.removeEventListener("click",O):R.detachEvent("click",O)}}M=(T===I-1)||(J>=K.length-1);setTimeout(function(){P.renderStep(K,T,J,M,function(){s(function(){P.show()});if(K.onShow){K.onShow()}if(K.nextOnTargetClick){k.addClickListener(R,O)}});k.invokeCallbacks("show",[z.id,t])},N);if(K.multipage){Q+=":mp"}k.setState(q.cookieName,Q,1);return this};this.prevStep=function(){var K=C(),J=false,I=x();if(K.onPrev){K.onPrev()}k.invokeCallbacks("prev",[z.id,t]);if(q.skipIfNoElement){while(!J&&G()){K=C();J=k.getStepTarget(K);if(!J){k.invokeCallbacks("error",[z.id,t])}}if(!J){return this.endTour(true,false)}}else{if(G()){K=C();if(!k.getStepTarget(K)){k.invokeCallbacks("error",[z.id,t]);return this.endTour(true,false)}}}this.showStep(t,H);return this};this.nextStep=function(M){var L=C(),K=t,J=false,I=x();M=k.valOrDefault(M,true);if(q.skipIfNoElement){while(!J&&v()){L=C();J=k.getStepTarget(L);if(!J){k.invokeCallbacks("error",[z.id,t])}}if(!J){return this.endTour(true)}}else{if(v()){L=C();if(!k.getStepTarget(L)){k.invokeCallbacks("error",[z.id,t]);return this.endTour(true,false)}}}if(M){if(L.onNext){L.onNext()}k.invokeCallbacks("next",[z.id,K])}this.showStep(t,H);return this};this.endTour=function(K,J){var I=x();K=k.valOrDefault(K,true);J=k.valOrDefault(J,true);t=0;H=undefined;p=undefined;I.hide();if(K){k.clearState(q.cookieName)}n.isActive=false;if(z&&J){k.invokeCallbacks("end",[z.id])}n.removeCallbacks(true);z=null;return this};this.getCurrTour=function(){return z};this.getCurrStepNum=function(){return t};this.getCurrSubstepNum=function(){return H};this.addCallback=function(K,I,J){if(I){i[K].push({cb:I,fromTour:J})}return this};this.removeCallbacks=function(J){var M,K,I,L;for(L in i){if(J){M=i[L];for(K=0,I=M.length;K=0){k.addClass(w,"prev")}else{k.addClass(w,"next")}return w},r=function(x,w,z){var y="hide";if(z){y="hide-all"}if(typeof w===j){w=true}if(w){k.removeClass(x,y)}else{k.addClass(x,y)}},s=function(C,z){var F,w,D,y,E,A,B=6,I=k.getStepTarget(z),x=C.element,H=C.arrowEl,G=k.getPixelValue(z.arrowOffset);F=k.getPixelValue(z.width)||u.bubbleWidth;D=k.valOrDefault(z.padding,u.bubblePadding);k.removeClass(x,"fade-in-down fade-in-up fade-in-left fade-in-right");y=I.getBoundingClientRect();if(z.orientation==="top"){w=x.offsetHeight;E=(y.top-w)-u.arrowWidth;A=y.left}else{if(z.orientation==="bottom"){E=y.bottom+u.arrowWidth;A=y.left}else{if(z.orientation==="left"){E=y.top;A=y.left-F-2*D-2*B-u.arrowWidth}else{if(z.orientation==="right"){E=y.top;A=y.right+u.arrowWidth}}}}if(!G){H.style.top="";H.style.left=""}else{if(z.orientation==="top"||z.orientation==="bottom"){H.style.top="";H.style.left=G+"px"}else{if(z.orientation==="left"||z.orientation==="right"){H.style.left="";H.style.top=G+"px"}}}A+=k.getPixelValue(z.xOffset);E+=k.getPixelValue(z.yOffset);if(!z.fixedElement){E+=k.getScrollTop();A+=k.getScrollLeft()}x.style.position=(z.fixedElement?"fixed":"absolute");if(u.animate&&d&&!f){$(x).animate({top:E+"px",left:A+"px"})}else{x.style.top=E+"px";x.style.left=A+"px"}},v=function(){var A=document.createElement("div"),B=document.createElement("div"),z=document.createElement("div"),y=this,C=false,x,w;this.element=A;this.containerEl=B;this.titleEl=document.createElement("h3");this.numberEl=document.createElement("span");this.contentEl=document.createElement("p");A.id="hopscotch-bubble";k.addClass(A,"animated");B.id="hopscotch-bubble-container";this.numberEl.id="hopscotch-bubble-number";B.appendChild(this.numberEl);z.appendChild(this.titleEl);z.appendChild(this.contentEl);z.id="hopscotch-bubble-content";B.appendChild(z);A.appendChild(B);this.initNavButtons();this.initCloseButton();this.initArrow();x=function(){if(C||!q){return}C=true;w=setTimeout(function(){s(y,p,false);C=false},200)};if(window.addEventListener){window.addEventListener("resize",x)}else{if(window.attachEvent){window.attachEvent("onresize",x)}}this.hide();document.body.appendChild(A);return this};this.initNavButtons=function(){var w=document.createElement("div");this.prevBtnEl=t("hopscotch-prev",l.prevBtn);this.nextBtnEl=t("hopscotch-next",l.nextBtn);this.doneBtnEl=t("hopscotch-done",l.doneBtn);k.addClass(this.doneBtnEl,"hide");w.appendChild(this.prevBtnEl);w.appendChild(this.nextBtnEl);w.appendChild(this.doneBtnEl);k.addClickListener(this.prevBtnEl,function(x){n.prevStep()});k.addClickListener(this.nextBtnEl,function(x){n.nextStep()});k.addClickListener(this.doneBtnEl,n.endTour);w.id="hopscotch-actions";this.buttonsEl=w;this.containerEl.appendChild(w);return this};this.initCloseButton=function(){var w=document.createElement("a");w.id="hopscotch-bubble-close";w.href="#";w.title=l.closeTooltip;w.innerHTML=l.closeTooltip;k.addClickListener(w,function(y){var x=n.getCurrStepNum(),z=n.getCurrTour(),A=(x===z.steps.length-1);k.invokeCallbacks("close",[z.id,x]);n.endTour(true,A);if(y.preventDefault){y.preventDefault()}else{if(event){event.returnValue=false}}});this.closeBtnEl=w;this.containerEl.appendChild(w);return this};this.initArrow=function(){var w,x;this.arrowEl=document.createElement("div");this.arrowEl.id="hopscotch-bubble-arrow-container";x=document.createElement("div");x.className="hopscotch-bubble-arrow-border";w=document.createElement("div");w.className="hopscotch-bubble-arrow";this.arrowEl.appendChild(x);this.arrowEl.appendChild(w);this.element.appendChild(this.arrowEl);return this};this.renderStep=function(y,D,z,A,E){var F=this,x=k.valOrDefault(y.showNextButton,u.showNextButton),w=k.valOrDefault(y.showPrevButton,u.showPrevButton),C,B;p=y;this.setTitle(y.title?y.title:"");this.setContent(y.content?y.content:"");this.setNum(D);this.orientation=y.orientation;this.showPrevButton(this.prevBtnEl&&w&&(D>0||z>0));this.showNextButton(this.nextBtnEl&&x&&!A);this.nextBtnEl.value=y.showSkip?l.skipBtn:l.nextBtn;if(A){k.removeClass(this.doneBtnEl,"hide")}else{k.addClass(this.doneBtnEl,"hide")}this.setArrow(y.orientation);C=k.getPixelValue(y.width)||u.bubbleWidth;B=k.valOrDefault(y.padding,u.bubblePadding);this.containerEl.style.width=C+"px";this.containerEl.style.padding=B+"px";this.element.style.zIndex=(y.zindex?y.zindex:"");if(y.orientation==="top"){setTimeout(function(){s(F,y);if(E){if(!y.fixedElement){E()}else{F.show()}}},5)}else{s(this,y);if(E){if(!y.fixedElement){E()}else{F.show()}}}return this};this.setTitle=function(w){if(w){this.titleEl.innerHTML=w;k.removeClass(this.titleEl,"hide")}else{k.addClass(this.titleEl,"hide")}return this};this.setContent=function(w){if(w){this.contentEl.innerHTML=w;k.removeClass(this.contentEl,"hide")}else{k.addClass(this.contentEl,"hide")}return this};this.setNum=function(w){if(l.stepNums&&w0)?I[H]:I},B=function(){return z.steps[t].length>0},v=function(){var I=z.steps[t].length;if(H0){--H;return true}else{if(t>0){I=z.steps[--t].length;if(I){H=I-1}else{H=undefined}return true}}return false},s=function(T){var R=x(),ab=R.element,X=k.getPixelValue(ab.style.top),W=X+k.getPixelValue(ab.offsetHeight),U=k.getStepTarget(C()),ac=U.getBoundingClientRect(),Z=ac.top+k.getScrollTop(),V=ac.bottom+k.getScrollTop(),P=(XV)?W:V,Y=k.getScrollTop(),K=Y+k.getWindowHeight(),L=P-q.scrollTopMargin,S=this,J,O,N,aa,M,Q;if(P>=Y&&(P<=Y+q.scrollTopMargin||I<=K)){if(T){T()}return}else{if(!q.smoothScroll){window.scrollTo(0,L);if(T){T()}return}else{if(typeof YAHOO!==j&&typeof YAHOO.env!==j&&typeof YAHOO.env.ua!==j&&typeof YAHOO.util!==j&&typeof YAHOO.util.Scroll!==j){J=YAHOO.env.ua.webkit?document.body:document.documentElement;N=YAHOO.util.Easing?YAHOO.util.Easing.easeOut:undefined;O=new YAHOO.util.Scroll(J,{scroll:{to:[0,L]}},q.scrollDuration/1000,N);O.onComplete.subscribe(T);O.animate()}else{if(d){$("body, html").animate({scrollTop:L},q.scrollDuration,T)}else{if(L<0){L=0}aa=(Y>P)?-1:1;M=Math.abs(Y-L)/(q.scrollDuration/10);Q=setInterval(function(){var ae=k.getScrollTop(),ad=ae+(aa*M);if((aa>0&&ad>=L)||aa<0&&ad<=L){ad=L;clearInterval(Q);if(T){T()}window.scrollTo(0,ad);return}window.scrollTo(0,ad);if(k.getScrollTop()===ae){clearInterval(Q);if(T){T()}}},10)}}}}},r=function(N){var L={},J,O,K,I,M;z=N;for(O in N){if(N.hasOwnProperty(O)&&O!=="id"&&O!=="steps"){L[O]=N[O]}}this.resetDefaultOptions();u.call(this,L,true);I=k.getState(q.cookieName);if(I){M=I.split(":");y=M[0];p=M[1];F=undefined;K=p.split("-");if(K.length>1){p=parseInt(K[0],10);F=parseInt(K[1],10)}else{p=parseInt(p,10)}if(M.length>2&&M[2]==="mp"){if(F&&F0){F=0}else{F=undefined}}}}}return this},D=function(){if(w){this.configure(w)}};this.startTour=function(M,L,K){var I,J;if(!z){r.call(this,M)}if(document.readyState!=="complete"){b=true;return this}if(typeof L!==j){t=L;H=K}else{if(z.id===y&&typeof p!==j){t=p;H=F;J=C();if(!k.getStepTarget(J)){G();J=C();if(!k.getStepTarget(J)){this.endTour(false,false);return this}}}else{t=0}}if(!H&&B()){H=0}k.invokeCallbacks("start",[z.id,t]);I=x();I.hide(false);this.isActive=true;if(q.animate){I.initAnimate()}if(!k.getStepTarget(C())){k.invokeCallbacks("error",[z.id,t]);if(q.skipIfNoElement){this.nextStep(false)}}else{this.showStep(t,H)}return this};this.showStep=function(T,J){var L=z.steps,K=L[T],I=L.length,Q=z.id+":"+T,P=x(),N=k.valOrDefault(K.delay,0),S=this,R=k.getStepTarget(K),O,M;t=T;H=J;if(!q.animate){P.hide(false)}if(typeof J!==j&&B()){K=K[J];Q+="-"+J}if(K.nextOnTargetClick){O=function(){if(K.delay){setTimeout(function(){S.nextStep()},K.delay)}else{S.nextStep()}return R.removeEventListener?R.removeEventListener("click",O):R.detachEvent("click",O)}}M=(T===I-1)||(J>=K.length-1);setTimeout(function(){P.renderStep(K,T,J,M,function(){s(function(){P.show()});if(K.onShow){K.onShow()}if(K.nextOnTargetClick){k.addClickListener(R,O)}});k.invokeCallbacks("show",[z.id,t])},N);if(K.multipage){Q+=":mp"}k.setState(q.cookieName,Q,1);return this};this.prevStep=function(){var K=C(),J=false,I=x();if(K.onPrev){K.onPrev()}k.invokeCallbacks("prev",[z.id,t]);if(q.skipIfNoElement){while(!J&&G()){K=C();J=k.getStepTarget(K);if(!J){k.invokeCallbacks("error",[z.id,t])}}if(!J){return this.endTour(true,false)}}else{if(G()){K=C();if(!k.getStepTarget(K)){k.invokeCallbacks("error",[z.id,t]);return this.endTour(true,false)}}}this.showStep(t,H);return this};this.nextStep=function(M){var L=C(),K=t,J=false,I=x();M=k.valOrDefault(M,true);if(q.skipIfNoElement){while(!J&&v()){L=C();J=k.getStepTarget(L);if(!J){k.invokeCallbacks("error",[z.id,t])}}if(!J){return this.endTour(true)}}else{if(v()){L=C();if(!k.getStepTarget(L)){k.invokeCallbacks("error",[z.id,t]);return this.endTour(true,false)}}}if(M){if(L.onNext){L.onNext()}k.invokeCallbacks("next",[z.id,K])}this.showStep(t,H);return this};this.endTour=function(K,J){var I=x();K=k.valOrDefault(K,true);J=k.valOrDefault(J,true);t=0;H=undefined;p=undefined;I.hide();if(K){k.clearState(q.cookieName)}n.isActive=false;if(z&&J){k.invokeCallbacks("end",[z.id])}n.removeCallbacks(true);z=null;return this};this.getCurrTour=function(){return z};this.getCurrStepNum=function(){return t};this.getCurrSubstepNum=function(){return H};this.addCallback=function(K,I,J){if(I){i[K].push({cb:I,fromTour:J})}return this};this.removeCallbacks=function(J){var M,K,I,L;for(L in i){if(J){M=i[L];for(K=0,I=M.length;K