[Pkg-javascript-commits] [node-bootstrap-tour] 01/07: Imported Upstream version 0.10.3+dfsg

Julien Puydt julien.puydt at laposte.net
Tue May 17 15:28:15 UTC 2016


This is an automated email from the git hooks/post-receive script.

jpuydt-guest pushed a commit to branch master
in repository node-bootstrap-tour.

commit 304234f677e5c462f36bd0e8ebf695b6761470f2
Author: Julien Puydt <julien.puydt at laposte.net>
Date:   Tue May 17 16:33:11 2016 +0200

    Imported Upstream version 0.10.3+dfsg
---
 LICENSE                                     | 195 ++-----------------
 README.md                                   |   4 +-
 bower.json                                  |   1 -
 build/css/bootstrap-tour-standalone.css     |  32 +++-
 build/css/bootstrap-tour.css                |  11 +-
 build/js/bootstrap-tour-standalone.js       | 259 +++++++++++++++++++++----
 composer.json                               |   2 +-
 gulpfile.coffee                             |   9 +-
 karma.json                                  |   4 +-
 package.json                                |  16 +-
 smart.json                                  |   2 +-
 src/coffee/bootstrap-tour.coffee            | 173 ++++++++++++++---
 src/coffee/bootstrap-tour.docs.coffee       |   1 +
 src/coffee/bootstrap-tour.spec.coffee       | 281 ++++++++++++++++++++++++++--
 src/docs/_includes/footer.html              |   1 +
 src/docs/api.html                           |  79 +++++++-
 src/docs/assets/css/bootstrap-tour.css      |  11 +-
 src/docs/assets/css/bootstrap-tour.docs.css |   1 -
 src/docs/index.html                         |   2 +-
 src/less/bootstrap-tour-standalone.less     |   1 +
 src/less/bootstrap-tour.less                |   5 +-
 test/bootstrap-tour.js                      | 199 ++++++++++++++++----
 22 files changed, 949 insertions(+), 340 deletions(-)

diff --git a/LICENSE b/LICENSE
index 2bb9ad2..8201fc1 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,176 +1,19 @@
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
\ No newline at end of file
+Copyright (c) 2013-2015 The Bootstrap Tour community
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/README.md b/README.md
index 88a9010..a115c8e 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ In lieu of a formal styleguide, take care to maintain the existing coding style.
 
 Feel free to contribute with pull requests, bug reports or enhancement suggestions.
 
