You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
17 KiB

!function(a,b){"function"==typeof define&&define.amd?define(["jquery","core/popper"],function(c,d){return a.Tour=b(c,d)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery"),require("popper.js")):a.Tour=b(a.$,a.Popper)}(this,function(a,b){"use strict";function c(a){this.init(a)}var d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};return c.prototype.tourName,c.prototype.storageKey,c.prototype.storage,c.prototype.originalConfiguration,c.prototype.listeners,c.prototype.eventHandlers,c.prototype.steps,c.prototype.currentStepNode,c.prototype.currentStepNumber,c.prototype.currentStepPopper,c.prototype.currentStepConfig,c.prototype.templateContent,c.prototype.init=function(a){this.eventHandlers={},this.reset(),this.originalConfiguration=a||{},this.configure.apply(this,arguments);try{this.storage=window.sessionStorage,this.storageKey="tourstate_"+this.tourName}catch(b){this.storage=!1,this.storageKey=""}return this},c.prototype.reset=function(){return this.hide(),this.eventHandlers=[],this.resetStepListeners(),this.originalConfiguration={},this.steps=[],this.currentStepNumber=0,this},c.prototype.configure=function(a){var b=this;return"object"===("undefined"==typeof a?"undefined":d(a))&&("undefined"!=typeof a.tourName&&(this.tourName=a.tourName),a.eventHandlers&&!function(){var c=void 0;for(c in a.eventHandlers)a.eventHandlers[c].forEach(function(a){this.addEventHandler(c,a)},b)}(),this.resetStepDefaults(!0),"object"===d(a.steps)&&(this.steps=a.steps),"undefined"!=typeof a.template&&(this.templateContent=a.template)),this.checkMinimumRequirements(),this},c.prototype.checkMinimumRequirements=function(){if(!this.tourName)throw new Error("Tour Name required");if(!this.steps||!this.steps.length)throw new Error("Steps must be specified")},c.prototype.resetStepDefaults=function(a){return"undefined"==typeof a&&(a=!0),this.stepDefaults={},a&&"undefined"!=typeof this.originalConfiguration.stepDefaults?this.setStepDefaults(this.originalConfiguration.stepDefaults):this.setStepDefaults({}),this},c.prototype.setStepDefaults=function(b){return this.stepDefaults||(this.stepDefaults={}),a.extend(this.stepDefaults,{element:"",placement:"top",delay:0,moveOnClick:!1,moveAfterTime:0,orphan:!1,direction:1},b),this},c.prototype.getCurrentStepNumber=function(){return parseInt(this.currentStepNumber,10)},c.prototype.setCurrentStepNumber=function(a){if(this.currentStepNumber=a,this.storage)try{this.storage.setItem(this.storageKey,a)}catch(b){b.code===DOMException.QUOTA_EXCEEDED_ERR&&this.storage.removeItem(this.storageKey)}},c.prototype.getNextStepNumber=function(a){"undefined"==typeof a&&(a=this.getCurrentStepNumber());for(var b=a+1;b<=this.steps.length;){if(this.isStepPotentiallyVisible(this.getStepConfig(b)))return b;b++}return null},c.prototype.getPreviousStepNumber=function(a){"undefined"==typeof a&&(a=this.getCurrentStepNumber());for(var b=a-1;b>=0;){if(this.isStepPotentiallyVisible(this.getStepConfig(b)))return b;b--}return null},c.prototype.isLastStep=function(a){var b=this.getNextStepNumber(a);return null===b},c.prototype.isFirstStep=function(a){var b=this.getPreviousStepNumber(a);return null===b},c.prototype.isStepPotentiallyVisible=function(a){return!!a&&(!!this.isStepActuallyVisible(a)||(!("undefined"==typeof a.orphan||!a.orphan)||!("undefined"==typeof a.delay||!a.delay)))},c.prototype.isStepActuallyVisible=function(a){if(!a)return!1;var b=this.getStepTarget(a);return!!(b&&b.length&&b.is(":visible"))&&!!b.length},c.prototype.next=function(){return this.gotoStep(this.getNextStepNumber())},c.prototype.previous=function(){return this.gotoStep(this.getPreviousStepNumber(),-1)},c.prototype.gotoStep=function(a,b){if(a<0)return this.endTour();var c=this.getStepConfig(a);return null===c?this.endTour():this._gotoStep(c,b)},c.prototype._gotoStep=function(a,b){if(!a)return this.endTour();if("undefined"!=typeof a.delay&&a.delay&&!a.delayed)return a.delayed=!0,window.setTimeout(t