diff --git a/js/hopscotch-0.0.5.js b/js/hopscotch-0.0.5.js index b3786b36..893f3b82 100644 --- a/js/hopscotch-0.0.5.js +++ b/js/hopscotch-0.0.5.js @@ -527,7 +527,9 @@ _createButton: function(id, text) { var btnEl = document.createElement('button'); btnEl.id = id; - btnEl.innerHTML = text; + if (text) { + btnEl.innerHTML = text; + } utils.addClass(btnEl, 'hopscotch-nav-button'); if (id.indexOf('prev') >= 0) { @@ -632,7 +634,7 @@ this.prevBtnEl = this._createButton('hopscotch-prev', HopscotchI18N.prevBtn); this.nextBtnEl = this._createButton('hopscotch-next', HopscotchI18N.nextBtn); this.doneBtnEl = this._createButton('hopscotch-done', HopscotchI18N.doneBtn); - this.ctaBtnEl = this._createButton('hopscotch-cta', HopscotchI18N.ctaBtn); + this.ctaBtnEl = this._createButton('hopscotch-cta'); utils.addClass(this.doneBtnEl, 'hide'); buttonsEl.appendChild(this.prevBtnEl); @@ -796,15 +798,17 @@ // Show/hide CTA button this._showButton(this.ctaBtnEl, !!step.showCTAButton); - this.ctaBtnEl.innerHTML = step.ctaLabel; + if (step.showCTAButton) { + this.ctaBtnEl.innerHTML = step.ctaLabel; - if (step.onCTA) { - if (this.onCTA) { - utils.removeClickListener(this.ctaBtnEl, this.onCTA); - } + if (step.onCTA) { + if (this.onCTA) { + utils.removeClickListener(this.ctaBtnEl, this.onCTA); + } - utils.addClickListener(this.ctaBtnEl, step.onCTA); - this.onCTA = step.onCTA; // cache for removing later + utils.addClickListener(this.ctaBtnEl, step.onCTA); + this.onCTA = step.onCTA; // cache for removing later + } } else if (this.onCTA) { // Remove previous CTA callback. diff --git a/js/hopscotch-0.0.5.min.js b/js/hopscotch-0.0.5.min.js index 05d70ebe..66076bea 100644 --- a/js/hopscotch-0.0.5.min.js +++ b/js/hopscotch-0.0.5.min.js @@ -1,36 +1,36 @@ -(function(z,E){var p,A,F,m,G=window.Sizzle||null,b,s,x,t,n=z[E],H=!1,u={animate:!1,smoothScroll:!0,scrollDuration:1E3,scrollTopMargin:200,showCloseButton:!0,showPrevButton:!1,showNextButton:!0,bubbleWidth:280,bubblePadding:15,arrowWidth:20,skipIfNoElement:!0},C="undefined"!==typeof window.jQuery,v="undefined"!==typeof window.sessionStorage,f=window.document;n||(Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),p=function(){H&&n.startTour()},window.addEventListener? +(function(z,E){var p,A,F,n,G=window.Sizzle||null,b,s,x,t,m=z[E],H=!1,u={animate:!1,smoothScroll:!0,scrollDuration:1E3,scrollTopMargin:200,showCloseButton:!0,showPrevButton:!1,showNextButton:!0,bubbleWidth:280,bubblePadding:15,arrowWidth:20,skipIfNoElement:!0},C="undefined"!==typeof window.jQuery,v="undefined"!==typeof window.sessionStorage,f=window.document;m||(Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),p=function(){H&&m.startTour()},window.addEventListener? window.addEventListener("load",p,!1):window.attachEvent&&window.attachEvent("onload",p),b={addClass:function(a,e){var b,d,h;if(0===a.className.length)a.className=e;else{b=a.className.split(/\s+/);d=0;for(h=b.length;dg||g>=j.steps.length?null:j.steps[g]},t=function(){e.nextStep(!1)}, -v=function(a,c){var d,h;0<=g+a&&g+ae?d:e,g=b.getScrollTop(),e=g+b.getWindowHeight(),q=a-h.scrollTopMargin,B,j,w;a>=g&&(a<=g+h.scrollTopMargin||d<=e)?i&&i():h.smoothScroll?"undefined"!==typeof YAHOO&&"undefined"!==typeof YAHOO.env&&"undefined"!==typeof YAHOO.env.ua&&"undefined"!==typeof YAHOO.util&&"undefined"!==typeof YAHOO.util.Scroll?(a=YAHOO.env.ua.webkit?f.body:f.documentElement,d=YAHOO.util.Easing?YAHOO.util.Easing.easeOut:void 0,a=new YAHOO.util.Scroll(a,{scroll:{to:[0,q]}},h.scrollDuration/1E3,d),a.onComplete.subscribe(i), -a.animate()):C?$("body, html").animate({scrollTop:q},h.scrollDuration,i):(0>q&&(q=0),B=g>a?-1:1,j=Math.abs(g-q)/(h.scrollDuration/10),w=function(){var a=b.getScrollTop(),c=a+B*j;0=q||0>B&&c<=q?(c=q,i&&i(),window.scrollTo(0,c)):(window.scrollTo(0,c),b.getScrollTop()===a?i&&i():setTimeout(w,10))},w()):(window.scrollTo(0,q),i&&i())}else i();c.nextOnTargetClick&&b.addClickListener(k,t)});c.multipage&&(e+=":mp");b.setState(h.cookieName,e,1)},c.delay||0);return this};this.prevStep=function(a){z.call(this, -a,-1);return this};this.nextStep=function(a){var c=r(),d=b.getStepTarget(c);c.nextOnTargetClick&&b.removeClickListener(d,t);z.call(this,a,1);return this};this.endTour=function(a,c){var d=y(),a=b.valOrDefault(a,!0),c=b.valOrDefault(c,!0);g=0;i=void 0;d.hide();a&&b.clearState(h.cookieName);n.isActive=!1;j&&c&&b.invokeEventCallbacks("end");n.removeCallbacks(!0);j=null;return this};this.getCurrTour=function(){return j};this.getCurrStepNum=function(){return g};this.listen=function(a,b,c){a&&s[a].push({cb:b, -fromTour:c});return this};this.unlisten=function(a,b){var c=s[a],d,e;d=0;for(e=c.length;dg||g>=j.steps.length?null:j.steps[g]},t=function(){e.nextStep(!1)},v=function(a,c){var d,h;0<=g+a&& +g+ae?d:e,g=b.getScrollTop(), +e=g+b.getWindowHeight(),q=a-h.scrollTopMargin,B,j,w;a>=g&&(a<=g+h.scrollTopMargin||d<=e)?i&&i():h.smoothScroll?"undefined"!==typeof YAHOO&&"undefined"!==typeof YAHOO.env&&"undefined"!==typeof YAHOO.env.ua&&"undefined"!==typeof YAHOO.util&&"undefined"!==typeof YAHOO.util.Scroll?(a=YAHOO.env.ua.webkit?f.body:f.documentElement,d=YAHOO.util.Easing?YAHOO.util.Easing.easeOut:void 0,a=new YAHOO.util.Scroll(a,{scroll:{to:[0,q]}},h.scrollDuration/1E3,d),a.onComplete.subscribe(i),a.animate()):C?$("body, html").animate({scrollTop:q}, +h.scrollDuration,i):(0>q&&(q=0),B=g>a?-1:1,j=Math.abs(g-q)/(h.scrollDuration/10),w=function(){var a=b.getScrollTop(),c=a+B*j;0=q||0>B&&c<=q?(c=q,i&&i(),window.scrollTo(0,c)):(window.scrollTo(0,c),b.getScrollTop()===a?i&&i():setTimeout(w,10))},w()):(window.scrollTo(0,q),i&&i())}else i();c.nextOnTargetClick&&b.addClickListener(k,t)});c.multipage&&(e+=":mp");b.setState(h.cookieName,e,1)},c.delay||0);return this};this.prevStep=function(a){z.call(this,a,-1);return this};this.nextStep=function(a){var c= +r(),d=b.getStepTarget(c);c.nextOnTargetClick&&b.removeClickListener(d,t);z.call(this,a,1);return this};this.endTour=function(a,c){var d=y(),a=b.valOrDefault(a,!0),c=b.valOrDefault(c,!0);g=0;i=void 0;d.hide();a&&b.clearState(h.cookieName);m.isActive=!1;j&&c&&b.invokeEventCallbacks("end");m.removeCallbacks(!0);j=null;return this};this.getCurrTour=function(){return j};this.getCurrStepNum=function(){return g};this.listen=function(a,b,c){a&&s[a].push({cb:b,fromTour:c});return this};this.unlisten=function(a, +b){var c=s[a],d,e;d=0;for(e=c.length;d