-We use [Gulp](http://gulpjs.com/) and [Jasmine](http://pivotal.github.io/jasmine/). Both make your life easier ;)
+We use [Gulp](http://gulpjs.com/) and [Jasmine](http://jasmine.github.io/). Both make your life easier ;)
 
 ### Develop
 
@@ -73,5 +73,5 @@ Check `gulpfile.coffee` to know more.
 
 ## License
 
-Code licensed under the [Apache License v2.0](http://www.apache.org/licenses/LICENSE-2.0).
+Code licensed under the [MIT license](https://opensource.org/licenses/MIT).
 Documentation licensed under [CC BY 3.0](http://creativecommons.org/licenses/by/3.0/).
diff --git a/bower.json b/bower.json
index 908256f..eb25999 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,5 @@
 {
   "name": "bootstrap-tour",
-  "version": "0.10.2",
   "main": [
     "./build/js/bootstrap-tour.js",
     "./build/js/bootstrap-tour-standalone.js",
diff --git a/build/css/bootstrap-tour-standalone.css b/build/css/bootstrap-tour-standalone.css
index 19ae087..7de1e5c 100644
--- a/build/css/bootstrap-tour-standalone.css
+++ b/build/css/bootstrap-tour-standalone.css
@@ -1,5 +1,5 @@
 /* ========================================================================
- * bootstrap-tour - v0.10.1
+ * bootstrap-tour - v0.10.2
  * http://bootstraptour.com
  * ========================================================================
  * Copyright 2012-2013 Ulrich Sossou
@@ -674,6 +674,35 @@ input[type="button"].btn-block {
   border-left-color: #ffffff;
   bottom: -10px;
 }
+.fade {
+  opacity: 0;
+  -webkit-transition: opacity 0.15s linear;
+  -o-transition: opacity 0.15s linear;
+  transition: opacity 0.15s linear;
+}
+.fade.in {
+  opacity: 1;
+}
+.collapse {
+  display: none;
+}
+.collapse.in {
+  display: block;
+}
+tr.collapse.in {
+  display: table-row;
+}
+tbody.collapse.in {
+  display: table-row-group;
+}
+.collapsing {
+  position: relative;
+  height: 0;
+  overflow: hidden;
+  -webkit-transition: height 0.35s ease;
+  -o-transition: height 0.35s ease;
+  transition: height 0.35s ease;
+}
 .tour-backdrop {
   position: fixed;
   top: 0;
@@ -688,7 +717,6 @@ input[type="button"].btn-block {
 .tour-step-backdrop {
   position: relative;
   z-index: 1101;
-  background: inherit;
 }
 .tour-step-backdrop > td {
   position: relative;
diff --git a/build/css/bootstrap-tour.css b/build/css/bootstrap-tour.css
index b730758..1b35295 100644
--- a/build/css/bootstrap-tour.css
+++ b/build/css/bootstrap-tour.css
@@ -1,15 +1,15 @@
 /* ========================================================================
- * bootstrap-tour - v0.10.1
+ * bootstrap-tour - v0.10.2
  * http://bootstraptour.com
  * ========================================================================
- * Copyright 2012-2013 Ulrich Sossou
+ * Copyright 2012-2015 Ulrich Sossou
  *
  * ========================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *     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,
@@ -33,7 +33,6 @@
 .tour-step-backdrop {
   position: relative;
   z-index: 1101;
-  background: inherit;
 }
 .tour-step-backdrop > td {
   position: relative;
@@ -46,7 +45,7 @@
   border-radius: 6px;
 }
 .popover[class*="tour-"] {
-  z-index: 1100;
+  z-index: 1102;
 }
 .popover[class*="tour-"] .popover-navigation {
   padding: 9px 14px;
diff --git a/build/js/bootstrap-tour-standalone.js b/build/js/bootstrap-tour-standalone.js
index 9d1fd55..39ecb23 100644
--- a/build/js/bootstrap-tour-standalone.js
+++ b/build/js/bootstrap-tour-standalone.js
@@ -1,15 +1,15 @@
 /* ========================================================================
- * bootstrap-tour - v0.10.1
+ * bootstrap-tour - v0.10.2
  * http://bootstraptour.com
  * ========================================================================
- * Copyright 2012-2013 Ulrich Sossou
+ * Copyright 2012-2015 Ulrich Sossou
  *
  * ========================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *     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,
@@ -20,6 +20,66 @@
  */
 
 /* ========================================================================
+ * Bootstrap: transition.js v3.2.0
+ * http://getbootstrap.com/javascript/#transitions
+ * ========================================================================
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * ======================================================================== */
+
+
++function ($) {
+  'use strict';
+
+  // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
+  // ============================================================
+
+  function transitionEnd() {
+    var el = document.createElement('bootstrap')
+
+    var transEndEventNames = {
+      WebkitTransition : 'webkitTransitionEnd',
+      MozTransition    : 'transitionend',
+      OTransition      : 'oTransitionEnd otransitionend',
+      transition       : 'transitionend'
+    }
+
+    for (var name in transEndEventNames) {
+      if (el.style[name] !== undefined) {
+        return { end: transEndEventNames[name] }
+      }
+    }
+
+    return false // explicit for ie8 (  ._.)
+  }
+
+  // http://blog.alexmaccaw.com/css-transitions
+  $.fn.emulateTransitionEnd = function (duration) {
+    var called = false
+    var $el = this
+    $(this).one('bsTransitionEnd', function () { called = true })
+    var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
+    setTimeout(callback, duration)
+    return this
+  }
+
+  $(function () {
+    $.support.transition = transitionEnd()
+
+    if (!$.support.transition) return
+
+    $.event.special.bsTransitionEnd = {
+      bindType: $.support.transition.end,
+      delegateType: $.support.transition.end,
+      handle: function (e) {
+        if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
+      }
+    }
+  })
+
+}(jQuery);
+
+/* ========================================================================
  * Bootstrap: tooltip.js v3.2.0
  * http://getbootstrap.com/javascript/#tooltip
  * Inspired by the original jQuery.tipsy by Jason Frame
@@ -611,6 +671,7 @@
         storage: storage,
         debug: false,
         backdrop: false,
+        backdropContainer: 'body',
         backdropPadding: 0,
         redirect: true,
         orphan: false,
@@ -630,10 +691,12 @@
         onNext: function(tour) {},
         onPrev: function(tour) {},
         onPause: function(tour, duration) {},
-        onResume: function(tour, duration) {}
+        onResume: function(tour, duration) {},
+        onRedirectError: function(tour) {}
       }, options);
       this._force = false;
       this._inited = false;
+      this._current = null;
       this.backdrop = {
         overlay: null,
         $element: null,
@@ -663,6 +726,7 @@
         return $.extend({
           id: "step-" + i,
           path: '',
+          host: '',
           placement: 'right',
           title: '',
           content: '<p></p>',
@@ -672,8 +736,10 @@
           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,
           orphan: this._options.orphan,
           duration: this._options.duration,
           delay: this._options.delay,
@@ -685,7 +751,8 @@
           onNext: this._options.onNext,
           onPrev: this._options.onPrev,
           onPause: this._options.onPause,
-          onResume: this._options.onResume
+          onResume: this._options.onResume,
+          onRedirectError: this._options.onRedirectError
         }, this._options.steps[i]);
       }
     };
@@ -771,6 +838,7 @@
     Tour.prototype.restart = function() {
       this._removeState('current_step');
       this._removeState('end');
+      this._removeState('redirect_to');
       return this.start();
     };
 
@@ -829,8 +897,9 @@
             $element = $('body');
           }
           $element.popover('destroy').removeClass("tour-" + _this._options.name + "-element tour-" + _this._options.name + "-" + i + "-element");
+          $element.removeData('bs.popover');
           if (step.reflex) {
-            $element.removeClass('tour-step-element-reflex').off("" + (_this._reflexEvent(step.reflex)) + ".tour-" + _this._options.name);
+            $(step.reflexElement).removeClass('tour-step-element-reflex').off("" + (_this._reflexEvent(step.reflex)) + ".tour-" + _this._options.name);
           }
           if (step.backdrop) {
             _this._hideBackdrop();
@@ -858,7 +927,7 @@
       promise = this._makePromise(step.onShow != null ? step.onShow(this, i) : void 0);
       showStepHelper = (function(_this) {
         return function(e) {
-          var current_path, path, showPopoverAndOverlay;
+          var path, showPopoverAndOverlay;
           _this.setCurrentStep(i);
           path = (function() {
             switch ({}.toString.call(step.path)) {
@@ -870,13 +939,14 @@
                 return step.path;
             }
           }).call(_this);
-          current_path = [document.location.pathname, document.location.hash].join('');
-          if (_this._isRedirect(path, current_path)) {
-            _this._redirect(step, path);
-            return;
+          if (_this._isRedirect(step.host, path, document.location)) {
+            _this._redirect(step, i, path);
+            if (!_this._isJustPathHashDifferent(step.host, path, document.location)) {
+              return;
+            }
           }
           if (_this._isOrphan(step)) {
-            if (!step.orphan) {
+            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();
@@ -888,10 +958,10 @@
             _this._debug("Show the orphan step " + (_this._current + 1) + ". Orphans option is true.");
           }
           if (step.backdrop) {
-            _this._showBackdrop(!_this._isOrphan(step) ? step.element : void 0);
+            _this._showBackdrop(step);
           }
           showPopoverAndOverlay = function() {
-            if (_this.getCurrentStep() !== i) {
+            if (_this.getCurrentStep() !== i || _this.ended()) {
               return;
             }
             if ((step.element != null) && step.backdrop) {
@@ -941,6 +1011,10 @@
       return this;
     };
 
+    Tour.prototype.redraw = function() {
+      return this._showOverlayElement(this.getStep(this.getCurrentStep()).element, true);
+    };
+
     Tour.prototype._setState = function(key, value) {
       var e, keyName;
       if (this._options.storage) {
@@ -1022,16 +1096,54 @@
       }
     };
 
-    Tour.prototype._isRedirect = function(path, currentPath) {
-      return (path != null) && path !== '' && (({}.toString.call(path) === '[object RegExp]' && !path.test(currentPath)) || ({}.toString.call(path) === '[object String]' && path.replace(/\?.*$/, '').replace(/\/?$/, '') !== currentPath.replace(/\/?$/, '')));
+    Tour.prototype._isRedirect = function(host, path, location) {
+      var currentPath;
+      if (host !== '') {
+        if (this._isHostDifferent(host, location.href)) {
+          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, currentURL) {
+      return this._getProtocol(host) !== this._getProtocol(currentURL) || this._getHost(host) !== this._getHost(currentURL);
     };
 
-    Tour.prototype._redirect = function(step, path) {
+    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 !== '') {
+        if (this._isHostDifferent(host, location.href)) {
+          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) {
       if ($.isFunction(step.redirect)) {
         return step.redirect.call(this, path);
       } else if (step.redirect === true) {
-        this._debug("Redirect to " + path);
-        return document.location.href = path;
+        this._debug("Redirect to " + step.host + path);
+        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 = "" + step.host + path;
+        }
       }
     };
 
@@ -1044,7 +1156,7 @@
     };
 
     Tour.prototype._showPopover = function(step, i) {
-      var $element, $tip, isOrphan, options;
+      var $element, $tip, isOrphan, options, shouldAddSmart;
       $(".tour-" + this._options.name).remove();
       options = $.extend({}, this._options);
       isOrphan = this._isOrphan(step);
@@ -1059,9 +1171,7 @@
         $.extend(options, step.options);
       }
       if (step.reflex && !isOrphan) {
-        $element.addClass('tour-step-element-reflex');
-        $element.off("" + (this._reflexEvent(step.reflex)) + ".tour-" + this._options.name);
-        $element.on("" + (this._reflexEvent(step.reflex)) + ".tour-" + this._options.name, (function(_this) {
+        $(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();
@@ -1071,8 +1181,9 @@
           };
         })(this));
       }
+      shouldAddSmart = step.smartPlacement === true && step.placement.search(/auto/i) === -1;
       $element.popover({
-        placement: step.placement,
+        placement: shouldAddSmart ? "auto " + step.placement : step.placement,
         trigger: 'manual',
         title: step.title,
         content: step.content,
@@ -1091,8 +1202,12 @@
     };
 
     Tour.prototype._template = function(step, i) {
-      var $navigation, $next, $prev, $resume, $template;
-      $template = $.isFunction(step.template) ? $(step.template(i, step)) : $(step.template);
+      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"]');
@@ -1101,11 +1216,16 @@
         $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');
+        $prev.prop('disabled', true);
       }
       if (step.next < 0) {
         $next.addClass('disabled');
+        $next.prop('disabled', true);
       }
       if (!step.duration) {
         $resume.remove();
@@ -1276,7 +1396,7 @@
       }
     };
 
-    Tour.prototype._showBackdrop = function(element) {
+    Tour.prototype._showBackdrop = function(step) {
       if (this.backdrop.backgroundShown) {
         return;
       }
@@ -1284,7 +1404,7 @@
         "class": 'tour-backdrop'
       });
       this.backdrop.backgroundShown = true;
-      return $('body').append(this.backdrop);
+      return $(step.backdropContainer).append(this.backdrop);
     };
 
     Tour.prototype._hideBackdrop = function() {
@@ -1300,23 +1420,25 @@
       }
     };
 
-    Tour.prototype._showOverlayElement = function(step) {
+    Tour.prototype._showOverlayElement = function(step, force) {
       var $element, elementData;
       $element = $(step.element);
-      if (!$element || $element.length === 0 || this.backdrop.overlayElementShown) {
+      if (!$element || $element.length === 0 || this.backdrop.overlayElementShown && !force) {
         return;
       }
-      this.backdrop.overlayElementShown = true;
-      this.backdrop.$element = $element.addClass('tour-step-backdrop');
-      this.backdrop.$background = $('<div>', {
-        "class": 'tour-step-background'
-      });
+      if (!this.backdrop.overlayElementShown) {
+        this.backdrop.$element = $element.addClass('tour-step-backdrop');
+        this.backdrop.$background = $('<div>', {
+          "class": 'tour-step-background'
+        });
+        this.backdrop.$background.appendTo(step.backdropContainer);
+        this.backdrop.overlayElementShown = true;
+      }
       elementData = {
         width: $element.innerWidth(),
         height: $element.innerHeight(),
         offset: $element.offset()
       };
-      this.backdrop.$background.appendTo('body');
       if (step.backdropPadding) {
         elementData = this._applyBackdropPadding(step.backdropPadding, elementData);
       }
@@ -1367,6 +1489,69 @@
       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, v;
+      if ({}.toString.call(obj1) === '[object Object]' && {}.toString.call(obj2) === '[object Object]') {
+        for (k in obj1) {
+          v = obj1[k];
+          if (obj2[k] !== v) {
+            return false;
+          }
+        }
+        for (k in obj2) {
+          v = obj2[k];
+          if (obj1[k] !== v) {
+            return false;
+          }
+        }
+        return true;
+      }
+      return obj1 === obj2;
+    };
+
     return Tour;
 
   })();
diff --git a/composer.json b/composer.json
index bb3ba64..7ae670f 100644
--- a/composer.json
+++ b/composer.json
@@ -9,5 +9,5 @@
         "bootstrap",
         "tour"
     ],
-    "license": "Apache-2.0"
+    "license": "MIT"
 }
diff --git a/gulpfile.coffee b/gulpfile.coffee
index cc1665c..990b169 100644
--- a/gulpfile.coffee
+++ b/gulpfile.coffee
@@ -21,14 +21,14 @@ banner = '''
    * <%= pkg.name %> - v<%= pkg.version %>
    * <%= pkg.homepage %>
    * ========================================================================
-   * Copyright 2012-2013 <%= pkg.author.name %>
+   * Copyright 2012-2015 <%= pkg.author.name %>
    *
    * ========================================================================
-   * Licensed under the Apache License, Version 2.0 (the "License");
+   * 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
    *
-   *     http://www.apache.org/licenses/LICENSE-2.0
+   *     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,
@@ -64,6 +64,7 @@ gulp.task 'coffee-standalone', ->
   streamqueue objectMode: true,
     gulp
     .src [
+      "./bower_components/bootstrap/js/transition.js"
       "./bower_components/bootstrap/js/tooltip.js"
       "./bower_components/bootstrap/js/popover.js"
     ]
@@ -131,7 +132,7 @@ gulp.task 'test-go', ['test-coffee'], (done) ->
 
 # docs
 gulp.task 'docs-build', ['coffee', 'less'], (done) ->
-  spawn 'jekyll', ['build']
+  spawn `(process.platform === 'win32' ? 'jekyll.bat' : 'jekyll')`, ['build']
     .on 'close', done
 
 gulp.task 'docs-copy', ['docs-build'], ->
diff --git a/karma.json b/karma.json
index 74fb1f2..a12ca3b 100644
--- a/karma.json
+++ b/karma.json
@@ -10,10 +10,10 @@
   "port": 9876,
   "colors": true,
   "autoWatch": true,
-  "browsers": ["Firefox"],
+  "browsers": ["PhantomJS"],
   "singleRun": false,
   "plugins": [
     "karma-jasmine",
-    "karma-firefox-launcher"
+    "karma-phantomjs-launcher"
   ]
 }
diff --git a/package.json b/package.json
index fcdf9df..6206188 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
 {
   "name": "bootstrap-tour",
   "description": "Quick and easy way to build your product tours with Bootstrap Popovers.",
-  "version": "0.10.2",
+  "version": "0.10.3",
   "keywords": [
     "tour",
     "bootstrap",
@@ -35,8 +35,8 @@
   },
   "licenses": [
     {
-      "type": "Apache-2.0",
-      "url": "http://www.apache.org/licenses/LICENSE-2.0"
+      "type": "MIT",
+      "url": "https://opensource.org/licenses/MIT"
     }
   ],
   "dependencies": {
@@ -63,19 +63,15 @@
     "gulp-uglify": "~0.3.1",
     "gulp-util": "~3.0.0",
     "karma": "~0.12.19",
-    "karma-firefox-launcher": "~0.1.3",
     "karma-jasmine": "~0.1.5",
+    "karma-phantomjs-launcher": "^0.2.1",
+    "phantomjs": "^1.9.19",
     "streamqueue": "0.1.1"
   },
   "engines": {
     "node": ">= 0.8.0"
   },
-  "main": [
-    "./build/js/bootstrap-tour.js",
-    "./build/js/bootstrap-tour-standalone.js",
-    "./build/css/bootstrap-tour.css",
-    "./build/css/bootstrap-tour-standalone.css"
-  ],
+  "main": "./build/js/bootstrap-tour.js",
   "scripts": {
     "build": "gulp dist",
     "test": "gulp test"
diff --git a/smart.json b/smart.json
index a3184aa..0bcea8f 100644
--- a/smart.json
+++ b/smart.json
@@ -3,7 +3,7 @@
   "description": "Quick and easy way to build your product tours with Bootstrap Popovers.",
   "homepage": "http://bootstraptour.com",
   "author": "Ulrich Sossou <sorich87 at gmail.com> (http://ulrichsossou.com)",
-  "version": "0.10.2",
+  "version": "0.10.3",
   "git": "https://github.com/sorich87/bootstrap-tour.git",
   "packages": {}
 }
diff --git a/src/coffee/bootstrap-tour.coffee b/src/coffee/bootstrap-tour.coffee
index 43fa372..bcb0206 100644
--- a/src/coffee/bootstrap-tour.coffee
+++ b/src/coffee/bootstrap-tour.coffee
@@ -17,6 +17,7 @@
         storage: storage
         debug: false
         backdrop: false
+        backdropContainer: 'body'
         backdropPadding: 0
         redirect: true
         orphan: false
@@ -52,10 +53,12 @@
         onPrev: (tour) ->
         onPause: (tour, duration) ->
         onResume: (tour, duration) ->
+        onRedirectError: (tour) ->
       , options
 
       @_force = false
       @_inited = false
+      @_current = null
       @backdrop =
         overlay: null
         $element: null
@@ -80,6 +83,7 @@
         $.extend
           id: "step-#{i}"
           path: ''
+          host: ''
           placement: 'right'
           title: ''
           content: '<p></p>' # no empty as default, otherwise popover won't show up
@@ -89,8 +93,10 @@
           container: @_options.container
           autoscroll: @_options.autoscroll
           backdrop: @_options.backdrop
+          backdropContainer: @_options.backdropContainer
           backdropPadding: @_options.backdropPadding
           redirect: @_options.redirect
+          reflexElement: @_options.steps[i].element
           orphan: @_options.orphan
           duration: @_options.duration
           delay: @_options.delay
@@ -103,6 +109,7 @@
           onPrev: @_options.onPrev
           onPause: @_options.onPause
           onResume: @_options.onResume
+          onRedirectError: @_options.onRedirectError
         , @_options.steps[i]
 
     # Setup event bindings and continue a tour that has already started
@@ -175,6 +182,7 @@
     restart: ->
       @_removeState 'current_step'
       @_removeState 'end'
+      @_removeState 'redirect_to'
       @start()
 
     # Pause step timer
@@ -222,8 +230,10 @@
         $element
         .popover('destroy')
         .removeClass "tour-#{@_options.name}-element tour-#{@_options.name}-#{i}-element"
+        $element
+        .removeData('bs.popover')
         if step.reflex
-          $element
+          $ step.reflexElement
           .removeClass('tour-step-element-reflex')
           .off "#{@_reflexEvent(step.reflex)}.tour-#{@_options.name}"
 
@@ -258,14 +268,14 @@
           else step.path
 
         # Redirect to step path if not already there
-        current_path = [document.location.pathname, document.location.hash].join('')
-        if @_isRedirect path, current_path
-          @_redirect step, path
-          return
+        if @_isRedirect step.host, path, document.location
+          @_redirect step, i, path
+
+          return unless @_isJustPathHashDifferent(step.host, path, document.location)
 
         # Skip if step is orphan and orphan options is false
         if @_isOrphan step
-          if not step.orphan
+          if step.orphan is false
             @_debug """Skip the orphan step #{@_current + 1}.
             Orphan option is false and the element does not exist or is hidden."""
             if skipToPrevious then @_showPrevStep() else @_showNextStep()
@@ -274,10 +284,10 @@
           @_debug "Show the orphan step #{@_current + 1}. Orphans option is true."
 
         # Show backdrop
-        @_showBackdrop(step.element unless @_isOrphan step) if step.backdrop
+        @_showBackdrop(step) if step.backdrop
 
         showPopoverAndOverlay = =>
-          return if @getCurrentStep() isnt i
+          return if @getCurrentStep() isnt i or @ended()
 
           @_showOverlayElement step if step.element? and step.backdrop
           @_showPopover step, i
@@ -315,6 +325,10 @@
         @_current = if @_current is null then null else parseInt @_current, 10
       @
 
+    # Manually trigger a redraw on the overlay element
+    redraw: ->
+      @_showOverlayElement(@getStep(@getCurrentStep()).element, true)
+
     # Set a state in storage
     _setState: (key, value) ->
       if @_options.storage
@@ -371,20 +385,61 @@
       window.console.log "Bootstrap Tour '#{@_options.name}' | #{text}" if @_options.debug
 
     # Check if step path equals current document path
-    _isRedirect: (path, currentPath) ->
+    _isRedirect: (host, path, location) ->
+      if host isnt ''
+        return true if @_isHostDifferent(host, location.href)
+
+      currentPath = [
+        location.pathname,
+        location.search,
+        location.hash
+      ].join('')
+
       path? and path isnt '' and (
-        (({}).toString.call(path) is '[object RegExp]' and not path.test currentPath) or
-        (({}).toString.call(path) is '[object String]' and
-          path.replace(/\?.*$/, '').replace(/\/?$/, '') isnt currentPath.replace(/\/?$/, ''))
+        (({}).toString.call(path) is '[object RegExp]' and not path.test(currentPath)) or
+        (({}).toString.call(path) is '[object String]' and @_isPathDifferent(path, currentPath))
       )
 
+    _isHostDifferent: (host, currentURL) ->
+      @_getProtocol(host) isnt @_getProtocol(currentURL) or
+      @_getHost(host) isnt @_getHost(currentURL)
+
+    _isPathDifferent: (path, currentPath) ->
+      @_getPath(path) isnt @_getPath(currentPath) or not
+      @_equal(@_getQuery(path), @_getQuery(currentPath)) or not
+      @_equal(@_getHash(path), @_getHash(currentPath))
+
+    _isJustPathHashDifferent: (host, path, location) ->
+      if host isnt ''
+        return false if @_isHostDifferent(host, location.href)
+
+      currentPath = [
+        location.pathname,
+        location.search,
+        location.hash
+      ].join('')
+
+      if ({}).toString.call(path) is '[object String]'
+        return @_getPath(path) is @_getPath(currentPath) and
+          @_equal(@_getQuery(path), @_getQuery(currentPath)) and not
+          @_equal(@_getHash(path), @_getHash(currentPath))
+
+      false
+
     # Execute the redirect
-    _redirect: (step, path) ->
+    _redirect: (step, i, path) ->
       if $.isFunction step.redirect
         step.redirect.call this, path
       else if step.redirect is true
-        @_debug "Redirect to #{path}"
-        document.location.href = path
+        @_debug "Redirect to #{step.host}#{path}"
+        if @_getState('redirect_to') is "#{i}"
+          @_debug "Error redirection loop to #{path}"
+          @_removeState 'redirect_to'
+
+          step.onRedirectError @ if step.onRedirectError?
+        else
+          @_setState 'redirect_to', "#{i}"
+          document.location.href = "#{step.host}#{path}"
 
     _isOrphan: (step) ->
       # Do not check for is(':hidden') on svg elements. jQuery does not work properly on svg.
@@ -416,14 +471,17 @@
 
       $.extend options, step.options if step.options
       if step.reflex and not isOrphan
-        $element.addClass('tour-step-element-reflex')
-        $element.off("#{@_reflexEvent(step.reflex)}.tour-#{@_options.name}")
-        $element.on "#{@_reflexEvent(step.reflex)}.tour-#{@_options.name}", =>
+        $ step.reflexElement
+        .addClass('tour-step-element-reflex')
+        .off("#{@_reflexEvent(step.reflex)}.tour-#{@_options.name}")
+        .on "#{@_reflexEvent(step.reflex)}.tour-#{@_options.name}", =>
           if @_isLast() then @next() else @end()
 
+      shouldAddSmart = step.smartPlacement is true and step.placement.search(/auto/i) is -1
+
       $element
       .popover(
-        placement: step.placement
+        placement: if shouldAddSmart then "auto #{step.placement}" else step.placement
         trigger: 'manual'
         title: step.title
         content: step.content
@@ -443,7 +501,12 @@
 
     # Get popover template
     _template: (step, i) ->
-      $template = if $.isFunction step.template then $(step.template i, step) else $(step.template)
+      template = step.template
+
+      if @_isOrphan(step) and ({}).toString.call(step.orphan) isnt '[object Boolean]'
+        template = step.orphan
+
+      $template = if $.isFunction template then $(template i, step) else $(template)
       $navigation = $template.find '.popover-navigation'
       $prev = $navigation.find '[data-role="prev"]'
       $next = $navigation.find '[data-role="next"]'
@@ -451,8 +514,13 @@
 
       $template.addClass 'orphan' if @_isOrphan step
       $template.addClass "tour-#{@_options.name} tour-#{@_options.name}-#{i}"
-      $prev.addClass('disabled') if step.prev < 0
-      $next.addClass('disabled') if step.next < 0
+      $template.addClass "tour-#{@_options.name}-reflex" if step.reflex
+      if step.prev < 0
+        $prev.addClass('disabled')
+        $prev.prop('disabled',true)
+      if step.next < 0
+        $next.addClass('disabled')
+        $next.prop('disabled',true)
       $resume.remove() unless step.duration
       $template.clone().wrap('<div>').parent().html()
 
@@ -578,12 +646,12 @@
       else
         cb.call(@, arg)
 
-    _showBackdrop: (element) ->
+    _showBackdrop: (step) ->
       return if @backdrop.backgroundShown
 
       @backdrop = $ '<div>', class: 'tour-backdrop'
       @backdrop.backgroundShown = true
-      $('body').append @backdrop
+      $(step.backdropContainer).append @backdrop
 
     _hideBackdrop: ->
       @_hideOverlayElement()
@@ -595,21 +663,22 @@
         @backdrop.overlay = null
         @backdrop.backgroundShown = false
 
-    _showOverlayElement: (step) ->
+    _showOverlayElement: (step, force) ->
       $element = $ step.element
 
-      return if not $element or $element.length is 0 or @backdrop.overlayElementShown
+      return if not $element or $element.length is 0 or @backdrop.overlayElementShown and not force
+
+      if !@backdrop.overlayElementShown
+        @backdrop.$element = $element.addClass 'tour-step-backdrop'
+        @backdrop.$background = $ '<div>', class: 'tour-step-background'
+        @backdrop.$background.appendTo(step.backdropContainer)
+        @backdrop.overlayElementShown = true
 
-      @backdrop.overlayElementShown = true
-      @backdrop.$element = $element.addClass 'tour-step-backdrop'
-      @backdrop.$background = $ '<div>', class: 'tour-step-background'
       elementData =
         width: $element.innerWidth()
         height: $element.innerHeight()
         offset: $element.offset()
 
-      @backdrop.$background.appendTo('body')
-
       elementData = @_applyBackdropPadding step.backdropPadding, elementData if step.backdropPadding
       @backdrop
       .$background
@@ -650,6 +719,48 @@
       @_timer = null
       @_duration = null
 
+    _getProtocol: (url) ->
+      url = url.split('://')
+      return if url.length > 1 then url[0] else 'http'
+
+    _getHost: (url) ->
+      url = url.split('//')
+      url = if url.length > 1 then  url[1] else url[0]
+
+      return url.split('/')[0]
+
+    _getPath: (path) ->
+      return path.replace(/\/?$/, '').split('?')[0].split('#')[0]
+
+    _getQuery: (path) ->
+      return @_getParams(path, '?')
+
+    _getHash: (path) ->
+      return @_getParams(path, '#')
+
+    _getParams: (path, start) ->
+      params = path.split(start)
+      return {} if params.length is 1
+
+      params = params[1].split('&')
+      paramsObject = {}
+
+      for param in params
+        param = param.split('=')
+        paramsObject[param[0]] = param[1] or ''
+
+      return paramsObject
+
+    _equal: (obj1, obj2) ->
+      if ({}).toString.call(obj1) is '[object Object]' and
+      ({}).toString.call(obj2) is '[object Object]'
+        for k,v of obj1
+          return false if obj2[k] isnt v
+        for k,v of obj2
+          return false if obj1[k] isnt v
+        return true
+
+      return obj1 is obj2
   window.Tour = Tour
 
 ) jQuery, window
diff --git a/src/coffee/bootstrap-tour.docs.coffee b/src/coffee/bootstrap-tour.docs.coffee
index 87fc21a..ea2745b 100644
--- a/src/coffee/bootstrap-tour.docs.coffee
+++ b/src/coffee/bootstrap-tour.docs.coffee
@@ -57,6 +57,7 @@ $ ->
       the focus anymore!
       """
       backdrop: true
+      backdropPadding: 5
     ,
       path: "/api"
       element: "#reflex"
diff --git a/src/coffee/bootstrap-tour.spec.coffee b/src/coffee/bootstrap-tour.spec.coffee
index 4b05fea..dbc8cb7 100644
--- a/src/coffee/bootstrap-tour.spec.coffee
+++ b/src/coffee/bootstrap-tour.spec.coffee
@@ -199,6 +199,7 @@ describe 'Bootstrap Tour', ->
       element: $('<div></div>').appendTo('body')
       id: 'step-0'
       path: 'test'
+      host: ''
       placement: 'left'
       title: 'Test'
       content: 'Just a test'
@@ -209,7 +210,9 @@ describe 'Bootstrap Tour', ->
       container: 'body'
       backdrop: false
       backdropPadding: 0
+      backdropContainer: 'body'
       redirect: true
+      reflexElement: $('<div></div>').appendTo('body')
       orphan: false
       duration: false
       delay: false
@@ -233,6 +236,7 @@ describe 'Bootstrap Tour', ->
       onPrev: (tour) ->
       onPause: (tour) ->
       onResume: (tour) ->
+      onRedirectError: (tour) ->
     @tour.addStep(step)
     # remove properties that we don't want to check from both steps object
     expect(@tour.getStep(0)).toEqual step
@@ -394,27 +398,170 @@ describe 'Bootstrap Tour', ->
     # tour show the second step on the same element
     expect(@tour.getStep(1).element.data('bs.popover').tip().filter(':visible').length).toBe 1
 
-  it 'should evaluate `path correctly', ->
+  it 'should get url properties correctly', ->
+    @tour = new Tour
+
+    expect(@tour._getProtocol('http://example.com')).toBe 'http'
+    expect(@tour._getProtocol('https://example.com')).toBe 'https'
+    expect(@tour._getProtocol('www.example.com')).toBe 'http'
+    expect(@tour._getProtocol('example.com')).toBe 'http'
+
+    expect(@tour._getHost('http://example.com')).toBe 'example.com'
+    expect(@tour._getHost('www.example.com')).toBe 'www.example.com'
+    expect(@tour._getHost('example.com/path')).toBe 'example.com'
+
+    expect(@tour._getPath('/somepath?foo=bar')).toBe '/somepath'
+    expect(@tour._getPath('/somepath#foo=bar')).toBe '/somepath'
+    expect(@tour._getPath('/somepath?foo=bar#hash')).toBe '/somepath'
+
+    expect(@tour._getQuery('/somepath?one=bar')).toEqual {one: 'bar'}
+    expect(@tour._getQuery('/somepath?one=bar&two=foo')).toEqual {one: 'bar', two: 'foo'}
+
+    expect(@tour._getHash('/somepath#one=bar&two=foo')).toEqual {one: 'bar', two: 'foo'}
+    expect(@tour._getHash('/somepath#one=bar&two=foo')).toEqual {one: 'bar', two: 'foo'}
+
+  it 'should evaluate `path` correctly', ->
     @tour = new Tour
 
     # redirect if path doesn't match current path
-    expect(@tour._isRedirect('/anotherpath', '/somepath')).toBe true
+    expect(
+      @tour._isRedirect(
+        '', '/anotherpath', href: '', pathname: '/somepath', search: '', hash: ''
+      )
+    ).toBe true
     # don't redirect if no path
-    expect(@tour._isRedirect(undefined, '/')).toBe false
+    expect(
+      @tour._isRedirect(
+        '', undefined, href: '', pathname: '/', search: '', hash: ''
+      )
+    ).toBe false
     # don't redirect if path empty
-    expect(@tour._isRedirect('', '/')).toBe false
+    expect(
+      @tour._isRedirect(
+        '', '', href: '', pathname: '/', search: '', hash: ''
+      )
+    ).toBe false
     # don't redirect if path matches current path
-    expect(@tour._isRedirect('/somepath', '/somepath')).toBe false
+    expect(
+      @tour._isRedirect(
+        '', '/somepath', href: '', pathname: '/somepath', search: '', hash: ''
+      )
+    ).toBe false
     # don't redirect if path with slash matches current path
-    expect(@tour._isRedirect('/somepath/', '/somepath')).toBe false
+    expect(
+      @tour._isRedirect(
+        '', '/somepath/', href: '', pathname: '/somepath', search: '', hash: ''
+      )
+    ).toBe false
     # don't redirect if path matches current path with slash
-    expect(@tour._isRedirect('/somepath', '/somepath/')).toBe false
+    expect(
+      @tour._isRedirect(
+        '', '/somepath', href: '', pathname: '/somepath/', search: '', hash: ''
+      )
+    ).toBe false
+    # redirect if path with query params doesn't matche current path
+    expect(
+      @tour._isRedirect(
+        '', '/somepath?search=true', href: '', pathname: '/somepath', search: '', hash: ''
+      )
+    ).toBe true
+    # redirect if path with slash and query params doesn't matche current path
+    expect(
+      @tour._isRedirect(
+        '', '/somepath/?search=true', href: '', pathname: '/somepath', search: '', hash: ''
+      )
+    ).toBe true
+
+    # redirect if path with more than one query param doesn't matche current path
+    expect(
+      @tour._isRedirect(
+        '', '/somepath?search=true&foo=bar', href: '', pathname: '/somepath', search: '', hash: ''
+      )
+    ).toBe true
+
+    # redirect if path with and query params doesn't matche current path
+    expect(
+      @tour._isRedirect(
+        '', '/somepath?search=true&foo=bar', href: '', pathname: '/somepath', search: '?search=true', hash: ''
+      )
+    ).toBe true
+
+    # redirect if path query params number doesn't matche current path
+    expect(
+      @tour._isRedirect(
+        '', '/somepath?search=true&foo=bar', href: '', pathname: '/somepath', search: '?foo=bar', hash: ''
+      )
+    ).toBe true
+
     # don't redirect if path with query params matches current path
-    expect(@tour._isRedirect('/somepath?search=true', '/somepath')).toBe false
-    # don't redirect if path with slash and query params matches current path
-    expect(@tour._isRedirect('/somepath/?search=true', '/somepath')).toBe false
+    expect(
+      @tour._isRedirect(
+        '', '/somepath?search=true&foo=bar', href: '', pathname: '/somepath', search: '?foo=bar&search=true', hash: ''
+      )
+    ).toBe false
+
+    # don't redirect if path with query params matches current path
+    expect(
+      @tour._isRedirect(
+        '', '/somepath?search=true&foo=bar', href: '', pathname: '/somepath', search: '?search=true&foo=bar', hash:''
+      )
+    ).toBe false
+
+    # redirect if path with one hash param doesn't matche current path
+    expect(
+      @tour._isRedirect(
+        '', '/somepath#search=true', href: '', pathname: '/somepath', search: '', hash: ''
+      )
+    ).toBe true
+
+    # redirect if path with slash and one hash param doesn't matche current path
+    expect(
+      @tour._isRedirect(
+        '', '/somepath/#search=true', href: '', pathname: '/somepath', search: '', hash: ''
+      )
+    ).toBe true
+
+    # redirect if path with more than one hash params doesn't matche current path
+    expect(
+      @tour._isRedirect(
+        '', '/somepath#search=true&foo=bar', href: '', pathname: '/somepath', search: '', hash: ''
+      )
+    ).toBe true
+
+    # redirect if path hash params number doesn't matche current path
+    expect(
+      @tour._isRedirect(
+        '', '/somepath#search=true&foo=bar', href: '', pathname: '/somepath', search: '', hash: '#search=true'
+      )
+    ).toBe true
+
+    # redirect if path hash params number doesn't matche current path
+    expect(
+      @tour._isRedirect(
+        '', '/somepath#search=true&foo=bar', href: '', pathname: '/somepath', search: '', hash: '#foo=bar'
+      )
+    ).toBe true
+
+    # don't redirect if path with hash params matches current path
+    expect(
+      @tour._isRedirect(
+        '', '/somepath#search=true&foo=bar', href: '', pathname: '/somepath', search: '', hash: '#foo=bar&search=true'
+      )
+    ).toBe false
+
+    # don't redirect if path with hash params matches current path
+    expect(
+      @tour._isRedirect(
+        '', '/somepath#search=true&foo=bar', href: '', pathname: '/somepath', search: '', hash: '#search=true&foo=bar'
+      )
+    ).toBe false
+
     # don't redirect if current path matches path regex
-    expect(@tour._isRedirect /some*/, '/somepath').toBe false
+    expect(
+      @tour._isRedirect(
+        '', /some*/, href: '', pathname: '/somepath', search: '', hash: ''
+      )
+    ).toBe false
 
   it '`_getState` should return null after `_removeState` with null value', ->
     @tour = new Tour
@@ -478,6 +625,37 @@ describe 'Bootstrap Tour', ->
     @tour.next()
     expect($element.hasClass('tour-step-element-reflex')).toBe false
 
+  it 'should add `tour-step-element-reflex` class to reflexElement if reflex is defined', ->
+    @tour = new Tour
+    $element = $('<div></div>').appendTo('body')
+    $definedElement = $('<div id="ref"></div>').appendTo('body')
+    @tour.addStep
+      element: $element
+      reflex: true
+      reflexElement: '#ref'
+    @tour.addStep(element: $('<div></div>').appendTo('body'))
+    expect($element.hasClass('tour-step-element-reflex')).toBe false
+    expect($definedElement.hasClass('tour-step-element-reflex')).toBe false
+    @tour.start()
+    expect($element.hasClass('tour-step-element-reflex')).toBe false
+    expect($definedElement.hasClass('tour-step-element-reflex')).toBe true
+    @tour.next()
+    expect($element.hasClass('tour-step-element-reflex')).toBe false
+    expect($definedElement.hasClass('tour-step-element-reflex')).toBe false
+
+  it 'should add `tour-{tourName}-reflex` class to the step popover if reflex is active', ->
+    @tour = new Tour
+    $element = $('<div></div>').appendTo('body')
+    @tour.addStep
+      element: $element
+      reflex: true
+    @tour.addStep(element: $('<div></div>').appendTo('body'))
+    expect($('.popover').hasClass("tour-#{@tour._options.name}-reflex")).toBe false
+    @tour.start()
+    expect($('.popover').hasClass("tour-#{@tour._options.name}-reflex")).toBe true
+    @tour.next()
+    expect($('.popover').hasClass("tour-#{@tour._options.name}-reflex")).toBe false
+
   it '`showStep` redirects to the anchor when the path is an anchor', ->
     @tour = new Tour
     @tour.addStep
@@ -487,6 +665,16 @@ describe 'Bootstrap Tour', ->
     expect(document.location.hash).toBe '#mytest' # Tour step has moved to the anchor
     document.location.hash = ''
 
+  it '`showStep` show the step when the path is an anchor', ->
+    current_path = location.pathname
+    @tour = new Tour
+    @tour.addStep
+      element: $('<div></div>').appendTo('body')
+      path: "#{current_path}#mytest"
+    @tour.showStep(0)
+    expect(@tour.getStep(0).element.data('bs.popover').tip().filter(':visible').length).toBe 1 # tour shows correct step
+    document.location.hash = ''
+
   it '`backdrop` parameter should show backdrop with step', ->
     @tour = new Tour
     @tour.addStep
@@ -550,7 +738,38 @@ describe 'Bootstrap Tour', ->
       path: 'test.html'
 
     # Tour adds basePath to step path
-    expect(@tour._isRedirect(@tour._options.basePath + @tour.getStep(0).path, 'test/test.html')).toBe false
+    expect(
+      @tour._isRedirect(
+        @tour.getStep(0).host,
+        @tour._options.basePath + @tour.getStep(0).path,
+        href: '', pathname: 'test/test.html', search: '', hash: ''
+      )
+    ).toBe false
+
+  it 'should redirect to the steps if host is different', ->
+    @tour = new Tour
+    current_host = document.location.host
+
+    @tour.addStep
+      element: $('<div></div>').appendTo('body')
+      path: 'test.html'
+      host: 'http://sub.exemple.com'
+
+    expect(
+      @tour._isRedirect(
+        @tour.getStep(0).host,
+        @tour._options.basePath + @tour.getStep(0).path,
+        href: 'http://exemple.com/test.html' , pathname: 'test.html', search: '', hash: ''
+      )
+    ).toBe true
+
+    expect(
+      @tour._isRedirect(
+        current_host,
+        @tour._options.basePath + @tour.getStep(0).path,
+        href: "http://#{current_host}/test.html" , pathname: 'test.html', search: '', hash: ''
+      )
+    ).toBe false
 
   it 'with `onNext` option should run the callback before showing the next step', ->
     tour_test = 0
@@ -607,6 +826,18 @@ describe 'Bootstrap Tour', ->
     @tour.prev()
     expect(tour_test).toBe 2 # tour runs onPrev when prev step is called
 
+  it 'with `onRedirectError` option should run the callback when redirection failed', ->
+    tour_test = 0
+    @tour = new Tour
+    @tour.addStep
+      element: $('<div></div>').appendTo('body')
+      path: '/path'
+      onRedirectError: -> tour_test = 2
+
+    @tour._setState 'redirect_to', 0 # tour has previously redirected to step '0'
+    @tour.start()
+    expect(tour_test).toBe 2 # tour runs onRedirectError when redirection failed
+
   it 'should render custom navigation template', ->
     @tour = new Tour
       template:
@@ -686,6 +917,32 @@ describe 'Bootstrap Tour', ->
     expect($('.popover').hasClass('orphan')).toBe true
     $('.popover').remove()
 
+  it 'should use orphan template to show orphan steps', ->
+    @tour = new Tour
+    step = orphan: '<div class="popover orphan-custom-template"></div>'
+    @tour.addStep step
+    template = @tour._template(step, 0)
+
+    expect($(template).hasClass('orphan-custom-template')).toBe true
+
+  it 'should not use orphan template to show steps', ->
+    @tour = new Tour
+    step =
+      orphan: '<div class="popover orphan-custom-template"></div>'
+      element: $('<div></div>').appendTo('body')
+    @tour.addStep step
+    template = @tour._template(step, 0)
+
+    expect($(template).hasClass('orphan-custom-template')).toBe false
+
+  it 'should execute orphan template if it is a function', ->
+    @tour = new Tour
+    step = orphan: -> '<div class="popover orphan-custom-template"></div>'
+    @tour.addStep step
+    template = @tour._template(step, 0)
+
+    expect($(template).hasClass('orphan-custom-template')).toBe true
+
   it 'handles quota_exceeded exceptions', ->
     @tour = new Tour
     @tour.addStep(element: $('<div></div>').appendTo('body'))
diff --git a/src/docs/_includes/footer.html b/src/docs/_includes/footer.html
index ea93f42..0a0274a 100644
--- a/src/docs/_includes/footer.html
+++ b/src/docs/_includes/footer.html
@@ -12,3 +12,4 @@ window.twttr = (function (d,s,id) {
   return window.twttr || (t = { _e: [], ready: function(f){ t._e.push(f) } });
 }(document, "script", "twitter-wjs"));
 </script>
+<script src="//my.hellobar.com/8de0c45141ba6289e0a9d247b192ae3b42875f9d.js" type="text/javascript" charset="utf-8" async="async"></script>
diff --git a/src/docs/api.html b/src/docs/api.html
index 39a3ac2..feb2661 100644
--- a/src/docs/api.html
+++ b/src/docs/api.html
@@ -15,10 +15,12 @@ var tour = new Tour({
   name: "tour",
   steps: [],
   container: "body",
+  smartPlacement: true,
   keyboard: true,
   storage: window.localStorage,
   debug: false,
   backdrop: false,
+  backdropContainer: 'body',
   backdropPadding: 0,
   redirect: true,
   orphan: false,
@@ -35,7 +37,6 @@ var tour = new Tour({
         <button class='btn btn-default' data-role='next'>Next »</button>
     </div>
     <button class='btn btn-default' data-role='end'>End tour</button>
-    </nav>
   </div>",
   afterGetState: function (key, value) {},
   afterSetState: function (key, value) {},
@@ -49,7 +50,8 @@ var tour = new Tour({
   onNext: function (tour) {},
   onPrev: function (tour) {},
   onPause: function (tour, duration) {},
-  onResume: function (tour, duration) {}
+  onResume: function (tour, duration) {},
+  onRedirectError: function (tour) {}
 });
 {% endhighlight %}
     <table class="table  table-bordered table-striped">
@@ -88,6 +90,12 @@ var tour = new Tour({
           <td><code>'body'</code></td>
         </tr>
         <tr>
+          <td>smartPlacement</td>
+          <td>Boolean</td>
+          <td>It dynamically reorients the popover by default by specifying auto for the placement, every time.<br></td>
+          <td><code>true</code></td>
+        </tr>
+        <tr>
           <td>autoscroll</td>
           <td>Boolean</td>
           <td>Autoscrolls the window when the step popover is out of view.</td>
@@ -127,6 +135,12 @@ var tour = new Tour({
           <td><code>false</code></td>
         </tr>
         <tr class="success">
+          <td>backdropContainer <span class="label label-success">NEW</span></td>
+          <td>String (jQuery selector)</td>
+          <td>HTML element on which the backdrop should be shown.</td>
+          <td><code>'body'</code></td>
+        </tr>
+        <tr class="success">
           <td>backdropPadding <span class="label label-success">NEW</span></td>
           <td>Number|Object</td>
           <td>Add padding to the backdrop element that highlights the step element.<br>
@@ -143,7 +157,7 @@ var tour = new Tour({
         </tr>
         <tr>
           <td>orphan</td>
-          <td>Boolean</td>
+          <td>Boolean|String|function</td>
           <td>Allow to show the step regardless whether its element is not set, is
           not present in the page or is hidden. The step is fixed
           positioned in the middle of the page.</td>
@@ -306,6 +320,14 @@ var tour = new Tour({
           remaining duration.</td>
           <td><code>function (tour, duration) { }</code></td>
         </tr>
+        </tr>
+        <tr class="success">
+          <td>onRedirectError <span class="label label-success">NEW</span></td>
+          <td>Function</td>
+          <td>Function to execute when there is a redirection error. This
+            happens when bootstrap tour cannot redirect to the path of the step</td>
+          <td><code>function (tour) { }</code></td>
+        </tr>
       </tbody>
     </table>
     <a id="step-options"></a>
@@ -313,8 +335,10 @@ var tour = new Tour({
 {% highlight javascript %}
 tour.addStep({
   path: "",
+  host: "",
   element: "",
   placement: "right",
+  smartPlacement: true,
   title: "",
   content: "",
   next: 0,
@@ -322,6 +346,7 @@ tour.addStep({
   animation: true,
   container: "body",
   backdrop: false,
+  backdropContainer: 'body',
   backdropPadding: false,
   redirect: true,
   reflex: false,
@@ -334,7 +359,8 @@ tour.addStep({
   onNext: function (tour) {},
   onPrev: function (tour) {},
   onPause: function (tour) {},
-  onResume: function (tour) {}
+  onResume: function (tour) {},
+  onRedirectError: function (tour) {}
 });
 {% endhighlight %}
     <table class="table  table-bordered table-striped">
@@ -354,6 +380,14 @@ tour.addStep({
           allows you to build tours that span several pages!</td>
           <td><code>''</code></td>
         </tr>
+      <tbody>
+        <tr class="success">
+          <td>host <span class="label label-success">NEW</span></td>
+          <td>String</td>
+          <td>Host of the page on which the step should be shown. This
+            allows you to build tours for several sub-domains</td>
+          <td><code>''</code></td>
+        </tr>
         <tr>
           <td>element</td>
           <td>String (jQuery selector)</td>
@@ -368,11 +402,21 @@ tour.addStep({
           <code>'top'</code>,
           <code>'bottom'</code>,
           <code>'left'</code>,
-          <code>'right'</code>.
+          <code>'right'</code>,
+          <code>'auto'</code>.
+          When "auto" is specified, it will dynamically reorient the popover.
+          For example, if placement is "auto left", the popover will display to
+          the left when possible, otherwise it will display right.
           </td>
           <td><code>'right'</code></td>
         </tr>
         <tr>
+          <td>smartPlacement</td>
+          <td>Boolean</td>
+          <td>It dynamically reorients the popover by default by specifying auto for the placement.</td>
+          <td><code>true</code></td>
+        </tr>
+        <tr>
           <td>title</td>
           <td>String|Function</td>
           <td>Step title</td>
@@ -430,6 +474,12 @@ tour.addStep({
           <td><code>false</code></td>
         </tr>
         <tr class="success">
+          <td>backdropContainer <span class="label label-success">NEW</span></td>
+          <td>String (jQuery selector)</td>
+          <td>HTML element on which the backdrop should be shown.</td>
+          <td><code>'body'</code></td>
+        </tr>
+        <tr class="success">
           <td>backdropPadding <span class="label label-success">NEW</span></td>
           <td>Boolean|Object</td>
           <td>Add padding to the backdrop element that highlights the step element.<br>
@@ -454,10 +504,12 @@ tour.addStep({
         </tr>
         <tr>
           <td>orphan</td>
-          <td>Boolean</td>
+          <td>Boolean|String|Function</td>
           <td>Allow to show the step regardless whether its element is not set, is
           not present in the page or is hidden. The step is fixed
-          positioned in the middle of the page.</td>
+          positioned in the middle of the page.<br>
+          You can use a string or function that returns a string of the HTML template for
+          the orphan popovers</td>
           <td><code>false</code></td>
         </tr>
         <tr class="success">
@@ -557,6 +609,14 @@ tour.addStep({
           <code>onResume</code> option</td>
           <td><code>function (tour, duration) { }</code></td>
         </tr>
+        <tr class="success">
+          <td>onRedirectError <span class="label label-success">NEW</span></td>
+          <td>Function</td>
+          <td>Function to execute when there is a redirection error. This
+            happens when bootstrap tour cannot redirect to the path of the step. It overrides the global
+            <code>onRedirectError</code> option</td>
+          <td><code>function (tour) { }</code></td>
+        </tr>
       </tbody>
     </table>
   </div>
@@ -646,6 +706,11 @@ tour.addStep({
           <td>Override the current step. Pass <code>i</code>
           as the index of the step in the tour (0-based).</td>
         </tr>
+        <tr>
+          <td>redraw()</td>
+          <td>Triggers a redraw on the overlay element.  Useful for
+          Dynamically sized tour targets.</td>
+        </tr>
       </tbody>
     </table>
   </div>
diff --git a/src/docs/assets/css/bootstrap-tour.css b/src/docs/assets/css/bootstrap-tour.css
index b730758..1b35295 100644
--- a/src/docs/assets/css/bootstrap-tour.css
+++ b/src/docs/assets/css/bootstrap-tour.css
@@ -1,15 +1,15 @@
 /* ========================================================================
- * bootstrap-tour - v0.10.1
+ * bootstrap-tour - v0.10.2
  * http://bootstraptour.com
  * ========================================================================
- * Copyright 2012-2013 Ulrich Sossou
+ * Copyright 2012-2015 Ulrich Sossou
  *
  * ========================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *     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,
@@ -33,7 +33,6 @@
 .tour-step-backdrop {
   position: relative;
   z-index: 1101;
-  background: inherit;
 }
 .tour-step-backdrop > td {
   position: relative;
@@ -46,7 +45,7 @@
   border-radius: 6px;
 }
 .popover[class*="tour-"] {
-  z-index: 1100;
+  z-index: 1102;
 }
 .popover[class*="tour-"] .popover-navigation {
   padding: 9px 14px;
diff --git a/src/docs/assets/css/bootstrap-tour.docs.css b/src/docs/assets/css/bootstrap-tour.docs.css
index 2c05e71..3a5e781 100644
--- a/src/docs/assets/css/bootstrap-tour.docs.css
+++ b/src/docs/assets/css/bootstrap-tour.docs.css
@@ -7,7 +7,6 @@ body {
   position: absolute;
   width: 150px;
   height: 150px;
-  top: 0;
   right: 0;
   z-index: 1050;
 }
diff --git a/src/docs/index.html b/src/docs/index.html
index 18ad4ed..0797886 100644
--- a/src/docs/index.html
+++ b/src/docs/index.html
@@ -101,7 +101,7 @@ tour.start();
     <div class="page-header">
       <h2>The License <small>It's free!</small></h2>
     </div>
-    <p>Code licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License v2.0</a>.<br>
+    <p>Code licensed under the <a href="https://opensource.org/licenses/MIT" target="_blank">MIT license</a>.<br>
     Documentation licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
   </div>
 </section>
diff --git a/src/less/bootstrap-tour-standalone.less b/src/less/bootstrap-tour-standalone.less
index b09d3ba..53e77ce 100644
--- a/src/less/bootstrap-tour-standalone.less
+++ b/src/less/bootstrap-tour-standalone.less
@@ -12,4 +12,5 @@
 @import "@{bootstrap-path}buttons.less";
 @import "@{bootstrap-path}button-groups.less";
 @import "@{bootstrap-path}popovers.less";
+ at import "@{bootstrap-path}component-animations.less";
 @import "bootstrap-tour.less";
diff --git a/src/less/bootstrap-tour.less b/src/less/bootstrap-tour.less
index 4292840..ab5f9fc 100644
--- a/src/less/bootstrap-tour.less
+++ b/src/less/bootstrap-tour.less
@@ -13,8 +13,7 @@
 .tour-step-backdrop {
   position: relative;
   z-index: 1101;
-  background: inherit;
-
+  
   > td {
     position: relative;
     z-index: 1101;
@@ -29,7 +28,7 @@
 }
 
 .popover[class*="tour-"] {
-  z-index: 1100;
+  z-index: 1102;
 
   .popover-navigation {
     padding: 9px 14px;
diff --git a/test/bootstrap-tour.js b/test/bootstrap-tour.js
index 1874061..009525a 100644
--- a/test/bootstrap-tour.js
+++ b/test/bootstrap-tour.js
@@ -1,15 +1,15 @@
 /* ========================================================================
- * bootstrap-tour - v0.10.1
+ * bootstrap-tour - v0.10.2
  * http://bootstraptour.com
  * ========================================================================
- * Copyright 2012-2013 Ulrich Sossou
+ * Copyright 2012-2015 Ulrich Sossou
  *
  * ========================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *     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,
@@ -39,6 +39,7 @@
         storage: storage,
         debug: false,
         backdrop: false,
+        backdropContainer: 'body',
         backdropPadding: 0,
         redirect: true,
         orphan: false,
@@ -58,10 +59,12 @@
         onNext: function(tour) {},
         onPrev: function(tour) {},
         onPause: function(tour, duration) {},
-        onResume: function(tour, duration) {}
+        onResume: function(tour, duration) {},
+        onRedirectError: function(tour) {}
       }, options);
       this._force = false;
       this._inited = false;
+      this._current = null;
       this.backdrop = {
         overlay: null,
         $element: null,
@@ -91,6 +94,7 @@
         return $.extend({
           id: "step-" + i,
           path: '',
+          host: '',
           placement: 'right',
           title: '',
           content: '<p></p>',
@@ -100,8 +104,10 @@
           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,
           orphan: this._options.orphan,
           duration: this._options.duration,
           delay: this._options.delay,
@@ -113,7 +119,8 @@
           onNext: this._options.onNext,
           onPrev: this._options.onPrev,
           onPause: this._options.onPause,
-          onResume: this._options.onResume
+          onResume: this._options.onResume,
+          onRedirectError: this._options.onRedirectError
         }, this._options.steps[i]);
       }
     };
@@ -199,6 +206,7 @@
     Tour.prototype.restart = function() {
       this._removeState('current_step');
       this._removeState('end');
+      this._removeState('redirect_to');
       return this.start();
     };
 
@@ -257,8 +265,9 @@
             $element = $('body');
           }
           $element.popover('destroy').removeClass("tour-" + _this._options.name + "-element tour-" + _this._options.name + "-" + i + "-element");
+          $element.removeData('bs.popover');
           if (step.reflex) {
-            $element.removeClass('tour-step-element-reflex').off("" + (_this._reflexEvent(step.reflex)) + ".tour-" + _this._options.name);
+            $(step.reflexElement).removeClass('tour-step-element-reflex').off("" + (_this._reflexEvent(step.reflex)) + ".tour-" + _this._options.name);
           }
           if (step.backdrop) {
             _this._hideBackdrop();
@@ -286,7 +295,7 @@
       promise = this._makePromise(step.onShow != null ? step.onShow(this, i) : void 0);
       showStepHelper = (function(_this) {
         return function(e) {
-          var current_path, path, showPopoverAndOverlay;
+          var path, showPopoverAndOverlay;
           _this.setCurrentStep(i);
           path = (function() {
             switch ({}.toString.call(step.path)) {
@@ -298,13 +307,14 @@
                 return step.path;
             }
           }).call(_this);
-          current_path = [document.location.pathname, document.location.hash].join('');
-          if (_this._isRedirect(path, current_path)) {
-            _this._redirect(step, path);
-            return;
+          if (_this._isRedirect(step.host, path, document.location)) {
+            _this._redirect(step, i, path);
+            if (!_this._isJustPathHashDifferent(step.host, path, document.location)) {
+              return;
+            }
           }
           if (_this._isOrphan(step)) {
-            if (!step.orphan) {
+            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();
@@ -316,10 +326,10 @@
             _this._debug("Show the orphan step " + (_this._current + 1) + ". Orphans option is true.");
           }
           if (step.backdrop) {
-            _this._showBackdrop(!_this._isOrphan(step) ? step.element : void 0);
+            _this._showBackdrop(step);
           }
           showPopoverAndOverlay = function() {
-            if (_this.getCurrentStep() !== i) {
+            if (_this.getCurrentStep() !== i || _this.ended()) {
               return;
             }
             if ((step.element != null) && step.backdrop) {
@@ -369,6 +379,10 @@
       return this;
     };
 
+    Tour.prototype.redraw = function() {
+      return this._showOverlayElement(this.getStep(this.getCurrentStep()).element, true);
+    };
+
     Tour.prototype._setState = function(key, value) {
       var e, keyName;
       if (this._options.storage) {
@@ -450,16 +464,54 @@
       }
     };
 
-    Tour.prototype._isRedirect = function(path, currentPath) {
-      return (path != null) && path !== '' && (({}.toString.call(path) === '[object RegExp]' && !path.test(currentPath)) || ({}.toString.call(path) === '[object String]' && path.replace(/\?.*$/, '').replace(/\/?$/, '') !== currentPath.replace(/\/?$/, '')));
+    Tour.prototype._isRedirect = function(host, path, location) {
+      var currentPath;
+      if (host !== '') {
+        if (this._isHostDifferent(host, location.href)) {
+          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, currentURL) {
+      return this._getProtocol(host) !== this._getProtocol(currentURL) || this._getHost(host) !== this._getHost(currentURL);
+    };
+
+    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 !== '') {
+        if (this._isHostDifferent(host, location.href)) {
+          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, path) {
+    Tour.prototype._redirect = function(step, i, path) {
       if ($.isFunction(step.redirect)) {
         return step.redirect.call(this, path);
       } else if (step.redirect === true) {
-        this._debug("Redirect to " + path);
-        return document.location.href = path;
+        this._debug("Redirect to " + step.host + path);
+        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 = "" + step.host + path;
+        }
       }
     };
 
@@ -472,7 +524,7 @@
     };
 
     Tour.prototype._showPopover = function(step, i) {
-      var $element, $tip, isOrphan, options;
+      var $element, $tip, isOrphan, options, shouldAddSmart;
       $(".tour-" + this._options.name).remove();
       options = $.extend({}, this._options);
       isOrphan = this._isOrphan(step);
@@ -487,9 +539,7 @@
         $.extend(options, step.options);
       }
       if (step.reflex && !isOrphan) {
-        $element.addClass('tour-step-element-reflex');
-        $element.off("" + (this._reflexEvent(step.reflex)) + ".tour-" + this._options.name);
-        $element.on("" + (this._reflexEvent(step.reflex)) + ".tour-" + this._options.name, (function(_this) {
+        $(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();
@@ -499,8 +549,9 @@
           };
         })(this));
       }
+      shouldAddSmart = step.smartPlacement === true && step.placement.search(/auto/i) === -1;
       $element.popover({
-        placement: step.placement,
+        placement: shouldAddSmart ? "auto " + step.placement : step.placement,
         trigger: 'manual',
         title: step.title,
         content: step.content,
@@ -519,8 +570,12 @@
     };
 
     Tour.prototype._template = function(step, i) {
-      var $navigation, $next, $prev, $resume, $template;
-      $template = $.isFunction(step.template) ? $(step.template(i, step)) : $(step.template);
+      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"]');
@@ -529,11 +584,16 @@
         $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');
+        $prev.prop('disabled', true);
       }
       if (step.next < 0) {
         $next.addClass('disabled');
+        $next.prop('disabled', true);
       }
       if (!step.duration) {
         $resume.remove();
@@ -704,7 +764,7 @@
       }
     };
 
-    Tour.prototype._showBackdrop = function(element) {
+    Tour.prototype._showBackdrop = function(step) {
       if (this.backdrop.backgroundShown) {
         return;
       }
@@ -712,7 +772,7 @@
         "class": 'tour-backdrop'
       });
       this.backdrop.backgroundShown = true;
-      return $('body').append(this.backdrop);
+      return $(step.backdropContainer).append(this.backdrop);
     };
 
     Tour.prototype._hideBackdrop = function() {
@@ -728,23 +788,25 @@
       }
     };
 
-    Tour.prototype._showOverlayElement = function(step) {
+    Tour.prototype._showOverlayElement = function(step, force) {
       var $element, elementData;
       $element = $(step.element);
-      if (!$element || $element.length === 0 || this.backdrop.overlayElementShown) {
+      if (!$element || $element.length === 0 || this.backdrop.overlayElementShown && !force) {
         return;
       }
-      this.backdrop.overlayElementShown = true;
-      this.backdrop.$element = $element.addClass('tour-step-backdrop');
-      this.backdrop.$background = $('<div>', {
-        "class": 'tour-step-background'
-      });
+      if (!this.backdrop.overlayElementShown) {
+        this.backdrop.$element = $element.addClass('tour-step-backdrop');
+        this.backdrop.$background = $('<div>', {
+          "class": 'tour-step-background'
+        });
+        this.backdrop.$background.appendTo(step.backdropContainer);
+        this.backdrop.overlayElementShown = true;
+      }
       elementData = {
         width: $element.innerWidth(),
         height: $element.innerHeight(),
         offset: $element.offset()
       };
-      this.backdrop.$background.appendTo('body');
       if (step.backdropPadding) {
         elementData = this._applyBackdropPadding(step.backdropPadding, elementData);
       }
@@ -795,6 +857,69 @@
       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, v;
+      if ({}.toString.call(obj1) === '[object Object]' && {}.toString.call(obj2) === '[object Object]') {
+        for (k in obj1) {
+          v = obj1[k];
+          if (obj2[k] !== v) {
+            return false;
+          }
+        }
+        for (k in obj2) {
+          v = obj2[k];
+          if (obj1[k] !== v) {
+            return false;
+          }
+        }
+        return true;
+      }
+      return obj1 === obj2;
+    };
+
     return Tour;
 
   })();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-bootstrap-tour.git



More information about the Pkg-javascript-commits mailing list