Changeset 27993


Ignore:
Timestamp:
Mar 27, 2014, 9:29:59 PM (10 years ago)
Author:
flop25
Message:

js updated from git deposit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/takeatour/js/custom-bootstrap-tour-standalone.js

    r27898 r27993  
    616616
    617617    Tour.prototype.init = function(force) {
    618       var _this = this;
    619618      this._force = force;
    620619      if (this.ended()) {
     
    625624      this._initMouseNavigation();
    626625      this._initKeyboardNavigation();
    627       this._onResize(function() {
     626      this._onResize((function(_this) {
     627        return function() {
    628628        return _this.showStep(_this._current);
    629       });
     629        };
     630      })(this));
    630631      if (this._current !== null) {
    631632        this.showStep(this._current);
     
    669670
    670671    Tour.prototype.end = function() {
    671       var endHelper, promise,
    672         _this = this;
    673       endHelper = function(e) {
     672      var endHelper, promise;
     673      endHelper = (function(_this) {
     674        return function(e) {
    674675        $(document).off("click.tour-" + _this._options.name);
    675676        $(document).off("keyup.tour-" + _this._options.name);
     
    683684        }
    684685      };
     686      })(this);
    685687      promise = this.hideStep(this._current);
    686688      return this._callOnPromiseDone(promise, endHelper);
     
    714716
    715717    Tour.prototype.resume = function() {
    716       var step,
    717         _this = this;
     718      var step;
    718719      step = this.getStep(this._current);
    719720      if (!(step && step.duration)) {
     
    723724      this._start = new Date().getTime();
    724725      this._duration = this._duration || step.duration;
    725       this._timer = window.setTimeout(function() {
     726      this._timer = window.setTimeout((function(_this) {
     727        return function() {
    726728        if (_this._isLast()) {
    727729          return _this.next();
     
    729731          return _this.end();
    730732        }
    731       }, this._duration);
     733        };
     734      })(this), this._duration);
    732735      this._debug("Started step " + (this._current + 1) + " timer with duration " + this._duration);
    733736      if ((step.onResume != null) && this._duration !== step.duration) {
     
    737740
    738741    Tour.prototype.hideStep = function(i) {
    739       var hideStepHelper, promise, step,
    740         _this = this;
     742      var hideStepHelper, promise, step;
    741743      step = this.getStep(i);
    742744      if (!step) {
     
    745747      this._clearTimer();
    746748      promise = this._makePromise(step.onHide != null ? step.onHide(this, i) : void 0);
    747       hideStepHelper = function(e) {
     749      hideStepHelper = (function(_this) {
     750        return function(e) {
    748751        var $element;
    749752        $element = $(step.element);
     
    751754          $element = $("body");
    752755        }
    753         $element.popover("destroy");
     756          $element.popover("destroy").removeClass("tour-" + _this._options.name + "-element tour-" + _this._options.name + "-" + i + "-element");
    754757        if (step.reflex) {
    755758          $element.css("cursor", "").off("click.tour-" + _this._options.name);
     
    762765        }
    763766      };
     767      })(this);
    764768      this._callOnPromiseDone(promise, hideStepHelper);
    765769      return promise;
     
    767771
    768772    Tour.prototype.showStep = function(i) {
    769       var promise, showStepHelper, skipToPrevious, step,
    770         _this = this;
     773      var promise, showStepHelper, skipToPrevious, step;
    771774      if (this.ended()) {
    772775        this._debug("Tour ended, showStep prevented.");
     
    779782      skipToPrevious = i < this._current;
    780783      promise = this._makePromise(step.onShow != null ? step.onShow(this, i) : void 0);
    781       showStepHelper = function(e) {
     784      showStepHelper = (function(_this) {
     785        return function(e) {
    782786        var current_path, path;
    783787        _this.setCurrentStep(i);
    784788        path = (function() {
    785           switch (toString.call(step.path)) {
     789            switch ({}.toString.call(step.path)) {
    786790            case "[object Function]":
    787791              return step.path();
     
    832836        }
    833837      };
     838      })(this);
    834839      this._callOnPromiseDone(promise, showStepHelper);
    835840      return promise;
     
    903908
    904909    Tour.prototype._showNextStep = function() {
    905       var promise, showNextStepHelper, step,
    906         _this = this;
     910      var promise, showNextStepHelper, step;
    907911      step = this.getStep(this._current);
    908       showNextStepHelper = function(e) {
     912      showNextStepHelper = (function(_this) {
     913        return function(e) {
    909914        return _this.showStep(step.next);
    910915      };
     916      })(this);
    911917      promise = this._makePromise(step.onNext != null ? step.onNext(this) : void 0);
    912918      return this._callOnPromiseDone(promise, showNextStepHelper);
     
    914920
    915921    Tour.prototype._showPrevStep = function() {
    916       var promise, showPrevStepHelper, step,
    917         _this = this;
     922      var promise, showPrevStepHelper, step;
    918923      step = this.getStep(this._current);
    919       showPrevStepHelper = function(e) {
     924      showPrevStepHelper = (function(_this) {
     925        return function(e) {
    920926        return _this.showStep(step.prev);
    921927      };
     928      })(this);
    922929      promise = this._makePromise(step.onPrev != null ? step.onPrev(this) : void 0);
    923930      return this._callOnPromiseDone(promise, showPrevStepHelper);
     
    939946      } else if (step.redirect === true) {
    940947        this._debug("Redirect to " + path);
    941         //console.log(path);
    942         return document.location.assign(path);
     948        return document.location.href = path;
    943949      }
    944950    };
     
    953959
    954960    Tour.prototype._showPopover = function(step, i) {
    955       var $element, $navigation, $template, $tip, isOrphan, options,
    956         _this = this;
     961      var $element, $navigation, $template, $tip, isOrphan, options;
    957962      options = $.extend({}, this._options);
    958963      $template = $.isFunction(step.template) ? $(step.template(i, step)) : $(step.template);
     
    966971      $element = $(step.element);
    967972      $template.addClass("tour-" + this._options.name + " tour-" + this._options.name + "-" + i);
     973      $element.addClass("tour-" + this._options.name + "-element tour-" + this._options.name + "-" + i + "-element");
    968974      if (step.options) {
    969975        $.extend(options, step.options);
    970976      }
    971977      if (step.reflex) {
    972         $element.css("cursor", "pointer").on("click.tour-" + this._options.name, function() {
     978        $element.css("cursor", "pointer").on("click.tour-" + this._options.name, (function(_this) {
     979          return function() {
    973980          if (_this._isLast()) {
    974981            return _this.next();
     
    976983            return _this.end();
    977984          }
    978         });
     985          };
     986        })(this));
    979987      }
    980988      if (step.prev < 0) {
     
    10491057
    10501058    Tour.prototype._scrollIntoView = function(element, callback) {
    1051       var $element, $window, counter, offsetTop, scrollTop, windowHeight,
    1052         _this = this;
     1059      var $element, $window, counter, offsetTop, scrollTop, windowHeight;
    10531060      $element = $(element);
    10541061      if (!$element.length) {
     
    10631070      return $("body,html").stop(true, true).animate({
    10641071        scrollTop: Math.ceil(scrollTop)
    1065       }, function() {
     1072      }, (function(_this) {
     1073        return function() {
    10661074        if (++counter === 2) {
    10671075          callback();
    10681076          return _this._debug("Scroll into view. Animation end element offset: " + ($element.offset().top) + ". Window height: " + ($window.height()) + ".");
    10691077        }
    1070       });
     1078        };
     1079      })(this));
    10711080    };
    10721081
     
    10791088
    10801089    Tour.prototype._initMouseNavigation = function() {
    1081       var _this = this;
     1090      var _this;
    10821091      _this = this;
    1083       return $(document).off("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='prev']:not(.disabled)").off("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='next']:not(.disabled)").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']:not(.disabled)", function(e) {
     1092      return $(document).off("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='prev']:not(.disabled)").off("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='next']:not(.disabled)").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']:not(.disabled)", (function(_this) {
     1093        return function(e) {
    10841094        e.preventDefault();
    10851095        return _this.next();
    1086       }).on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='prev']:not(.disabled)", function(e) {
     1096        };
     1097      })(this)).on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='prev']:not(.disabled)", (function(_this) {
     1098        return function(e) {
    10871099        e.preventDefault();
    10881100        return _this.prev();
    1089       }).on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='end']", function(e) {
     1101        };
     1102      })(this)).on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='end']", (function(_this) {
     1103        return function(e) {
    10901104        e.preventDefault();
    10911105        return _this.end();
    1092       }).on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='pause-resume']", function(e) {
     1106        };
     1107      })(this)).on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='pause-resume']", function(e) {
    10931108        var $this;
    10941109        e.preventDefault();
     
    11041119
    11051120    Tour.prototype._initKeyboardNavigation = function() {
    1106       var _this = this;
    11071121      if (!this._options.keyboard) {
    11081122        return;
    11091123      }
    1110       return $(document).on("keyup.tour-" + this._options.name, function(e) {
     1124      return $(document).on("keyup.tour-" + this._options.name, (function(_this) {
     1125        return function(e) {
    11111126        if (!e.which) {
    11121127          return;
     
    11311146            return _this.end();
    11321147        }
    1133       });
     1148        };
     1149      })(this));
    11341150    };
    11351151
     
    11431159
    11441160    Tour.prototype._callOnPromiseDone = function(promise, cb, arg) {
    1145       var _this = this;
    11461161      if (promise) {
    1147         return promise.then(function(e) {
     1162        return promise.then((function(_this) {
     1163          return function(e) {
    11481164          return cb.call(_this, arg);
    1149         });
     1165          };
     1166        })(this));
    11501167      } else {
    11511168        return cb.call(this, arg);
Note: See TracChangeset for help on using the changeset viewer.