Skip to content

Commit

Permalink
Revert "set delay popover options instead of use a custom delay imple…
Browse files Browse the repository at this point in the history
…mentation"

This reverts commit 06400fd.
  • Loading branch information
brexis committed Jul 17, 2015
1 parent 06400fd commit 1d78307
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 23 deletions.
16 changes: 12 additions & 4 deletions build/js/bootstrap-tour-standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@
redirect: true,
orphan: false,
duration: false,
delay: 0,
delay: false,
basePath: '',
template: '<div class="popover" role="tooltip"> <div class="arrow"></div> <h3 class="popover-title"></h3> <div class="popover-content"></div> <div class="popover-navigation"> <div class="btn-group"> <button class="btn btn-sm btn-default" data-role="prev">&laquo; Prev</button> <button class="btn btn-sm btn-default" data-role="next">Next &raquo;</button> <button class="btn btn-sm btn-default" data-role="pause-resume" data-pause-text="Pause" data-resume-text="Resume">Pause</button> </div> <button class="btn btn-sm btn-default" data-role="end">End tour</button> </div> </div>',
afterSetState: function(key, value) {},
Expand Down Expand Up @@ -981,7 +981,16 @@
}
};
})(this);
this._callOnPromiseDone(promise, showStepHelper);
if (step.delay) {
this._debug("Wait " + step.delay + " milliseconds to show the step " + (this._current + 1));
window.setTimeout((function(_this) {
return function() {
return _this._callOnPromiseDone(promise, showStepHelper);
};
})(this), step.delay);
} else {
this._callOnPromiseDone(promise, showStepHelper);
}
return promise;
};

Expand Down Expand Up @@ -1175,8 +1184,7 @@
animation: step.animation,
container: step.container,
template: step.template,
selector: step.element,
delay: step.delay
selector: step.element
}).popover('show');
$tip = $element.data('bs.popover') ? $element.data('bs.popover').tip() : $element.data('popover').tip();
$tip.attr('id', step.id);
Expand Down
2 changes: 1 addition & 1 deletion build/js/bootstrap-tour-standalone.min.js

Large diffs are not rendered by default.

16 changes: 12 additions & 4 deletions build/js/bootstrap-tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
redirect: true,
orphan: false,
duration: false,
delay: 0,
delay: false,
basePath: '',
template: '<div class="popover" role="tooltip"> <div class="arrow"></div> <h3 class="popover-title"></h3> <div class="popover-content"></div> <div class="popover-navigation"> <div class="btn-group"> <button class="btn btn-sm btn-default" data-role="prev">&laquo; Prev</button> <button class="btn btn-sm btn-default" data-role="next">Next &raquo;</button> <button class="btn btn-sm btn-default" data-role="pause-resume" data-pause-text="Pause" data-resume-text="Resume">Pause</button> </div> <button class="btn btn-sm btn-default" data-role="end">End tour</button> </div> </div>',
afterSetState: function(key, value) {},
Expand Down Expand Up @@ -349,7 +349,16 @@
}
};
})(this);
this._callOnPromiseDone(promise, showStepHelper);
if (step.delay) {
this._debug("Wait " + step.delay + " milliseconds to show the step " + (this._current + 1));
window.setTimeout((function(_this) {
return function() {
return _this._callOnPromiseDone(promise, showStepHelper);
};
})(this), step.delay);
} else {
this._callOnPromiseDone(promise, showStepHelper);
}
return promise;
};

Expand Down Expand Up @@ -543,8 +552,7 @@
animation: step.animation,
container: step.container,
template: step.template,
selector: step.element,
delay: step.delay
selector: step.element
}).popover('show');
$tip = $element.data('bs.popover') ? $element.data('bs.popover').tip() : $element.data('popover').tip();
$tip.attr('id', step.id);
Expand Down
2 changes: 1 addition & 1 deletion build/js/bootstrap-tour.min.js

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions src/coffee/bootstrap-tour.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
redirect: true
orphan: false
duration: false
delay: 0
delay: false
basePath: ''
template: '<div class="popover" role="tooltip">
<div class="arrow"></div>
Expand Down Expand Up @@ -299,7 +299,13 @@
# Play step timer
@resume() if step.duration

@_callOnPromiseDone promise, showStepHelper
if step.delay
@_debug "Wait #{step.delay} milliseconds to show the step #{@_current + 1}"
window.setTimeout =>
@_callOnPromiseDone promise, showStepHelper
, step.delay
else
@_callOnPromiseDone promise, showStepHelper

