Skip to content

Instantly share code, notes, and snippets.

@peteristhegreat
Last active November 13, 2024 23:40
Show Gist options
  • Save peteristhegreat/0678620341f6af725b23cd4cd395ec48 to your computer and use it in GitHub Desktop.
Save peteristhegreat/0678620341f6af725b23cd4cd395ec48 to your computer and use it in GitHub Desktop.
Bootstrap Tour, for Bootstrap v4.1, Popperjs

http://bootstraptour.com/

As of Sept 2018, the main project branch is still pointing at v3.3.7 of bootstrap.

There is an open pull request for v4 support here:

sorich87/bootstrap-tour#643

To get bootstrap tour to build with modern nodejs and without changing everything in the package json file, use this in linux:

git clone https://github.com/azizmashkour/bootstrap-tour.git
cd bootstrap-tour
npm install
cd node_modules
# Fix all the issues with the process.EventEmitter build errors (see other text file)
find . -type f -print0 | xargs -0 sed -i -e 's:process.EventEmitter:require("events"):g'
gulp build

The template is wrong for bootstrap v4.1 in the popover options. See Line 59:build/js/boostrap-tour.js

Before:

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-secondary" data-role="prev">&laquo; Prev</button> <button class="btn btn-sm btn-secondary" data-role="next">Next &raquo;</button> <button class="btn btn-sm btn-secondary" data-role="pause-resume" data-pause-text="Pause" data-resume-text="Resume">Pause</button> </div> <button class="btn btn-sm btn-secondary" data-role="end">End tour</button> </div> </div>',

After:

template: '<div class="popover" role="tooltip"> <div class="arrow"></div> <h3 class="popover-header"></h3> <div class="popover-body"></div> <div class="popover-navigation"> <div class="btn-group"> <button class="btn btn-sm btn-secondary" data-role="prev">&laquo; Prev</button> <button class="btn btn-sm btn-secondary" data-role="next">Next &raquo;</button> <button class="btn btn-sm btn-secondary" data-role="pause-resume" data-pause-text="Pause" data-resume-text="Resume">Pause</button> </div> <button class="btn btn-sm btn-secondary" data-role="end">End tour</button> </div> </div>',
//                                                                                           ^^^^^^                            ^^^^

sorich87/bootstrap-tour#643

I'll probably make a pull request to fix this sometime in the future.

The attached files are a release version that works.

Tested using bootstrap-4.1.3 and jquery 1.11.2 and popper.js 1.12.9

