").parent().html();
- $element.popover({
- placement: step.placement,
- trigger: "manual",
- title: step.title,
- content: step.content,
- html: true,
- animation: step.animation,
- container: step.container,
- template: step.template,
- selector: step.element
- }).popover("show");
- $tip = $element.data("bs.popover") ? $element.data("bs.popover").tip() : $element.data("popover").tip();
- $tip.attr("id", step.id);
- this._scrollIntoView($tip);
- this._reposition($tip, step);
- if (isOrphan) {
- return this._center($tip);
- }
- };
+ };
+ })(this));
+ }
+ if (step.prev < 0) {
+ $navigation.find("[data-role='prev']").addClass("disabled");
+ }
+ if (step.next < 0) {
+ $navigation.find("[data-role='next']").addClass("disabled");
+ }
+ if (!step.duration) {
+ $navigation.find("[data-role='pause-resume']").remove();
+ }
+ step.template = $template.clone().wrap("
").parent().html();
+ $element.popover({
+ placement: step.placement,
+ trigger: "manual",
+ title: step.title,
+ content: step.content,
+ html: true,
+ animation: step.animation,
+ container: step.container,
+ template: step.template,
+ selector: step.element
+ }).popover("show");
+ $tip = $element.data("bs.popover") ? $element.data("bs.popover").tip() : $element.data("popover").tip();
+ $tip.attr("id", step.id);
+ this._reposition($tip, step);
+ if (isOrphan) {
+ return this._center($tip);
+ }
+ };
- Tour.prototype._reposition = function($tip, step) {
- var offsetBottom, offsetHeight, offsetRight, offsetWidth, originalLeft, originalTop, tipOffset;
- offsetWidth = $tip[0].offsetWidth;
- offsetHeight = $tip[0].offsetHeight;
- tipOffset = $tip.offset();
- originalLeft = tipOffset.left;
- originalTop = tipOffset.top;
- offsetBottom = $(document).outerHeight() - tipOffset.top - $tip.outerHeight();
- if (offsetBottom < 0) {
- tipOffset.top = tipOffset.top + offsetBottom;
+ Tour.prototype._reposition = function($tip, step) {
+ var offsetBottom, offsetHeight, offsetRight, offsetWidth, originalLeft, originalTop, tipOffset;
+ offsetWidth = $tip[0].offsetWidth;
+ offsetHeight = $tip[0].offsetHeight;
+ tipOffset = $tip.offset();
+ originalLeft = tipOffset.left;
+ originalTop = tipOffset.top;
+ offsetBottom = $(document).outerHeight() - tipOffset.top - $tip.outerHeight();
+ if (offsetBottom < 0) {
+ tipOffset.top = tipOffset.top + offsetBottom;
+ }
+ offsetRight = $("html").outerWidth() - tipOffset.left - $tip.outerWidth();
+ if (offsetRight < 0) {
+ tipOffset.left = tipOffset.left + offsetRight;
+ }
+ if (tipOffset.top < 0) {
+ tipOffset.top = 0;
+ }
+ if (tipOffset.left < 0) {
+ tipOffset.left = 0;
+ }
+ $tip.offset(tipOffset);
+ if (step.placement === "bottom" || step.placement === "top") {
+ if (originalLeft !== tipOffset.left) {
+ return this._replaceArrow($tip, (tipOffset.left - originalLeft) * 2, offsetWidth, "left");
}
- offsetRight = $("html").outerWidth() - tipOffset.left - $tip.outerWidth();
- if (offsetRight < 0) {
- tipOffset.left = tipOffset.left + offsetRight;
+ } else {
+ if (originalTop !== tipOffset.top) {
+ return this._replaceArrow($tip, (tipOffset.top - originalTop) * 2, offsetHeight, "top");
}
- if (tipOffset.top < 0) {
- tipOffset.top = 0;
- }
- if (tipOffset.left < 0) {
- tipOffset.left = 0;
- }
- $tip.offset(tipOffset);
- if (step.placement === "bottom" || step.placement === "top") {
- if (originalLeft !== tipOffset.left) {
- return this._replaceArrow($tip, (tipOffset.left - originalLeft) * 2, offsetWidth, "left");
+ }
+ };
+
+ Tour.prototype._center = function($tip) {
+ return $tip.css("top", $(window).outerHeight() / 2 - $tip.outerHeight() / 2);
+ };
+
+ Tour.prototype._replaceArrow = function($tip, delta, dimension, position) {
+ return $tip.find(".arrow").css(position, delta ? 50 * (1 - delta / dimension) + "%" : "");
+ };
+
+ Tour.prototype._scrollIntoView = function(element, callback) {
+ var $element, $window, counter, offsetTop, scrollTop, windowHeight;
+ $element = $(element);
+ if (!$element.length) {
+ return callback();
+ }
+ $window = $(window);
+ offsetTop = $element.offset().top;
+ windowHeight = $window.height();
+ scrollTop = Math.max(0, offsetTop - (windowHeight / 2));
+ this._debug("Scroll into view. ScrollTop: " + scrollTop + ". Element offset: " + offsetTop + ". Window height: " + windowHeight + ".");
+ counter = 0;
+ return $("body,html").stop(true, true).animate({
+ scrollTop: Math.ceil(scrollTop)
+ }, (function(_this) {
+ return function() {
+ if (++counter === 2) {
+ callback();
+ return _this._debug("Scroll into view. Animation end element offset: " + ($element.offset().top) + ". Window height: " + ($window.height()) + ".");
}
+ };
+ })(this));
+ };
+
+ Tour.prototype._onResize = function(callback, timeout) {
+ return $(window).on("resize.tour-" + this._options.name, function() {
+ clearTimeout(timeout);
+ return timeout = setTimeout(callback, 100);
+ });
+ };
+
+ Tour.prototype._initMouseNavigation = function() {
+ var _this;
+ _this = this;
+ return $(document).off("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='prev']: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) {
+ return function(e) {
+ e.preventDefault();
+ return _this.next();
+ };
+ })(this)).on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='prev']:not(.disabled)", (function(_this) {
+ return function(e) {
+ e.preventDefault();
+ return _this.prev();
+ };
+ })(this)).on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='end']", (function(_this) {
+ return function(e) {
+ e.preventDefault();
+ return _this.end();
+ };
+ })(this)).on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='pause-resume']", function(e) {
+ var $this;
+ e.preventDefault();
+ $this = $(this);
+ $this.text(_this._paused ? $this.data("pause-text") : $this.data("resume-text"));
+ if (_this._paused) {
+ return _this.resume();
} else {
- if (originalTop !== tipOffset.top) {
- return this._replaceArrow($tip, (tipOffset.top - originalTop) * 2, offsetHeight, "top");
- }
+ return _this.pause();
}
- };
+ });
+ };
- Tour.prototype._center = function($tip) {
- return $tip.css("top", $(window).outerHeight() / 2 - $tip.outerHeight() / 2);
- };
-
- Tour.prototype._replaceArrow = function($tip, delta, dimension, position) {
- return $tip.find(".arrow").css(position, delta ? 50 * (1 - delta / dimension) + "%" : "");
- };
-
- Tour.prototype._scrollIntoView = function(tip) {
- return $("html, body").stop().animate({
- scrollTop: Math.ceil(tip.offset().top - ($(window).height() / 2))
- });
- };
-
- Tour.prototype._onResize = function(callback, timeout) {
- return $(window).on("resize.tour-" + this._options.name, function() {
- clearTimeout(timeout);
- return timeout = setTimeout(callback, 100);
- });
- };
-
- Tour.prototype._setupKeyboardNavigation = function() {
- var _this = this;
- if (this._options.keyboard) {
- return $(document).on("keyup.tour-" + this._options.name, function(e) {
- if (!e.which) {
- return;
- }
- switch (e.which) {
- case 39:
- e.preventDefault();
- if (_this._current < _this._steps.length - 1) {
- return _this.next();
- } else {
- return _this.end();
- }
- break;
- case 37:
- e.preventDefault();
- if (_this._current > 0) {
- return _this.prev();
- }
- break;
- case 27:
- e.preventDefault();
+ Tour.prototype._initKeyboardNavigation = function() {
+ if (!this._options.keyboard) {
+ return;
+ }
+ return $(document).on("keyup.tour-" + this._options.name, (function(_this) {
+ return function(e) {
+ if (!e.which) {
+ return;
+ }
+ switch (e.which) {
+ case 39:
+ e.preventDefault();
+ if (_this._isLast()) {
+ return _this.next();
+ } else {
return _this.end();
- }
- });
- }
- };
+ }
+ break;
+ case 37:
+ e.preventDefault();
+ if (_this._current > 0) {
+ return _this.prev();
+ }
+ break;
+ case 27:
+ e.preventDefault();
+ return _this.end();
+ }
+ };
+ })(this));
+ };
- Tour.prototype._makePromise = function(result) {
- if (result && $.isFunction(result.then)) {
- return result;
- } else {
- return null;
- }
- };
+ Tour.prototype._makePromise = function(result) {
+ if (result && $.isFunction(result.then)) {
+ return result;
+ } else {
+ return null;
+ }
+ };
- Tour.prototype._callOnPromiseDone = function(promise, cb, arg) {
- var _this = this;
- if (promise) {
- return promise.then(function(e) {
+ Tour.prototype._callOnPromiseDone = function(promise, cb, arg) {
+ if (promise) {
+ return promise.then((function(_this) {
+ return function(e) {
return cb.call(_this, arg);
- });
- } else {
- return cb.call(this, arg);
- }
- };
+ };
+ })(this));
+ } else {
+ return cb.call(this, arg);
+ }
+ };
- Tour.prototype._showBackdrop = function(element) {
- if (this.backdrop.overlay !== null) {
- return;
- }
- this._showOverlay();
- if (element != null) {
- return this._showOverlayElement(element);
- }
- };
+ Tour.prototype._showBackdrop = function(element) {
+ if (this.backdrop.backgroundShown) {
+ return;
+ }
+ this.backdrop = $("
", {
+ "class": "tour-backdrop"
+ });
+ this.backdrop.backgroundShown = true;
+ return $("body").append(this.backdrop);
+ };
- Tour.prototype._hideBackdrop = function() {
- if (this.backdrop.overlay === null) {
- return;
- }
- if (this.backdrop.$element) {
- this._hideOverlayElement();
- }
- return this._hideOverlay();
- };
+ Tour.prototype._hideBackdrop = function() {
+ this._hideOverlayElement();
+ return this._hideBackground();
+ };
- Tour.prototype._showOverlay = function() {
- this.backdrop = $("
", {
- "class": "tour-backdrop"
- });
- return $("body").append(this.backdrop);
- };
+ Tour.prototype._hideBackground = function() {
+ this.backdrop.remove();
+ this.backdrop.overlay = null;
+ return this.backdrop.backgroundShown = false;
+ };
- Tour.prototype._hideOverlay = function() {
- this.backdrop.remove();
- return this.backdrop.overlay = null;
- };
+ Tour.prototype._showOverlayElement = function(element) {
+ var $background, $element, offset;
+ $element = $(element);
+ if (!$element || $element.length === 0 || this.backdrop.overlayElementShown) {
+ return;
+ }
+ this.backdrop.overlayElementShown = true;
+ $background = $("
");
+ offset = $element.offset();
+ offset.top = offset.top;
+ offset.left = offset.left;
+ $background.width($element.innerWidth()).height($element.innerHeight()).addClass("tour-step-background").offset(offset);
+ $element.addClass("tour-step-backdrop");
+ $("body").append($background);
+ this.backdrop.$element = $element;
+ return this.backdrop.$background = $background;
+ };
- Tour.prototype._showOverlayElement = function(element) {
- var $background, $element, offset;
- $element = $(element);
- $background = $("
");
- offset = $element.offset();
- offset.top = offset.top;
- offset.left = offset.left;
- $background.width($element.innerWidth()).height($element.innerHeight()).addClass("tour-step-background").offset(offset);
- $element.addClass("tour-step-backdrop");
- $("body").append($background);
- this.backdrop.$element = $element;
- return this.backdrop.$background = $background;
- };
+ Tour.prototype._hideOverlayElement = function() {
+ if (!this.backdrop.overlayElementShown) {
+ return;
+ }
+ this.backdrop.$element.removeClass("tour-step-backdrop");
+ this.backdrop.$background.remove();
+ this.backdrop.$element = null;
+ this.backdrop.$background = null;
+ return this.backdrop.overlayElementShown = false;
+ };
- Tour.prototype._hideOverlayElement = function() {
- this.backdrop.$element.removeClass("tour-step-backdrop");
- this.backdrop.$background.remove();
- this.backdrop.$element = null;
- return this.backdrop.$background = null;
- };
+ Tour.prototype._clearTimer = function() {
+ window.clearTimeout(this._timer);
+ this._timer = null;
+ return this._duration = null;
+ };
- return Tour;
+ return Tour;
- })();
- return window.Tour = Tour;
- })(jQuery, window);
-
-}).call(this);
+ })();
+ return window.Tour = Tour;
+})(jQuery, window);
diff --git a/addons/website/static/src/js/website.tour.banner.js b/addons/website/static/src/js/website.tour.banner.js
index 65099d03986..443405e2401 100644
--- a/addons/website/static/src/js/website.tour.banner.js
+++ b/addons/website/static/src/js/website.tour.banner.js
@@ -15,7 +15,6 @@
popover: { next: _t("Start Tutorial"), end: _t("Skip It") },
},
{
- waitNot: '.popover.tour',
element: 'button[data-action=edit]',
placement: 'bottom',
title: _t("Edit this page"),
@@ -52,7 +51,6 @@
popover: { next: _t("Continue") },
},
{
- waitNot: '.popover.tour',
element: 'button[data-action=snippet]',
placement: 'bottom',
title: _t("Add Another Block"),
@@ -81,7 +79,6 @@
popover: { next: _t("Continue") },
},
{
- waitNot: '.popover.tour',
element: 'a[data-action=show-mobile-preview]',
placement: 'bottom',
title: _t("Test Your Mobile Version"),
diff --git a/addons/website/static/src/js/website.tour.js b/addons/website/static/src/js/website.tour.js
index fc0dd513cf2..df6108e0278 100644
--- a/addons/website/static/src/js/website.tour.js
+++ b/addons/website/static/src/js/website.tour.js
@@ -32,7 +32,7 @@ if (website.EditorBar) {
var self = this;
var menu = $('#help-menu');
_.each(website.Tour.tours, function (tour) {
- if (tour.mode != "tutorial") {
+ if (tour.mode === "test") {
return;
}
var $menuItem = $($.parseHTML('
'+tour.name+''));
@@ -90,16 +90,19 @@ website.Tour = {};
website.Tour.tours = {};
website.Tour.state = null;
website.Tour.register = function (tour) {
+ if (tour.mode !== "test") tour.mode = "tutorial";
website.Tour.tours[tour.id] = tour;
};
website.Tour.run = function (tour_id, mode) {
- if (localStorage.getItem("tour")) { // only one test running
+ if (localStorage.getItem("tour") && mode === "test") { // only one test running
return;
}
var tour = website.Tour.tours[tour_id];
- website.Tour.save_state(tour.id, mode || tour.mode, 0);
- if (tour.path) {
+ website.Tour.saveState(tour.id, mode || tour.mode, 0);
+ if (tour.path && !window.location.href.match(new RegExp("("+website.Tour.getLang()+")?"+tour.path+"#?$", "i"))) {
window.location.href = "/"+website.Tour.getLang()+tour.path;
+ } else {
+ website.Tour.running();
}
};
website.Tour.registerSteps = function (tour) {
@@ -114,48 +117,82 @@ website.Tour.registerSteps = function (tour) {
if (!step.waitNot && index > 0 && tour.steps[index-1] &&
tour.steps[index-1].popover && tour.steps[index-1].popover.next) {
- step.waitNot = '.popover.tour:visible';
+ step.waitNot = '.popover.tour.fade.in:visible';
}
if (!step.waitFor && index > 0 && tour.steps[index-1].snippet) {
step.waitFor = '.oe_overlay_options .oe_options:visible';
}
- if (!step.element) step.orphan = true;
-
- var snippet = step.element.match(/#oe_snippets (.*) \.oe_snippet_thumbnail/);
+ var snippet = step.element && step.element.match(/#oe_snippets (.*) \.oe_snippet_thumbnail/);
if (snippet) {
step.snippet = snippet[1];
} else if (step.snippet) {
step.element = '#oe_snippets '+step.snippet+' .oe_snippet_thumbnail';
}
+
+ if (!step.element) step.orphan = true;
}
if (tour.steps[index-1] &&
tour.steps[index-1].popover && tour.steps[index-1].popover.next) {
var step = {
- step_id: index,
- waitNot: '.popover.tour:visible'
+ id: index,
+ waitNot: '.popover.tour.fade.in:visible'
};
tour.steps.push(step);
}
// rendering bootstrap tour and popover
- if (tour.mode != "test" || typeof Tour !== "undefined") {
+ if (tour.mode !== "test" || typeof Tour !== "undefined") {
tour.tour = new Tour({
- name: this.id,
+ debug: true,
+ name: tour.id,
storage: localStorage,
keyboard: false,
- template: this.popover(),
+ template: website.Tour.popover(),
onHide: function () {
window.scrollTo(0, 0);
}
});
+
for (var index=0, len=tour.steps.length; index
-1) {
- tour_id = window.location.href.match(/#tutorial\.(.*)=true/)[1];
- mode = "tutorial";
- step_id = 0;
+website.Tour.getState = function () {
+ var state = JSON.parse(localStorage.getItem("tour") || 'false') || {};
+ var tour_id,mode,step_id;
+ if (!state.id && window.location.href.indexOf("#tutorial.") > -1) {
+ state = {
+ "id": window.location.href.match(/#tutorial\.(.*)=true/)[1],
+ "mode": "tutorial",
+ "step_id": 0
+ };
}
- if (!tour_id) {
+ if (!state.id) {
return;
}
- var tour = website.Tour.tours[tour_id];
- return {'tour': tour, 'tour_id': tour_id, 'mode': mode, 'step_id': step_id};
+ state.tour = website.Tour.tours[state.id];
+ state.step = state.tour.steps[state.step_id];
+ return state;
};
website.Tour.error = function (tour, step, message) {
website.Tour.reset();
throw new Error(message +
- + "\ntour:" + tour.id +
- + "\nstep:" + step.id + ": '" + (step._title || step.title) + "'"
+ + "\ntour: " + tour.id +
+ + "\nstep: " + step.id + ": '" + (step._title || step.title) + "'"
+ '\nhref: ' + window.location.href
+ '\nreferrer: ' + document.referrer
+ '\nelement: ' + Boolean(!step.element || ($(step.element).size() && $(step.element).is(":visible") && !$(step.element).is(":hidden")))
+ '\nwaitNot: ' + Boolean(!step.waitNot || !$(step.waitNot).size())
+ '\nwaitFor: ' + Boolean(!step.waitFor || $(step.waitFor).size())
- + "\nlocalStorage: " + localStorage.getItem("tour")
+ + "\nlocalStorage: " + JSON.stringify(localStorage)
+ '\n\n' + $("body").html()
);
};
@@ -206,24 +242,39 @@ website.Tour.lists = function () {
}
return tour_ids;
};
-website.Tour.save_state = function (tour_id, mode, step_id) {
- localStorage.setItem("tour", '{tour_id:'+tour_id+', mode:'+mode+', step_id:'+step_id+'}');
+website.Tour.saveState = function (tour_id, mode, step_id) {
+ localStorage.setItem("tour", JSON.stringify({"id":tour_id, "mode":mode, "step_id":step_id}));
};
website.Tour.reset = function () {
- var running = website.Tour.get_state();
- for (var k in running.tour.steps) {
- running.tour.steps[k].busy = false;
+ var state = website.Tour.getState();
+ if (state) {
+ for (var k in state.tour.steps) {
+ state.tour.steps[k].busy = false;
+ }
+ if (state.tour.tour) {
+ state.tour.tour.end();
+ }
}
localStorage.removeItem("tour");
clearTimeout(website.Tour.timer);
clearTimeout(website.Tour.testtimer);
- $('.popover.tour').remove();
+ $(".popover.tour").remove();
};
website.Tour.running = function () {
- var running = website.Tour.get_state();
- website.Tour.registerSteps(running.tour);
- website.Tour.nextStep( running.tour, running.step_id );
+ var state = website.Tour.getState();
+ if (state) {
+ website.Tour.registerSteps(state.tour);
+ if ($.ajaxBusy) {
+ $(document).ajaxStop(function() {
+ setTimeout(function () {
+ website.Tour.nextStep( state.tour, state.step, state.mode === "test" ? 5000 : 0 );
+ },0);
+ });
+ } else {
+ website.Tour.nextStep( state.tour, state.step, state.mode === "test" ? 5000 : 0 );
+ }
+ }
};
website.Tour.timer = null;
@@ -238,83 +289,62 @@ website.Tour.check = function (step) {
website.Tour.waitNextStep = function (tour, step, overlaps) {
var time = new Date().getTime();
var timer;
+ var next = tour.steps[step.id+1];
window.onbeforeunload = function () {
clearTimeout(website.Tour.timer);
clearTimeout(website.Tour.testtimer);
};
- // check popover activity
- $(".popover.tour button")
- .off()
- .on("click", function () {
- $(".popover.tour").remove();
- if (step.busy) return;
- if (!$(this).is("[data-role='next']")) {
- clearTimeout(website.Tour.timer);
- step.busy = true;
- if (tour.tour) {
- tour.tour.end();
- }
- tour.endTour(tour);
- }
- });
-
function checkNext () {
+ website.Tour.autoToggleBootstrapTour();
+
clearTimeout(website.Tour.timer);
- if (step.busy) return;
- if (website.Tour.check(step)) {
- step.busy = true;
+ if (next.busy) return;
+ if (website.Tour.check(next)) {
+ next.busy = true;
+ clearTimeout(website.Tour.currentTimer);
// use an other timeout for cke dom loading
setTimeout(function () {
- website.Tour.nextStep(tour, step, overlaps);
+ website.Tour.nextStep(tour, next, overlaps);
}, website.Tour.defaultDelay);
} else if (!overlaps || new Date().getTime() - time < overlaps) {
- if (self.current.element) {
- var $popover = $(".popover.tour");
- if(!$(self.current.element).is(":visible")) {
- $popover.data("hide", true).fadeOut(300);
- } else if($popover.data("hide")) {
- $popover.data("hide", false).fadeIn(150);
- }
- }
website.Tour.timer = setTimeout(checkNext, website.Tour.defaultDelay);
} else {
- website.Tour.error(tour, step, "Can't arrive to the next step");
+ website.Tour.error(tour, next, "Can't arrive to the next step");
}
}
checkNext();
};
+website.Tour.currentTimer = null;
website.Tour.nextStep = function (tour, step, overlaps) {
- var state = website.Tour.get_state();
- website.Tour.save_state(tour.id, state.mode, step.id);
+ var state = website.Tour.getState();
+ website.Tour.saveState(state.id, state.mode, step.id);
- // clear popover (fix for boostrap tour if the element is removed before destroy popover)
- $(".popover.tour").remove();
- // go to step in bootstrap tour
- if (tour.tour) {
- tour.tour.goto(step.id);
+ website.Tour.autoToggleBootstrapTour();
+
+ if (step.onload) {
+ step.onload();
}
- step.onload();
var next = tour.steps[step.id+1];
if (next) {
setTimeout(function () {
- website.Tour.waitNextStep(tour, next, overlaps);
+ website.Tour.waitNextStep(tour, step, overlaps);
if (state.mode === "test") {
setTimeout(function(){
website.Tour.autoNextStep(tour, step);
}, website.Tour.defaultDelay);
}
- }, next && next.wait || 0);
+ }, next.wait || 0);
} else {
website.Tour.endTour(tour);
}
};
website.Tour.endTour = function (tour) {
- var state = website.Tour.get_state();
- var test = state.step_id >= tour.steps.length-1;
- this.reset();
+ var state = website.Tour.getState();
+ var test = state.step.id >= state.tour.steps.length-1;
+ website.Tour.reset();
if (test) {
console.log('ok');
} else {
@@ -388,7 +418,8 @@ website.Tour.autoDragAndDropSnippet = function (selector) {
$dropZone.trigger($.Event("mouseup", { which: 1, pageX: dropPosition.left, pageY: dropPosition.top }));
};
-website.ready(website.Tour.running);
+//$(document).ready(website.Tour.running);
+website.ready().then(website.Tour.running);
}());