promise

Expand Down Expand Up @@ -475,7 +481,6 @@
container: step.container
template: step.template
selector: step.element
delay: step.delay
)
.popover 'show'

Expand Down
5 changes: 3 additions & 2 deletions src/docs/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h3 id="tour-options">Global options</h3>
redirect: true,
orphan: false,
duration: false,
delay: 0,
delay: false,
basePath: "",
template: "<div class='popover tour'>
<div class='arrow'></div>
Expand Down Expand Up @@ -166,10 +166,11 @@ <h3 class='popover-title'></h3>
</tr>
<tr id="delay" class="success">
<td>delay <span class="label label-success">NEW</span></td>
<td>Number</td>
<td>Boolean|Number</td>
<td>Specifies a delay for the showing and hiding the tour steps.
It can be:
<ul>
<li>a falsy - there is no delay</li>
<li>a number - used as a delay for both showing and hiding. In milliseconds</li>
<li>a object containing optional <code>show</code> and <code>hide</code> numbers - defines the delays for showing and hiding respectively</li>
</ul>
Expand Down
16 changes: 12 additions & 4 deletions src/docs/assets/js/bootstrap-tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
redirect: true,
orphan: false,
duration: false,
delay: 0,
delay: false,
basePath: '',
template: '<div class="popover" role="tooltip"> <div class="arrow"></div> <h3 class="popover-title"></h3> <div class="popover-content"></div> <div class="popover-navigation"> <div class="btn-group"> <button class="btn btn-sm btn-default" data-role="prev">&laquo; Prev</button> <button class="btn btn-sm btn-default" data-role="next">Next &raquo;</button> <button class="btn btn-sm btn-default" data-role="pause-resume" data-pause-text="Pause" data-resume-text="Resume">Pause</button> </div> <button class="btn btn-sm btn-default" data-role="end">End tour</button> </div> </div>',
afterSetState: function(key, value) {},
Expand Down Expand Up @@ -349,7 +349,16 @@
}
};
})(this);
this._callOnPromiseDone(promise, showStepHelper);
if (step.delay) {
this._debug("Wait " + step.delay + " milliseconds to show the step " + (this._current + 1));
window.setTimeout((function(_this) {
return function() {
return _this._callOnPromiseDone(promise, showStepHelper);
};
})(this), step.delay);
} else {
this._callOnPromiseDone(promise, showStepHelper);
}
return promise;
};

Expand Down Expand Up @@ -543,8 +552,7 @@
animation: step.animation,
container: step.container,
template: step.template,
selector: step.element,
delay: step.delay
selector: step.element
}).popover('show');
$tip = $element.data('bs.popover') ? $element.data('bs.popover').tip() : $element.data('popover').tip();
$tip.attr('id', step.id);
Expand Down
16 changes: 12 additions & 4 deletions test/bootstrap-tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
redirect: true,
orphan: false,
duration: false,
delay: 0,
delay: false,
basePath: '',
template: '<div class="popover" role="tooltip"> <div class="arrow"></div> <h3 class="popover-title"></h3> <div class="popover-content"></div> <div class="popover-navigation"> <div class="btn-group"> <button class="btn btn-sm btn-default" data-role="prev">&laquo; Prev</button> <button class="btn btn-sm btn-default" data-role="next">Next &raquo;</button> <button class="btn btn-sm btn-default" data-role="pause-resume" data-pause-text="Pause" data-resume-text="Resume">Pause</button> </div> <button class="btn btn-sm btn-default" data-role="end">End tour</button> </div> </div>',
afterSetState: function(key, value) {},
Expand Down Expand Up @@ -349,7 +349,16 @@
}
};
})(this);
this._callOnPromiseDone(promise, showStepHelper);
if (step.delay) {
this._debug("Wait " + step.delay + " milliseconds to show the step " + (this._current + 1));
window.setTimeout((function(_this) {
return function() {
return _this._callOnPromiseDone(promise, showStepHelper);
};
})(this), step.delay);
} else {
this._callOnPromiseDone(promise, showStepHelper);
}
return promise;
};

Expand Down Expand Up @@ -543,8 +552,7 @@
animation: step.animation,
container: step.container,
template: step.template,
selector: step.element,
delay: step.delay
selector: step.element
}).popover('show');
$tip = $element.data('bs.popover') ? $element.data('bs.popover').tip() : $element.data('popover').tip();
$tip.attr('id', step.id);
Expand Down

0 comments on commit 1d78307

Please sign in to comment.