[FIX] website tour: test mode + add log

bzr revid: chm@openerp.com-20140415153734-5n2sz3xn01ydfeh6
This commit is contained in:
chm@openerp.com 2014-04-15 17:37:34 +02:00
parent a001e9c4bc
commit 9c0526b1bd
1 changed files with 6 additions and 4 deletions

View File

@ -98,15 +98,15 @@ var T = website.Tour = {
T.tours[tour.id] = tour;
},
run: function (tour_id, mode) {
if (localStorage.getItem("tour") && mode === "test") { // only one test running
return;
}
var tour = T.tours[tour_id];
this.time = new Date().getTime();
if (tour.path && !window.location.href.match(new RegExp("("+T.getLang()+")?"+tour.path+"#?$", "i"))) {
var href = "/"+T.getLang()+tour.path;
console.log("Tour Begin from run method (redirection to "+href+")");
T.saveState(tour.id, mode || tour.mode, -1);
window.location.href = "/"+T.getLang()+tour.path;
window.location.href = href;
} else {
console.log("Tour Begin from run method");
T.saveState(tour.id, mode || tour.mode, 0);
T.running();
}
@ -307,6 +307,7 @@ var T = website.Tour = {
"step_id": 0
};
window.location.hash = "";
console.log("Tour Begin from url hash");
T.saveState(state.id, state.mode, state.step_id);
}
if (!state.id || !T.tours[state.id]) {
@ -357,6 +358,7 @@ var T = website.Tour = {
function run () {
var state = T.getState();
if (state) {
console.log("Tour '"+state.id+"' is running");
T.registerSteps(state.tour);
T.nextStep();
}