/* ========================================================================
* bootstrap-tour - v0.11.0
* http://bootstraptour.com
* ========================================================================
* Copyright 2012-2015 Ulrich Sossou
*
* ========================================================================
* Licensed under the MIT License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================================
*/
.tour-backdrop {
position: absolute;
z-index: 1100;
background-color: #000;
opacity: 0.8;
filter: alpha(opacity=80);
}
.popover[class*="tour-"] {
z-index: 1102;
}
.popover[class*="tour-"] .popover-navigation {
padding: 9px 14px;
overflow: hidden;
}
.popover[class*="tour-"] .popover-navigation *[data-role="end"] {
float: right;
}
.popover[class*="tour-"] .popover-navigation *[data-role="prev"],
.popover[class*="tour-"] .popover-navigation *[data-role="next"],
.popover[class*="tour-"] .popover-navigation *[data-role="end"] {
cursor: pointer;
}
.popover[class*="tour-"] .popover-navigation *[data-role="prev"].disabled,
.popover[class*="tour-"] .popover-navigation *[data-role="next"].disabled,
.popover[class*="tour-"] .popover-navigation *[data-role="end"].disabled {
cursor: default;
}
.popover[class*="tour-"].orphan {
position: fixed;
margin-top: 0;
}
.popover[class*="tour-"].orphan .arrow {
display: none;
}
/* ========================================================================
* bootstrap-tour - v0.11.0
* http://bootstraptour.com
* ========================================================================
* Copyright 2012-2015 Ulrich Sossou
*
* ========================================================================
* Licensed under the MIT License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================================
*/
(function(window, factory) {
if (typeof define === 'function' && define.amd) {
return define(['jquery'], function(jQuery) {
return window.Tour = factory(jQuery);
});
} else if (typeof exports === 'object') {
return module.exports = factory(require('jquery'));
} else {
return window.Tour = factory(window.jQuery);
}
})(window, function($) {
var Tour, document;
document = window.document;
Tour = (function() {
function Tour(options) {
var storage;
try {
storage = window.localStorage;
} catch (_error) {
storage = false;
}
this._options = $.extend({
name: 'tour',
steps: [],
container: 'body',
autoscroll: true,
keyboard: true,
storage: storage,
debug: false,
backdrop: false,
backdropContainer: 'body',
backdropPadding: 0,
redirect: true,
orphan: false,
duration: false,
delay: false,
basePath: '',
template: '<div class="popover" role="tooltip"> <div class="arrow"></div> <h3 class="popover-header"></h3> <div class="popover-body"></div> <div class="popover-navigation"> <div class="btn-group"> <button class="btn btn-sm btn-secondary" data-role="prev">&laquo; Prev</button> <button class="btn btn-sm btn-secondary" data-role="next">Next &raquo;</button> <button class="btn btn-sm btn-secondary" data-role="pause-resume" data-pause-text="Pause" data-resume-text="Resume">Pause</button> </div> <button class="btn btn-sm btn-secondary" data-role="end">End tour</button> </div> </div>',
afterSetState: function(key, value) {},
afterGetState: function(key, value) {},
afterRemoveState: function(key) {},
onStart: function(tour) {},
onEnd: function(tour) {},
onShow: function(tour) {},
onShown: function(tour) {},
onHide: function(tour) {},
onHidden: function(tour) {},
onNext: function(tour) {},
onPrev: function(tour) {},
onPause: function(tour, duration) {},
onResume: function(tour, duration) {},
onRedirectError: function(tour) {}
}, options);
this._force = false;
this._inited = false;
this._current = null;
this.backdrops = [];
this;
}
Tour.prototype.addSteps = function(steps) {
var step, _i, _len;
for (_i = 0, _len = steps.length; _i < _len; _i++) {
step = steps[_i];
this.addStep(step);
}
return this;
};
Tour.prototype.addStep = function(step) {
this._options.steps.push(step);
return this;
};
Tour.prototype.getStep = function(i) {
if (this._options.steps[i] != null) {
return $.extend({
id: "step-" + i,
path: '',
host: '',
placement: 'right',
title: '',
content: '<p></p>',
next: i === this._options.steps.length - 1 ? -1 : i + 1,
prev: i - 1,
animation: true,
container: this._options.container,
autoscroll: this._options.autoscroll,
backdrop: this._options.backdrop,
backdropContainer: this._options.backdropContainer,
backdropPadding: this._options.backdropPadding,
redirect: this._options.redirect,
reflexElement: this._options.steps[i].element,
backdropElement: this._options.steps[i].element,
orphan: this._options.orphan,
duration: this._options.duration,
delay: this._options.delay,
template: this._options.template,
onShow: this._options.onShow,
onShown: this._options.onShown,
onHide: this._options.onHide,
onHidden: this._options.onHidden,
onNext: this._options.onNext,
onPrev: this._options.onPrev,
onPause: this._options.onPause,
onResume: this._options.onResume,
onRedirectError: this._options.onRedirectError
}, this._options.steps[i]);
}
};
Tour.prototype.init = function(force) {
this._force = force;
if (this.ended()) {
this._debug('Tour ended, init prevented.');
return this;
}
this.setCurrentStep();
this._initMouseNavigation();
this._initKeyboardNavigation();
this._onResize((function(_this) {
return function() {
return _this.showStep(_this._current);
};
})(this));
if (this._current !== null) {
this.showStep(this._current);
}
this._inited = true;
return this;
};
Tour.prototype.start = function(force) {
var promise;
if (force == null) {
force = false;
}
if (!this._inited) {
this.init(force);
}
if (this._current === null) {
promise = this._makePromise(this._options.onStart != null ? this._options.onStart(this) : void 0);
this._callOnPromiseDone(promise, this.showStep, 0);
}
return this;
};
Tour.prototype.next = function() {
var promise;
promise = this.hideStep(this._current, this._current + 1);
return this._callOnPromiseDone(promise, this._showNextStep);
};
Tour.prototype.prev = function() {
var promise;
promise = this.hideStep(this._current, this._current - 1);
return this._callOnPromiseDone(promise, this._showPrevStep);
};
Tour.prototype.goTo = function(i) {
var promise;
promise = this.hideStep(this._current, i);
return this._callOnPromiseDone(promise, this.showStep, i);
};
Tour.prototype.end = function() {
var endHelper, promise;
endHelper = (function(_this) {
return function(e) {
$(document).off("click.tour-" + _this._options.name);
$(document).off("keyup.tour-" + _this._options.name);
$(window).off("resize.tour-" + _this._options.name);
_this._setState('end', 'yes');
_this._inited = false;
_this._force = false;
_this._clearTimer();
if (_this._options.onEnd != null) {
return _this._options.onEnd(_this);
}
};
})(this);
promise = this.hideStep(this._current);
return this._callOnPromiseDone(promise, endHelper);
};
Tour.prototype.ended = function() {
return !this._force && !!this._getState('end');
};
Tour.prototype.restart = function() {
this._removeState('current_step');
this._removeState('end');
this._removeState('redirect_to');
return this.start();
};
Tour.prototype.pause = function() {
var step;
step = this.getStep(this._current);
if (!(step && step.duration)) {
return this;
}
this._paused = true;
this._duration -= new Date().getTime() - this._start;
window.clearTimeout(this._timer);
this._debug("Paused/Stopped step " + (this._current + 1) + " timer (" + this._duration + " remaining).");
if (step.onPause != null) {
return step.onPause(this, this._duration);
}
};
Tour.prototype.resume = function() {
var step;
step = this.getStep(this._current);
if (!(step && step.duration)) {
return this;
}
this._paused = false;
this._start = new Date().getTime();
this._duration = this._duration || step.duration;
this._timer = window.setTimeout((function(_this) {
return function() {
if (_this._isLast()) {
return _this.next();
} else {
return _this.end();
}
};
})(this), this._duration);
this._debug("Started step " + (this._current + 1) + " timer with duration " + this._duration);
if ((step.onResume != null) && this._duration !== step.duration) {
return step.onResume(this, this._duration);
}
};
Tour.prototype.hideStep = function(i, iNext) {
var hideDelay, hideStepHelper, promise, step;
step = this.getStep(i);
if (!step) {
return;
}
this._clearTimer();
promise = this._makePromise(step.onHide != null ? step.onHide(this, i) : void 0);
hideStepHelper = (function(_this) {
return function(e) {
var $element, next_step;
$element = $(step.element);
if (!($element.data('bs.popover') || $element.data('popover'))) {
$element = $('body');
}
$element.popover('dispose').removeClass("tour-" + _this._options.name + "-element tour-" + _this._options.name + "-" + i + "-element").removeData('bs.popover').focus();
if (step.reflex) {
$(step.reflexElement).removeClass('tour-step-element-reflex').off("" + (_this._reflexEvent(step.reflex)) + ".tour-" + _this._options.name);
}
if (step.backdrop) {
next_step = (iNext != null) && _this.getStep(iNext);
if (!next_step || !next_step.backdrop || next_step.backdropElement !== step.backdropElement) {
_this._hideOverlayElement(step);
}
}
if (step.onHidden != null) {
return step.onHidden(_this);
}
};
})(this);
hideDelay = step.delay.hide || step.delay;
if ({}.toString.call(hideDelay) === '[object Number]' && hideDelay > 0) {
this._debug("Wait " + hideDelay + " milliseconds to hide the step " + (this._current + 1));
window.setTimeout((function(_this) {
return function() {
return _this._callOnPromiseDone(promise, hideStepHelper);
};
})(this), hideDelay);
} else {
this._callOnPromiseDone(promise, hideStepHelper);
}
return promise;
};
Tour.prototype.showStep = function(i) {
var path, promise, showDelay, showStepHelper, skipToPrevious, step;
if (this.ended()) {
this._debug('Tour ended, showStep prevented.');
return this;
}
step = this.getStep(i);
if (!step) {
return;
}
skipToPrevious = i < this._current;
promise = this._makePromise(step.onShow != null ? step.onShow(this, i) : void 0);
this.setCurrentStep(i);
path = (function() {
switch ({}.toString.call(step.path)) {
case '[object Function]':
return step.path();
case '[object String]':
return this._options.basePath + step.path;
default:
return step.path;
}
}).call(this);
if (step.redirect && this._isRedirect(step.host, path, document.location)) {
this._redirect(step, i, path);
if (!this._isJustPathHashDifferent(step.host, path, document.location)) {
return;
}
}
showStepHelper = (function(_this) {
return function(e) {
var showPopoverAndOverlay;
if (_this._isOrphan(step)) {
if (step.orphan === false) {
_this._debug("Skip the orphan step " + (_this._current + 1) + ".\nOrphan option is false and the element does not exist or is hidden.");
if (skipToPrevious) {
_this._showPrevStep();
} else {
_this._showNextStep();
}
return;
}
_this._debug("Show the orphan step " + (_this._current + 1) + ". Orphans option is true.");
}
showPopoverAndOverlay = function() {
if (_this.getCurrentStep() !== i || _this.ended()) {
return;
}
if (step.backdrop) {
_this._showOverlayElement(step);
}
_this._showPopover(step, i);
if (step.onShown != null) {
step.onShown(_this);
}
return _this._debug("Step " + (_this._current + 1) + " of " + _this._options.steps.length);
};
if (step.autoscroll) {
_this._scrollIntoView(step, showPopoverAndOverlay);
} else {
showPopoverAndOverlay();
}
if (step.duration) {
return _this.resume();
}
};
})(this);
showDelay = step.delay.show || step.delay;
if ({}.toString.call(showDelay) === '[object Number]' && showDelay > 0) {
this._debug("Wait " + showDelay + " milliseconds to show the step " + (this._current + 1));
window.setTimeout((function(_this) {
return function() {
return _this._callOnPromiseDone(promise, showStepHelper);
};
})(this), showDelay);
} else {
this._callOnPromiseDone(promise, showStepHelper);
}
return promise;
};
Tour.prototype.getCurrentStep = function() {
return this._current;
};
Tour.prototype.setCurrentStep = function(value) {
if (value != null) {
this._current = value;
this._setState('current_step', value);
} else {
this._current = this._getState('current_step');
this._current = this._current === null ? null : parseInt(this._current, 10);
}
return this;
};
Tour.prototype.redraw = function() {
return this._showOverlayElement(this.getStep(this.getCurrentStep()));
};
Tour.prototype._setState = function(key, value) {
var e, keyName;
if (this._options.storage) {
keyName = "" + this._options.name + "_" + key;
try {
this._options.storage.setItem(keyName, value);
} catch (_error) {
e = _error;
if (e.code === DOMException.QUOTA_EXCEEDED_ERR) {
this._debug('LocalStorage quota exceeded. State storage failed.');
}
}
return this._options.afterSetState(keyName, value);
} else {
if (this._state == null) {
this._state = {};
}
return this._state[key] = value;
}
};
Tour.prototype._removeState = function(key) {
var keyName;
if (this._options.storage) {
keyName = "" + this._options.name + "_" + key;
this._options.storage.removeItem(keyName);
return this._options.afterRemoveState(keyName);
} else {
if (this._state != null) {
return delete this._state[key];
}
}
};
Tour.prototype._getState = function(key) {
var keyName, value;
if (this._options.storage) {
keyName = "" + this._options.name + "_" + key;
value = this._options.storage.getItem(keyName);
} else {
if (this._state != null) {
value = this._state[key];
}
}
if (value === void 0 || value === 'null') {
value = null;
}
this._options.afterGetState(key, value);
return value;
};
Tour.prototype._showNextStep = function() {
var promise, showNextStepHelper, step;
step = this.getStep(this._current);
showNextStepHelper = (function(_this) {
return function(e) {
return _this.showStep(step.next);
};
})(this);
promise = this._makePromise(step.onNext != null ? step.onNext(this) : void 0);
return this._callOnPromiseDone(promise, showNextStepHelper);
};
Tour.prototype._showPrevStep = function() {
var promise, showPrevStepHelper, step;
step = this.getStep(this._current);
showPrevStepHelper = (function(_this) {
return function(e) {
return _this.showStep(step.prev);
};
})(this);
promise = this._makePromise(step.onPrev != null ? step.onPrev(this) : void 0);
return this._callOnPromiseDone(promise, showPrevStepHelper);
};
Tour.prototype._debug = function(text) {
if (this._options.debug) {
return window.console.log("Bootstrap Tour '" + this._options.name + "' | " + text);
}
};
Tour.prototype._isRedirect = function(host, path, location) {
var currentPath;
if ((host != null) && host !== '' && (({}.toString.call(host) === '[object RegExp]' && !host.test(location.origin)) || ({}.toString.call(host) === '[object String]' && this._isHostDifferent(host, location)))) {
return true;
}
currentPath = [location.pathname, location.search, location.hash].join('');
return (path != null) && path !== '' && (({}.toString.call(path) === '[object RegExp]' && !path.test(currentPath)) || ({}.toString.call(path) === '[object String]' && this._isPathDifferent(path, currentPath)));
};
Tour.prototype._isHostDifferent = function(host, location) {
switch ({}.toString.call(host)) {
case '[object RegExp]':
return !host.test(location.origin);
case '[object String]':
return this._getProtocol(host) !== this._getProtocol(location.href) || this._getHost(host) !== this._getHost(location.href);
default:
return true;
}
};
Tour.prototype._isPathDifferent = function(path, currentPath) {
return this._getPath(path) !== this._getPath(currentPath) || !this._equal(this._getQuery(path), this._getQuery(currentPath)) || !this._equal(this._getHash(path), this._getHash(currentPath));
};
Tour.prototype._isJustPathHashDifferent = function(host, path, location) {
var currentPath;
if ((host != null) && host !== '') {
if (this._isHostDifferent(host, location)) {
return false;
}
}
currentPath = [location.pathname, location.search, location.hash].join('');
if ({}.toString.call(path) === '[object String]') {
return this._getPath(path) === this._getPath(currentPath) && this._equal(this._getQuery(path), this._getQuery(currentPath)) && !this._equal(this._getHash(path), this._getHash(currentPath));
}
return false;
};
Tour.prototype._redirect = function(step, i, path) {
var href;
if ($.isFunction(step.redirect)) {
return step.redirect.call(this, path);
} else {
href = {}.toString.call(step.host) === '[object String]' ? "" + step.host + path : path;
this._debug("Redirect to " + href);
if (this._getState('redirect_to') === ("" + i)) {
this._debug("Error redirection loop to " + path);
this._removeState('redirect_to');
if (step.onRedirectError != null) {
return step.onRedirectError(this);
}
} else {
this._setState('redirect_to', "" + i);
return document.location.href = href;
}
}
};
Tour.prototype._isOrphan = function(step) {
return (step.element == null) || !$(step.element).length || $(step.element).is(':hidden') && ($(step.element)[0].namespaceURI !== 'http://www.w3.org/2000/svg');
};
Tour.prototype._isLast = function() {
return this._current < this._options.steps.length - 1;
};
Tour.prototype._showPopover = function(step, i) {
var $element, $tip, isOrphan, options, shouldAddSmart;
$(".tour-" + this._options.name).remove();
options = $.extend({}, this._options);
isOrphan = this._isOrphan(step);
step.template = this._template(step, i);
if (isOrphan) {
step.element = 'body';
step.placement = 'top';
}
$element = $(step.element);
$element.addClass("tour-" + this._options.name + "-element tour-" + this._options.name + "-" + i + "-element");
if (step.options) {
$.extend(options, step.options);
}
if (step.reflex && !isOrphan) {
$(step.reflexElement).addClass('tour-step-element-reflex').off("" + (this._reflexEvent(step.reflex)) + ".tour-" + this._options.name).on("" + (this._reflexEvent(step.reflex)) + ".tour-" + this._options.name, (function(_this) {
return function() {
if (_this._isLast()) {
return _this.next();
} else {
return _this.end();
}
};
})(this));
}
shouldAddSmart = step.smartPlacement === true && step.placement.search(/auto/i) === -1;
$element.popover({
placement: shouldAddSmart ? "auto " + step.placement : step.placement,
trigger: 'manual',
title: step.title,
content: step.content,
html: true,
animation: step.animation,
container: step.container,
template: step.template,
selector: step.element
}).popover('show');
$tip = $element.data('bs.popover').getTipElement();
$($tip).attr('id', step.id);
this._focus($($tip), $element, step.next < 0);
this._reposition($($tip), step);
if (isOrphan) {
return this._center($($tip));
}
};
Tour.prototype._template = function(step, i) {
var $navigation, $next, $prev, $resume, $template, template;
template = step.template;
if (this._isOrphan(step) && {}.toString.call(step.orphan) !== '[object Boolean]') {
template = step.orphan;
}
$template = $.isFunction(template) ? $(template(i, step)) : $(template);
$navigation = $template.find('.popover-navigation');
$prev = $navigation.find('[data-role="prev"]');
$next = $navigation.find('[data-role="next"]');
$resume = $navigation.find('[data-role="pause-resume"]');
if (this._isOrphan(step)) {
$template.addClass('orphan');
}
$template.addClass("tour-" + this._options.name + " tour-" + this._options.name + "-" + i);
if (step.reflex) {
$template.addClass("tour-" + this._options.name + "-reflex");
}
if (step.prev < 0) {
$prev.addClass('disabled').prop('disabled', true).prop('tabindex', -1);
}
if (step.next < 0) {
$next.addClass('disabled').prop('disabled', true).prop('tabindex', -1);
}
if (!step.duration) {
$resume.remove();
}
return $template.clone().wrap('<div>').parent().html();
};
Tour.prototype._reflexEvent = function(reflex) {
if ({}.toString.call(reflex) === '[object Boolean]') {
return 'click';
} else {
return reflex;
}
};
Tour.prototype._focus = function($tip, $element, end) {
var $next, role;
role = end ? 'end' : 'next';
$next = $($tip).find("[data-role='" + role + "']");
return $element.on('shown.bs.popover', function() {
return $next.focus();
});
};
Tour.prototype._reposition = function($tip, step) {
var offsetBottom, offsetHeight, offsetRight, offsetWidth, originalLeft, originalTop, tipOffset;
offsetWidth = $($tip)[0].offsetWidth;
offsetHeight = $($tip)[0].offsetHeight;
tipOffset = $($tip).offset();
originalLeft = tipOffset.left;
originalTop = tipOffset.top;
offsetBottom = $(document).outerHeight() - tipOffset.top - $($tip).outerHeight();
if (offsetBottom < 0) {
tipOffset.top = tipOffset.top + offsetBottom;
}
offsetRight = $('html').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;
}
$($tip).offset(tipOffset);
if (step.placement === 'bottom' || step.placement === 'top') {
if (originalLeft !== tipOffset.left) {
return this._replaceArrow($($tip), (tipOffset.left - originalLeft) * 2, offsetWidth, 'left');
}
} else {
if (originalTop !== tipOffset.top) {
return this._replaceArrow($($tip), (tipOffset.top - originalTop) * 2, offsetHeight, 'top');
}
}
};
Tour.prototype._center = function($tip) {
return $($tip).css('top', $(window).outerHeight() / 2 - $($tip).outerHeight() / 2);
};
Tour.prototype._replaceArrow = function($tip, delta, dimension, position) {
return $($tip).find('.arrow').css(position, delta ? 50 * (1 - delta / dimension) + '%' : '');
};
Tour.prototype._scrollIntoView = function(step, callback) {
var $element, $window, counter, height, offsetTop, scrollTop, windowHeight;
$element = $(step.element);
if (!$element.length) {
return callback();
}
$window = $(window);
offsetTop = $element.offset().top;
height = $element.outerHeight();
windowHeight = $window.height();
scrollTop = 0;
switch (step.placement) {
case 'top':
scrollTop = Math.max(0, offsetTop - (windowHeight / 2));
break;
case 'left':
case 'right':
scrollTop = Math.max(0, (offsetTop + height / 2) - (windowHeight / 2));
break;
case 'bottom':
scrollTop = Math.max(0, (offsetTop + height) - (windowHeight / 2));
}
this._debug("Scroll into view. ScrollTop: " + scrollTop + ". Element offset: " + offsetTop + ". Window height: " + windowHeight + ".");
counter = 0;
return $('body, html').stop(true, true).animate({
scrollTop: Math.ceil(scrollTop)
}, (function(_this) {
return function() {
if (++counter === 2) {
callback();
return _this._debug("Scroll into view.\nAnimation end element offset: " + ($element.offset().top) + ".\nWindow height: " + ($window.height()) + ".");
}
};
})(this));
};
Tour.prototype._onResize = function(callback, timeout) {
return $(window).on("resize.tour-" + this._options.name, function() {
clearTimeout(timeout);
return timeout = setTimeout(callback, 100);
});
};
Tour.prototype._initMouseNavigation = function() {
var _this;
_this = this;
return $(document).off("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='prev']").off("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='next']").off("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='end']").off("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='pause-resume']").on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='next']", (function(_this) {
return function(e) {
e.preventDefault();
return _this.next();
};
})(this)).on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='prev']", (function(_this) {
return function(e) {
e.preventDefault();
if (_this._current > 0) {
return _this.prev();
}
};
})(this)).on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='end']", (function(_this) {
return function(e) {
e.preventDefault();
return _this.end();
};
})(this)).on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='pause-resume']", function(e) {
var $this;
e.preventDefault();
$this = $(this);
$this.text(_this._paused ? $this.data('pause-text') : $this.data('resume-text'));
if (_this._paused) {
return _this.resume();
} else {
return _this.pause();
}
});
};
Tour.prototype._initKeyboardNavigation = function() {
if (!this._options.keyboard) {
return;
}
return $(document).on("keyup.tour-" + this._options.name, (function(_this) {
return function(e) {
if (!e.which) {
return;
}
switch (e.which) {
case 39:
e.preventDefault();
if (_this._isLast()) {
return _this.next();
} else {
return _this.end();
}
break;
case 37:
e.preventDefault();
if (_this._current > 0) {
return _this.prev();
}
}
};
})(this));
};
Tour.prototype._makePromise = function(result) {
if (result && $.isFunction(result.then)) {
return result;
} else {
return null;
}
};
Tour.prototype._callOnPromiseDone = function(promise, cb, arg) {
if (promise) {
return promise.then((function(_this) {
return function(e) {
return cb.call(_this, arg);
};
})(this));
} else {
return cb.call(this, arg);
}
};
Tour.prototype._showBackground = function(step, data) {
var $backdrop, height, pos, width, _base, _i, _len, _ref, _results;
height = $(document).height();
width = $(document).width();
_ref = ['top', 'bottom', 'left', 'right'];
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
pos = _ref[_i];
$backdrop = (_base = this.backdrops)[pos] != null ? _base[pos] : _base[pos] = $('<div>', {
"class": "tour-backdrop " + pos
});
$(step.backdropContainer).append($backdrop);
switch (pos) {
case 'top':
_results.push($backdrop.height(data.offset.top > 0 ? data.offset.top : 0).width(width).offset({
top: 0,
left: 0
}));
break;
case 'bottom':
_results.push($backdrop.offset({
top: data.offset.top + data.height,
left: 0
}).height(height - (data.offset.top + data.height)).width(width));
break;
case 'left':
_results.push($backdrop.offset({
top: data.offset.top,
left: 0
}).height(data.height).width(data.offset.left > 0 ? data.offset.left : 0));
break;
case 'right':
_results.push($backdrop.offset({
top: data.offset.top,
left: data.offset.left + data.width
}).height(data.height).width(width - (data.offset.left + data.width)));
break;
default:
_results.push(void 0);
}
}
return _results;
};
Tour.prototype._showOverlayElement = function(step) {
var $backdropElement, elementData;
$backdropElement = $(step.backdropElement);
if ($backdropElement.length === 0) {
elementData = {
width: 0,
height: 0,
offset: {
top: 0,
left: 0
}
};
} else {
elementData = {
width: $backdropElement.innerWidth(),
height: $backdropElement.innerHeight(),
offset: $backdropElement.offset()
};
$backdropElement.addClass('tour-step-backdrop');
if (step.backdropPadding) {
elementData = this._applyBackdropPadding(step.backdropPadding, elementData);
}
}
return this._showBackground(step, elementData);
};
Tour.prototype._hideOverlayElement = function(step) {
var $backdrop, pos, _ref;
$(step.backdropElement).removeClass('tour-step-backdrop');
_ref = this.backdrops;
for (pos in _ref) {
$backdrop = _ref[pos];
if ($backdrop && $backdrop.remove !== void 0) {
$backdrop.remove();
}
}
return this.backdrops = [];
};
Tour.prototype._applyBackdropPadding = function(padding, data) {
if (typeof padding === 'object') {
if (padding.top == null) {
padding.top = 0;
}
if (padding.right == null) {
padding.right = 0;
}
if (padding.bottom == null) {
padding.bottom = 0;
}
if (padding.left == null) {
padding.left = 0;
}
data.offset.top = data.offset.top - padding.top;
data.offset.left = data.offset.left - padding.left;
data.width = data.width + padding.left + padding.right;
data.height = data.height + padding.top + padding.bottom;
} else {
data.offset.top = data.offset.top - padding;
data.offset.left = data.offset.left - padding;
data.width = data.width + (padding * 2);
data.height = data.height + (padding * 2);
}
return data;
};
Tour.prototype._clearTimer = function() {
window.clearTimeout(this._timer);
this._timer = null;
return this._duration = null;
};
Tour.prototype._getProtocol = function(url) {
url = url.split('://');
if (url.length > 1) {
return url[0];
} else {
return 'http';
}
};
Tour.prototype._getHost = function(url) {
url = url.split('//');
url = url.length > 1 ? url[1] : url[0];
return url.split('/')[0];
};
Tour.prototype._getPath = function(path) {
return path.replace(/\/?$/, '').split('?')[0].split('#')[0];
};
Tour.prototype._getQuery = function(path) {
return this._getParams(path, '?');
};
Tour.prototype._getHash = function(path) {
return this._getParams(path, '#');
};
Tour.prototype._getParams = function(path, start) {
var param, params, paramsObject, _i, _len;
params = path.split(start);
if (params.length === 1) {
return {};
}
params = params[1].split('&');
paramsObject = {};
for (_i = 0, _len = params.length; _i < _len; _i++) {
param = params[_i];
param = param.split('=');
paramsObject[param[0]] = param[1] || '';
}
return paramsObject;
};
Tour.prototype._equal = function(obj1, obj2) {
var k, obj1Keys, obj2Keys, v, _i, _len;
if ({}.toString.call(obj1) === '[object Object]' && {}.toString.call(obj2) === '[object Object]') {
obj1Keys = Object.keys(obj1);
obj2Keys = Object.keys(obj2);
if (obj1Keys.length !== obj2Keys.length) {
return false;
}
for (k in obj1) {
v = obj1[k];
if (!this._equal(obj2[k], v)) {
return false;
}
}
return true;
} else if ({}.toString.call(obj1) === '[object Array]' && {}.toString.call(obj2) === '[object Array]') {
if (obj1.length !== obj2.length) {
return false;
}
for (k = _i = 0, _len = obj1.length; _i < _len; k = ++_i) {
v = obj1[k];
if (!this._equal(v, obj2[k])) {
return false;
}
}
return true;
} else {
return obj1 === obj2;
}
};
return Tour;
})();
return Tour;
});
/* ========================================================================
* bootstrap-tour - v0.11.0
* http://bootstraptour.com
* ========================================================================
* Copyright 2012-2015 Ulrich Sossou
*
* ========================================================================
* Licensed under the MIT License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================================
*/
.tour-backdrop{position:absolute;z-index:1100;background-color:#000;opacity:.8;filter:alpha(opacity=80)}.popover[class*=tour-]{z-index:1102}.popover[class*=tour-] .popover-navigation{padding:9px 14px;overflow:hidden}.popover[class*=tour-] .popover-navigation [data-role=end]{float:right}.popover[class*=tour-] .popover-navigation [data-role=prev],.popover[class*=tour-] .popover-navigation [data-role=next],.popover[class*=tour-] .popover-navigation [data-role=end]{cursor:pointer}.popover[class*=tour-] .popover-navigation [data-role=prev].disabled,.popover[class*=tour-] .popover-navigation [data-role=next].disabled,.popover[class*=tour-] .popover-navigation [data-role=end].disabled{cursor:default}.popover[class*=tour-].orphan{position:fixed;margin-top:0}.popover[class*=tour-].orphan .arrow{display:none}
/* ========================================================================
* bootstrap-tour - v0.11.0
* http://bootstraptour.com
* ========================================================================
* Copyright 2012-2015 Ulrich Sossou
*
* ========================================================================
* Licensed under the MIT License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================================
*/
!function(t,e){return"function"==typeof define&&define.amd?define(["jquery"],function(o){return t.Tour=e(o)}):"object"==typeof exports?module.exports=e(require("jquery")):t.Tour=e(t.jQuery)}(window,function(t){var e,o;return o=window.document,e=function(){function e(e){var o;try{o=window.localStorage}catch(n){o=!1}this._options=t.extend({name:"tour",steps:[],container:"body",autoscroll:!0,keyboard:!0,storage:o,debug:!1,backdrop:!1,backdropContainer:"body",backdropPadding:0,redirect:!0,orphan:!1,duration:!1,delay:!1,basePath:"",template:'<div class="popover" role="tooltip"> <div class="arrow"></div> <h3 class="popover-header"></h3> <div class="popover-body"></div> <div class="popover-navigation"> <div class="btn-group"> <button class="btn btn-sm btn-secondary" data-role="prev">&laquo; Prev</button> <button class="btn btn-sm btn-secondary" data-role="next">Next &raquo;</button> <button class="btn btn-sm btn-secondary" data-role="pause-resume" data-pause-text="Pause" data-resume-text="Resume">Pause</button> </div> <button class="btn btn-sm btn-secondary" data-role="end">End tour</button> </div> </div>',afterSetState:function(){},afterGetState:function(){},afterRemoveState:function(){},onStart:function(){},onEnd:function(){},onShow:function(){},onShown:function(){},onHide:function(){},onHidden:function(){},onNext:function(){},onPrev:function(){},onPause:function(){},onResume:function(){},onRedirectError:function(){}},e),this._force=!1,this._inited=!1,this._current=null,this.backdrops=[]}return e.prototype.addSteps=function(t){var e,o,n;for(o=0,n=t.length;n>o;o++)e=t[o],this.addStep(e);return this},e.prototype.addStep=function(t){return this._options.steps.push(t),this},e.prototype.getStep=function(e){return null!=this._options.steps[e]?t.extend({id:"step-"+e,path:"",host:"",placement:"right",title:"",content:"<p></p>",next:e===this._options.steps.length-1?-1:e+1,prev:e-1,animation:!0,container:this._options.container,autoscroll:this._options.autoscroll,backdrop:this._options.backdrop,backdropContainer:this._options.backdropContainer,backdropPadding:this._options.backdropPadding,redirect:this._options.redirect,reflexElement:this._options.steps[e].element,backdropElement:this._options.steps[e].element,orphan:this._options.orphan,duration:this._options.duration,delay:this._options.delay,template:this._options.template,onShow:this._options.onShow,onShown:this._options.onShown,onHide:this._options.onHide,onHidden:this._options.onHidden,onNext:this._options.onNext,onPrev:this._options.onPrev,onPause:this._options.onPause,onResume:this._options.onResume,onRedirectError:this._options.onRedirectError},this._options.steps[e]):void 0},e.prototype.init=function(t){return this._force=t,this.ended()?(this._debug("Tour ended, init prevented."),this):(this.setCurrentStep(),this._initMouseNavigation(),this._initKeyboardNavigation(),this._onResize(function(t){return function(){return t.showStep(t._current)}}(this)),null!==this._current&&this.showStep(this._current),this._inited=!0,this)},e.prototype.start=function(t){var e;return null==t&&(t=!1),this._inited||this.init(t),null===this._current&&(e=this._makePromise(null!=this._options.onStart?this._options.onStart(this):void 0),this._callOnPromiseDone(e,this.showStep,0)),this},e.prototype.next=function(){var t;return t=this.hideStep(this._current,this._current+1),this._callOnPromiseDone(t,this._showNextStep)},e.prototype.prev=function(){var t;return t=this.hideStep(this._current,this._current-1),this._callOnPromiseDone(t,this._showPrevStep)},e.prototype.goTo=function(t){var e;return e=this.hideStep(this._current,t),this._callOnPromiseDone(e,this.showStep,t)},e.prototype.end=function(){var e,n;return e=function(e){return function(){return t(o).off("click.tour-"+e._options.name),t(o).off("keyup.tour-"+e._options.name),t(window).off("resize.tour-"+e._options.name),e._setState("end","yes"),e._inited=!1,e._force=!1,e._clearTimer(),null!=e._options.onEnd?e._options.onEnd(e):void 0}}(this),n=this.hideStep(this._current),this._callOnPromiseDone(n,e)},e.prototype.ended=function(){return!this._force&&!!this._getState("end")},e.prototype.restart=function(){return this._removeState("current_step"),this._removeState("end"),this._removeState("redirect_to"),this.start()},e.prototype.pause=function(){var t;return t=this.getStep(this._current),t&&t.duration?(this._paused=!0,this._duration-=(new Date).getTime()-this._start,window.clearTimeout(this._timer),this._debug("Paused/Stopped step "+(this._current+1)+" timer ("+this._duration+" remaining)."),null!=t.onPause?t.onPause(this,this._duration):void 0):this},e.prototype.resume=function(){var t;return t=this.getStep(this._current),t&&t.duration?(this._paused=!1,this._start=(new Date).getTime(),this._duration=this._duration||t.duration,this._timer=window.setTimeout(function(t){return function(){return t._isLast()?t.next():t.end()}}(this),this._duration),this._debug("Started step "+(this._current+1)+" timer with duration "+this._duration),null!=t.onResume&&this._duration!==t.duration?t.onResume(this,this._duration):void 0):this},e.prototype.hideStep=function(e,o){var n,i,r,s;return(s=this.getStep(e))?(this._clearTimer(),r=this._makePromise(null!=s.onHide?s.onHide(this,e):void 0),i=function(n){return function(){var i,r;return i=t(s.element),i.data("bs.popover")||i.data("popover")||(i=t("body")),i.popover("dispose").removeClass("tour-"+n._options.name+"-element tour-"+n._options.name+"-"+e+"-element").removeData("bs.popover").focus(),s.reflex&&t(s.reflexElement).removeClass("tour-step-element-reflex").off(""+n._reflexEvent(s.reflex)+".tour-"+n._options.name),s.backdrop&&(r=null!=o&&n.getStep(o),r&&r.backdrop&&r.backdropElement===s.backdropElement||n._hideOverlayElement(s)),null!=s.onHidden?s.onHidden(n):void 0}}(this),n=s.delay.hide||s.delay,"[object Number]"==={}.toString.call(n)&&n>0?(this._debug("Wait "+n+" milliseconds to hide the step "+(this._current+1)),window.setTimeout(function(t){return function(){return t._callOnPromiseDone(r,i)}}(this),n)):this._callOnPromiseDone(r,i),r):void 0},e.prototype.showStep=function(t){var e,n,i,r,s,a;return this.ended()?(this._debug("Tour ended, showStep prevented."),this):(a=this.getStep(t),a&&(s=t<this._current,n=this._makePromise(null!=a.onShow?a.onShow(this,t):void 0),this.setCurrentStep(t),e=function(){switch({}.toString.call(a.path)){case"[object Function]":return a.path();case"[object String]":return this._options.basePath+a.path;default:return a.path}}.call(this),!a.redirect||!this._isRedirect(a.host,e,o.location)||(this._redirect(a,t,e),this._isJustPathHashDifferent(a.host,e,o.location)))?(r=function(e){return function(){var o;if(e._isOrphan(a)){if(a.orphan===!1)return e._debug("Skip the orphan step "+(e._current+1)+".\nOrphan option is false and the element does not exist or is hidden."),s?e._showPrevStep():e._showNextStep(),void 0;e._debug("Show the orphan step "+(e._current+1)+". Orphans option is true.")}return o=function(){return e.getCurrentStep()!==t||e.ended()?void 0:(a.backdrop&&e._showOverlayElement(a),e._showPopover(a,t),null!=a.onShown&&a.onShown(e),e._debug("Step "+(e._current+1)+" of "+e._options.steps.length))},a.autoscroll?e._scrollIntoView(a,o):o(),a.duration?e.resume():void 0}}(this),i=a.delay.show||a.delay,"[object Number]"==={}.toString.call(i)&&i>0?(this._debug("Wait "+i+" milliseconds to show the step "+(this._current+1)),window.setTimeout(function(t){return function(){return t._callOnPromiseDone(n,r)}}(this),i)):this._callOnPromiseDone(n,r),n):void 0)},e.prototype.getCurrentStep=function(){return this._current},e.prototype.setCurrentStep=function(t){return null!=t?(this._current=t,this._setState("current_step",t)):(this._current=this._getState("current_step"),this._current=null===this._current?null:parseInt(this._current,10)),this},e.prototype.redraw=function(){return this._showOverlayElement(this.getStep(this.getCurrentStep()))},e.prototype._setState=function(t,e){var o,n;if(this._options.storage){n=""+this._options.name+"_"+t;try{this._options.storage.setItem(n,e)}catch(i){o=i,o.code===DOMException.QUOTA_EXCEEDED_ERR&&this._debug("LocalStorage quota exceeded. State storage failed.")}return this._options.afterSetState(n,e)}return null==this._state&&(this._state={}),this._state[t]=e},e.prototype._removeState=function(t){var e;return this._options.storage?(e=""+this._options.name+"_"+t,this._options.storage.removeItem(e),this._options.afterRemoveState(e)):null!=this._state?delete this._state[t]:void 0},e.prototype._getState=function(t){var e,o;return this._options.storage?(e=""+this._options.name+"_"+t,o=this._options.storage.getItem(e)):null!=this._state&&(o=this._state[t]),(void 0===o||"null"===o)&&(o=null),this._options.afterGetState(t,o),o},e.prototype._showNextStep=function(){var t,e,o;return o=this.getStep(this._current),e=function(t){return function(){return t.showStep(o.next)}}(this),t=this._makePromise(null!=o.onNext?o.onNext(this):void 0),this._callOnPromiseDone(t,e)},e.prototype._showPrevStep=function(){var t,e,o;return o=this.getStep(this._current),e=function(t){return function(){return t.showStep(o.prev)}}(this),t=this._makePromise(null!=o.onPrev?o.onPrev(this):void 0),this._callOnPromiseDone(t,e)},e.prototype._debug=function(t){return this._options.debug?window.console.log("Bootstrap Tour '"+this._options.name+"' | "+t):void 0},e.prototype._isRedirect=function(t,e,o){var n;return null!=t&&""!==t&&("[object RegExp]"==={}.toString.call(t)&&!t.test(o.origin)||"[object String]"==={}.toString.call(t)&&this._isHostDifferent(t,o))?!0:(n=[o.pathname,o.search,o.hash].join(""),null!=e&&""!==e&&("[object RegExp]"==={}.toString.call(e)&&!e.test(n)||"[object String]"==={}.toString.call(e)&&this._isPathDifferent(e,n)))},e.prototype._isHostDifferent=function(t,e){switch({}.toString.call(t)){case"[object RegExp]":return!t.test(e.origin);case"[object String]":return this._getProtocol(t)!==this._getProtocol(e.href)||this._getHost(t)!==this._getHost(e.href);default:return!0}},e.prototype._isPathDifferent=function(t,e){return this._getPath(t)!==this._getPath(e)||!this._equal(this._getQuery(t),this._getQuery(e))||!this._equal(this._getHash(t),this._getHash(e))},e.prototype._isJustPathHashDifferent=function(t,e,o){var n;return null!=t&&""!==t&&this._isHostDifferent(t,o)?!1:(n=[o.pathname,o.search,o.hash].join(""),"[object String]"==={}.toString.call(e)?this._getPath(e)===this._getPath(n)&&this._equal(this._getQuery(e),this._getQuery(n))&&!this._equal(this._getHash(e),this._getHash(n)):!1)},e.prototype._redirect=function(e,n,i){var r;return t.isFunction(e.redirect)?e.redirect.call(this,i):(r="[object String]"==={}.toString.call(e.host)?""+e.host+i:i,this._debug("Redirect to "+r),this._getState("redirect_to")!==""+n?(this._setState("redirect_to",""+n),o.location.href=r):(this._debug("Error redirection loop to "+i),this._removeState("redirect_to"),null!=e.onRedirectError?e.onRedirectError(this):void 0))},e.prototype._isOrphan=function(e){return null==e.element||!t(e.element).length||t(e.element).is(":hidden")&&"http://www.w3.org/2000/svg"!==t(e.element)[0].namespaceURI},e.prototype._isLast=function(){return this._current<this._options.steps.length-1},e.prototype._showPopover=function(e,o){var n,i,r,s,a;return t(".tour-"+this._options.name).remove(),s=t.extend({},this._options),r=this._isOrphan(e),e.template=this._template(e,o),r&&(e.element="body",e.placement="top"),n=t(e.element),n.addClass("tour-"+this._options.name+"-element tour-"+this._options.name+"-"+o+"-element"),e.options&&t.extend(s,e.options),e.reflex&&!r&&t(e.reflexElement).addClass("tour-step-element-reflex").off(""+this._reflexEvent(e.reflex)+".tour-"+this._options.name).on(""+this._reflexEvent(e.reflex)+".tour-"+this._options.name,function(t){return function(){return t._isLast()?t.next():t.end()}}(this)),a=e.smartPlacement===!0&&-1===e.placement.search(/auto/i),n.popover({placement:a?"auto "+e.placement:e.placement,trigger:"manual",title:e.title,content:e.content,html:!0,animation:e.animation,container:e.container,template:e.template,selector:e.element}).popover("show"),i=n.data("bs.popover").getTipElement(),t(i).attr("id",e.id),this._focus(t(i),n,e.next<0),this._reposition(t(i),e),r?this._center(t(i)):void 0},e.prototype._template=function(e,o){var n,i,r,s,a,u;return u=e.template,this._isOrphan(e)&&"[object Boolean]"!=={}.toString.call(e.orphan)&&(u=e.orphan),a=t.isFunction(u)?t(u(o,e)):t(u),n=a.find(".popover-navigation"),r=n.find('[data-role="prev"]'),i=n.find('[data-role="next"]'),s=n.find('[data-role="pause-resume"]'),this._isOrphan(e)&&a.addClass("orphan"),a.addClass("tour-"+this._options.name+" tour-"+this._options.name+"-"+o),e.reflex&&a.addClass("tour-"+this._options.name+"-reflex"),e.prev<0&&r.addClass("disabled").prop("disabled",!0).prop("tabindex",-1),e.next<0&&i.addClass("disabled").prop("disabled",!0).prop("tabindex",-1),e.duration||s.remove(),a.clone().wrap("<div>").parent().html()},e.prototype._reflexEvent=function(t){return"[object Boolean]"==={}.toString.call(t)?"click":t},e.prototype._focus=function(e,o,n){var i,r;return r=n?"end":"next",i=t(e).find("[data-role='"+r+"']"),o.on("shown.bs.popover",function(){return i.focus()})},e.prototype._reposition=function(e,n){var i,r,s,a,u,p,h;if(a=t(e)[0].offsetWidth,r=t(e)[0].offsetHeight,h=t(e).offset(),u=h.left,p=h.top,i=t(o).outerHeight()-h.top-t(e).outerHeight(),0>i&&(h.top=h.top+i),s=t("html").outerWidth()-h.left-t(e).outerWidth(),0>s&&(h.left=h.left+s),h.top<0&&(h.top=0),h.left<0&&(h.left=0),t(e).offset(h),"bottom"===n.placement||"top"===n.placement){if(u!==h.left)return this._replaceArrow(t(e),2*(h.left-u),a,"left")}else if(p!==h.top)return this._replaceArrow(t(e),2*(h.top-p),r,"top")},e.prototype._center=function(e){return t(e).css("top",t(window).outerHeight()/2-t(e).outerHeight()/2)},e.prototype._replaceArrow=function(e,o,n,i){return t(e).find(".arrow").css(i,o?50*(1-o/n)+"%":"")},e.prototype._scrollIntoView=function(e,o){var n,i,r,s,a,u,p;if(n=t(e.element),!n.length)return o();switch(i=t(window),a=n.offset().top,s=n.outerHeight(),p=i.height(),u=0,e.placement){case"top":u=Math.max(0,a-p/2);break;case"left":case"right":u=Math.max(0,a+s/2-p/2);break;case"bottom":u=Math.max(0,a+s-p/2)}return this._debug("Scroll into view. ScrollTop: "+u+". Element offset: "+a+". Window height: "+p+"."),r=0,t("body, html").stop(!0,!0).animate({scrollTop:Math.ceil(u)},function(t){return function(){return 2===++r?(o(),t._debug("Scroll into view.\nAnimation end element offset: "+n.offset().top+".\nWindow height: "+i.height()+".")):void 0}}(this))},e.prototype._onResize=function(e,o){return t(window).on("resize.tour-"+this._options.name,function(){return clearTimeout(o),o=setTimeout(e,100)})},e.prototype._initMouseNavigation=function(){var e;return e=this,t(o).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='prev']").off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='next']").off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='end']").off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='pause-resume']").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='next']",function(t){return function(e){return e.preventDefault(),t.next()}}(this)).on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='prev']",function(t){return function(e){return e.preventDefault(),t._current>0?t.prev():void 0}}(this)).on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='end']",function(t){return function(e){return e.preventDefault(),t.end()}}(this)).on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='pause-resume']",function(o){var n;return o.preventDefault(),n=t(this),n.text(e._paused?n.data("pause-text"):n.data("resume-text")),e._paused?e.resume():e.pause()})},e.prototype._initKeyboardNavigation=function(){return this._options.keyboard?t(o).on("keyup.tour-"+this._options.name,function(t){return function(e){if(e.which)switch(e.which){case 39:return e.preventDefault(),t._isLast()?t.next():t.end();case 37:if(e.preventDefault(),t._current>0)return t.prev()}}}(this)):void 0},e.prototype._makePromise=function(e){return e&&t.isFunction(e.then)?e:null},e.prototype._callOnPromiseDone=function(t,e,o){return t?t.then(function(t){return function(){return e.call(t,o)}}(this)):e.call(this,o)},e.prototype._showBackground=function(e,n){var i,r,s,a,u,p,h,l,c;for(r=t(o).height(),a=t(o).width(),l=["top","bottom","left","right"],c=[],p=0,h=l.length;h>p;p++)switch(s=l[p],i=null!=(u=this.backdrops)[s]?u[s]:u[s]=t("<div>",{"class":"tour-backdrop "+s}),t(e.backdropContainer).append(i),s){case"top":c.push(i.height(n.offset.top>0?n.offset.top:0).width(a).offset({top:0,left:0}));break;case"bottom":c.push(i.offset({top:n.offset.top+n.height,left:0}).height(r-(n.offset.top+n.height)).width(a));break;case"left":c.push(i.offset({top:n.offset.top,left:0}).height(n.height).width(n.offset.left>0?n.offset.left:0));break;case"right":c.push(i.offset({top:n.offset.top,left:n.offset.left+n.width}).height(n.height).width(a-(n.offset.left+n.width)));break;default:c.push(void 0)}return c},e.prototype._showOverlayElement=function(e){var o,n;return o=t(e.backdropElement),0===o.length?n={width:0,height:0,offset:{top:0,left:0}}:(n={width:o.innerWidth(),height:o.innerHeight(),offset:o.offset()},o.addClass("tour-step-backdrop"),e.backdropPadding&&(n=this._applyBackdropPadding(e.backdropPadding,n))),this._showBackground(e,n)},e.prototype._hideOverlayElement=function(e){var o,n,i;t(e.backdropElement).removeClass("tour-step-backdrop"),i=this.backdrops;for(n in i)o=i[n],o&&void 0!==o.remove&&o.remove();return this.backdrops=[]},e.prototype._applyBackdropPadding=function(t,e){return"object"==typeof t?(null==t.top&&(t.top=0),null==t.right&&(t.right=0),null==t.bottom&&(t.bottom=0),null==t.left&&(t.left=0),e.offset.top=e.offset.top-t.top,e.offset.left=e.offset.left-t.left,e.width=e.width+t.left+t.right,e.height=e.height+t.top+t.bottom):(e.offset.top=e.offset.top-t,e.offset.left=e.offset.left-t,e.width=e.width+2*t,e.height=e.height+2*t),e},e.prototype._clearTimer=function(){return window.clearTimeout(this._timer),this._timer=null,this._duration=null},e.prototype._getProtocol=function(t){return t=t.split("://"),t.length>1?t[0]:"http"},e.prototype._getHost=function(t){return t=t.split("//"),t=t.length>1?t[1]:t[0],t.split("/")[0]},e.prototype._getPath=function(t){return t.replace(/\/?$/,"").split("?")[0].split("#")[0]},e.prototype._getQuery=function(t){return this._getParams(t,"?")},e.prototype._getHash=function(t){return this._getParams(t,"#")},e.prototype._getParams=function(t,e){var o,n,i,r,s;if(n=t.split(e),1===n.length)return{};for(n=n[1].split("&"),i={},r=0,s=n.length;s>r;r++)o=n[r],o=o.split("="),i[o[0]]=o[1]||"";return i},e.prototype._equal=function(t,e){var o,n,i,r,s,a;if("[object Object]"==={}.toString.call(t)&&"[object Object]"==={}.toString.call(e)){if(n=Object.keys(t),i=Object.keys(e),n.length!==i.length)return!1;for(o in t)if(r=t[o],!this._equal(e[o],r))return!1;return!0}if("[object Array]"==={}.toString.call(t)&&"[object Array]"==={}.toString.call(e)){if(t.length!==e.length)return!1;for(o=s=0,a=t.length;a>s;o=++s)if(r=t[o],!this._equal(r,e[o]))return!1;return!0}return t===e},e}()});
Store.prototype.__proto__ = EventEmitter.prototype;
^
TypeError: Cannot read property 'prototype' of undefined
at Object.<anonymous> (/home/m315599/PycharmProjects/repair_dashboard/app/static/vendor-lib/bootstrap-tour-p/node_modules/socket.io/lib/store.js:35:42)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (/home/m315599/PycharmProjects/repair_dashboard/app/static/vendor-lib/bootstrap-tour-p/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/m315599/PycharmProjects/repair_dashboard/app/static/vendor-lib/bootstrap-tour-p/node_modules/socket.io/lib/manager.js:16:13)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (/home/m315599/PycharmProjects/repair_dashboard/app/static/vendor-lib/bootstrap-tour-p/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/m315599/PycharmProjects/repair_dashboard/app/static/vendor-lib/bootstrap-tour-p/node_modules/socket.io/lib/socket.io.js:87:19)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (/home/m315599/PycharmProjects/repair_dashboard/app/static/vendor-lib/bootstrap-tour-p/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/m315599/PycharmProjects/repair_dashboard/app/static/vendor-lib/bootstrap-tour-p/node_modules/socket.io/index.js:8:18)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (/home/m315599/PycharmProjects/repair_dashboard/app/static/vendor-lib/bootstrap-tour-p/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/m315599/PycharmProjects/repair_dashboard/app/static/vendor-lib/bootstrap-tour-p/node_modules/karma/lib/server.js:1:72)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (/home/m315599/PycharmProjects/repair_dashboard/app/static/vendor-lib/bootstrap-tour-p/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/m315599/PycharmProjects/repair_dashboard/app/static/vendor-lib/bootstrap-tour-p/node_modules/karma/lib/index.js:3:18)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (/home/m315599/PycharmProjects/repair_dashboard/app/static/vendor-lib/bootstrap-tour-p/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/m315599/PycharmProjects/repair_dashboard/app/static/vendor-lib/bootstrap-tour-p/node_modules/gulp-karma/index.js:12:14)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (/home/m315599/PycharmProjects/repair_dashboard/app/static/vendor-lib/bootstrap-tour-p/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at /home/m315599/PycharmProjects/repair_dashboard/app/static/vendor-lib/bootstrap-tour-p/node_modules/gulp-load-plugins/index.js:52:34
at Array.forEach (<anonymous>:null:null)
at module.exports (/home/m315599/PycharmProjects/repair_dashboard/app/static/vendor-lib/bootstrap-tour-p/node_modules/gulp-load-plugins/index.js:41:30)
at Object.<anonymous> (/home/m315599/PycharmProjects/repair_dashboard/app/static/vendor-lib/bootstrap-tour-p/gulpfile.coffee:2:5)
at Object.<anonymous> (/home/m315599/PycharmProjects/repair_dashboard/app/static/vendor-lib/bootstrap-tour-p/gulpfile.coffee:1:1)
at Module._compile (module.js:660:30)
at Object.loadFile (/home/m315599/PycharmProjects/repair_dashboard/app/static/vendor-lib/bootstrap-tour-p/node_modules/coffee-script/lib/coffee-script/register.js:16:19)
at Module.load (/home/m315599/PycharmProjects/repair_dashboard/app/static/vendor-lib/bootstrap-tour-p/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/m315599/PycharmProjects/repair_dashboard/app/static/vendor-lib/bootstrap-tour-p/gulpfile.js:2:1)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Liftoff.handleArguments (/pw/devl/share/gse/tools/usr/lib/node_modules/gulp/bin/gulp.js:116:3)
at Liftoff.execute (/pw/devl/share/gse/tools/usr/lib/node_modules/gulp/node_modules/liftoff/index.js:203:12)
at module.exports (/pw/devl/share/gse/tools/usr/lib/node_modules/gulp/node_modules/flagged-respawn/index.js:51:3)
at Liftoff.<anonymous> (/pw/devl/share/gse/tools/usr/lib/node_modules/gulp/node_modules/liftoff/index.js:195:5)
at /pw/devl/share/gse/tools/usr/lib/node_modules/gulp/node_modules/liftoff/index.js:165:9
at /pw/devl/share/gse/tools/usr/lib/node_modules/gulp/node_modules/v8flags/index.js:110:14
at /pw/devl/share/gse/tools/usr/lib/node_modules/gulp/node_modules/v8flags/index.js:38:12
at /pw/devl/share/gse/tools/usr/lib/node_modules/gulp/node_modules/v8flags/index.js:49:7
at process._tickCallback (internal/process/next_tick.js:150:11)
at Function.Module.runMain (module.js:703:11)
at startup (bootstrap_node.js:194:16)
at bootstrap_node.js:618:3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment