Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added html: true to popover so that way it is able to work with newer…

… versions

of bootstrap-popover.
  • Loading branch information...
commit 2d18d04d4933ee623fdb9ec310a0ea96d7153446 1 parent d5d92ac
@sdizier sdizier authored
Showing with 17 additions and 47 deletions.
  1. +1 −0  bootstrap-tour.coffee
  2. +16 −47 bootstrap-tour.js
View
1  bootstrap-tour.coffee
@@ -205,6 +205,7 @@
trigger: "manual"
title: step.title
content: content
+ html: true
animation: step.animation
}).popover("show")
View
63 bootstrap-tour.js
@@ -1,4 +1,3 @@
-// Generated by CoffeeScript 1.3.3
/* ============================================================
# bootstrap-tour.js v0.1
@@ -19,7 +18,6 @@
# limitations under the License.
*/
-
(function() {
(function($, window) {
@@ -46,9 +44,7 @@
this._steps = [];
this.setCurrentStep();
this._onresize(function() {
- if (!_this.ended) {
- return _this.showStep(_this._current);
- }
+ if (!_this.ended) return _this.showStep(_this._current);
});
}
@@ -90,12 +86,8 @@
Tour.prototype.start = function(force) {
var _this = this;
- if (force == null) {
- force = false;
- }
- if (this.ended() && !force) {
- return;
- }
+ if (force == null) force = false;
+ if (this.ended() && !force) return;
$(document).off("click.bootstrap-tour", ".popover .next").on("click.bootstrap-tour", ".popover .next", function(e) {
e.preventDefault();
return _this.next();
@@ -142,34 +134,26 @@
Tour.prototype.hideStep = function(i) {
var step;
step = this.getStep(i);
- if (step.onHide != null) {
- step.onHide(this);
- }
+ if (step.onHide != null) step.onHide(this);
return $(step.element).popover("hide");
};
Tour.prototype.showStep = function(i) {
var step;
step = this.getStep(i);
- if (!step) {
- return;
- }
+ if (!step) return;
this.setCurrentStep(i);
if (step.path !== "" && document.location.pathname !== step.path && document.location.pathname.replace(/^.*[\\\/]/, '') !== step.path) {
document.location.href = step.path;
return;
}
- if (step.onShow != null) {
- step.onShow(this);
- }
+ if (step.onShow != null) step.onShow(this);
if (!((step.element != null) && $(step.element).length !== 0 && $(step.element).is(":visible"))) {
this.showNextStep();
return;
}
this._showPopover(step, i);
- if (step.onShown != null) {
- return step.onShown(this);
- }
+ if (step.onShown != null) return step.onShown(this);
};
Tour.prototype.setCurrentStep = function(value) {
@@ -203,9 +187,7 @@
_this = this;
content = "" + step.content + "<br /><p>";
options = $.extend({}, this._options);
- if (step.options) {
- $.extend(options, step.options);
- }
+ if (step.options) $.extend(options, step.options);
if (step.reflex) {
$(step.element).css("cursor", "pointer");
$(step.element).on("click", function(e) {
@@ -227,6 +209,7 @@
trigger: "manual",
title: step.title,
content: content,
+ html: true,
animation: step.animation
}).popover("show");
tip = $(step.element).data("popover").tip();
@@ -238,19 +221,11 @@
var offsetBottom, offsetRight, tipOffset;
tipOffset = tip.offset();
offsetBottom = $(document).outerHeight() - tipOffset.top - $(tip).outerHeight();
- if (offsetBottom < 0) {
- tipOffset.top = tipOffset.top + offsetBottom;
- }
+ if (offsetBottom < 0) tipOffset.top = tipOffset.top + offsetBottom;
offsetRight = $(document).outerWidth() - tipOffset.left - $(tip).outerWidth();
- if (offsetRight < 0) {
- tipOffset.left = tipOffset.left + offsetRight;
- }
- if (tipOffset.top < 0) {
- tipOffset.top = 0;
- }
- if (tipOffset.left < 0) {
- tipOffset.left = 0;
- }
+ if (offsetRight < 0) tipOffset.left = tipOffset.left + offsetRight;
+ if (tipOffset.top < 0) tipOffset.top = 0;
+ if (tipOffset.left < 0) tipOffset.left = 0;
return tip.offset(tipOffset);
};
@@ -273,21 +248,15 @@
var _this = this;
if (this._options.keyboard) {
return $(document).on("keyup.bootstrap-tour", function(e) {
- if (!e.which) {
- return;
- }
+ if (!e.which) return;
switch (e.which) {
case 39:
e.preventDefault();
- if (_this._current < _this._steps.length - 1) {
- return _this.next();
- }
+ if (_this._current < _this._steps.length - 1) return _this.next();
break;
case 37:
e.preventDefault();
- if (_this._current > 0) {
- return _this.prev();
- }
+ if (_this._current > 0) return _this.prev();
}
});
}
Please sign in to comment.
Something went wrong with that request. Please try again.