|
527 | 527 | _createButton: function(id, text) {
|
528 | 528 | var btnEl = document.createElement('button');
|
529 | 529 | btnEl.id = id;
|
530 |
| - btnEl.innerHTML = text; |
| 530 | + if (text) { |
| 531 | + btnEl.innerHTML = text; |
| 532 | + } |
531 | 533 | utils.addClass(btnEl, 'hopscotch-nav-button');
|
532 | 534 |
|
533 | 535 | if (id.indexOf('prev') >= 0) {
|
|
632 | 634 | this.prevBtnEl = this._createButton('hopscotch-prev', HopscotchI18N.prevBtn);
|
633 | 635 | this.nextBtnEl = this._createButton('hopscotch-next', HopscotchI18N.nextBtn);
|
634 | 636 | this.doneBtnEl = this._createButton('hopscotch-done', HopscotchI18N.doneBtn);
|
635 |
| - this.ctaBtnEl = this._createButton('hopscotch-cta', HopscotchI18N.ctaBtn); |
| 637 | + this.ctaBtnEl = this._createButton('hopscotch-cta'); |
636 | 638 | utils.addClass(this.doneBtnEl, 'hide');
|
637 | 639 |
|
638 | 640 | buttonsEl.appendChild(this.prevBtnEl);
|
|
796 | 798 |
|
797 | 799 | // Show/hide CTA button
|
798 | 800 | this._showButton(this.ctaBtnEl, !!step.showCTAButton);
|
799 |
| - this.ctaBtnEl.innerHTML = step.ctaLabel; |
| 801 | + if (step.showCTAButton) { |
| 802 | + this.ctaBtnEl.innerHTML = step.ctaLabel; |
800 | 803 |
|
801 |
| - if (step.onCTA) { |
802 |
| - if (this.onCTA) { |
803 |
| - utils.removeClickListener(this.ctaBtnEl, this.onCTA); |
804 |
| - } |
| 804 | + if (step.onCTA) { |
| 805 | + if (this.onCTA) { |
| 806 | + utils.removeClickListener(this.ctaBtnEl, this.onCTA); |
| 807 | + } |
805 | 808 |
|
806 |
| - utils.addClickListener(this.ctaBtnEl, step.onCTA); |
807 |
| - this.onCTA = step.onCTA; // cache for removing later |
| 809 | + utils.addClickListener(this.ctaBtnEl, step.onCTA); |
| 810 | + this.onCTA = step.onCTA; // cache for removing later |
| 811 | + } |
808 | 812 | }
|
809 | 813 | else if (this.onCTA) {
|
810 | 814 | // Remove previous CTA callback.
|
|
0 commit comments