From fc3aa070387226c05657c77122e71de9c42f957c Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Tue, 1 Sep 2015 09:51:57 +0200 Subject: [PATCH] Cleaning and remove useless files --- controllers/prototype/index.js | 2 +- .../prototype/views/prototype_arrows.jade | 26 ----------------- .../prototype/views/prototype_empty.jade | 25 ----------------- .../views/prototype_recommendation.jade | 8 ------ .../prototype/views/prototype_viewports.jade | 28 ------------------- js/l3d/apps/prototype/GlobalFunctions.js | 8 ++++++ js/l3d/apps/prototype/interactive/main.js | 20 ++++--------- .../apps/prototype/tutorial/TutorialSteps.js | 7 ----- js/l3d/apps/prototype/tutorial/main.js | 12 ++++---- 9 files changed, 19 insertions(+), 117 deletions(-) delete mode 100644 controllers/prototype/views/prototype_arrows.jade delete mode 100644 controllers/prototype/views/prototype_empty.jade delete mode 100644 controllers/prototype/views/prototype_viewports.jade diff --git a/controllers/prototype/index.js b/controllers/prototype/index.js index ee39760..461be29 100644 --- a/controllers/prototype/index.js +++ b/controllers/prototype/index.js @@ -171,5 +171,5 @@ module.exports.userstudy = function(req, res) { }; module.exports.next = function(req, res) { - res.redirect('/prototype/game') + res.redirect('/prototype/game'); }; diff --git a/controllers/prototype/views/prototype_arrows.jade b/controllers/prototype/views/prototype_arrows.jade deleted file mode 100644 index 272db79..0000000 --- a/controllers/prototype/views/prototype_arrows.jade +++ /dev/null @@ -1,26 +0,0 @@ -extends ./prototype_interactive - -block title - title #{title} - Prototype - Arrows - -block configjs - script Recommendation = L3D.ArrowRecommendation; - script. - Coin.onLastCoin = function() { - $('#next').show(); - $('#next').click(function() { - window.location = '/prototype/arrows'; - $('#next').click(function() {}); - }); - }; - -block lastbutton - button#next.btn.btn-success.navbar-btn(style={'margin-right':'10px', 'margin-bottom':'10px', 'display':'none'}) - span Go to the next step - -//-block preciseDescription - p - | Recommended views are displayed with a - | transparent blue arrow. They disappear when you - | come closer to them, and shows the motion between - | your current position and the recommendation. diff --git a/controllers/prototype/views/prototype_empty.jade b/controllers/prototype/views/prototype_empty.jade deleted file mode 100644 index 9dfdda3..0000000 --- a/controllers/prototype/views/prototype_empty.jade +++ /dev/null @@ -1,25 +0,0 @@ -extends ./prototype_interactive - -block title - title #{title} - Prototype - Arrows - -block configjs - script Recommendation = L3D.EmptyRecommendation; - script. - Coin.onLastCoin = function() { - $('#next').show(); - $('#next').click(function() { - window.location = '/prototype/arrows'; - }); - }; - -block lastbutton - button#next.btn.btn-success.navbar-btn(style={'margin-right':'10px', 'margin-bottom':'10px', 'display':'none'}) - span Go to the next step - -//-block preciseDescription - p - | Recommended views are displayed with a - | transparent blue arrow. They disappear when you - | come closer to them, and shows the motion between - | your current position and the recommendation. diff --git a/controllers/prototype/views/prototype_recommendation.jade b/controllers/prototype/views/prototype_recommendation.jade index ea9f4c7..ec6f80f 100644 --- a/controllers/prototype/views/prototype_recommendation.jade +++ b/controllers/prototype/views/prototype_recommendation.jade @@ -5,14 +5,6 @@ block title block configjs script Recommendation = #{recommendationStyle}; coinsId = [#{coins}]; - script. - Coin.onLastCoin = function() { - $('#next').show(); - $('#next').click(function() { - window.location = '/prototype/game'; - $('#next').prop('disabled', true); - }); - }; block lastbutton button#next.btn.btn-success.navbar-btn(style={'margin-right':'10px', 'margin-bottom':'10px', 'display':'none'}) diff --git a/controllers/prototype/views/prototype_viewports.jade b/controllers/prototype/views/prototype_viewports.jade deleted file mode 100644 index 3c49860..0000000 --- a/controllers/prototype/views/prototype_viewports.jade +++ /dev/null @@ -1,28 +0,0 @@ -extends ./prototype_interactive - -block title - title #{title} - Prototype - Viewports - -block configjs - script Recommendation = L3D.ViewportRecommendation; - script. - Coin.onLastCoin = function() { - $('#next').show(); - $('#next').click(function() { - window.location = '/prototype/arrows'; - $('#next').click(function() {}); - }); - }; - -block lastbutton - button#next.btn.btn-success.navbar-btn(style={'margin-right':'10px', 'margin-bottom':'10px', 'display':'none'}) - span Go to the next step - -//-block preciseDescription - p - | Recommended views are displayed with a - | transparent red rectangle and some lines. - | Basically, it represents the position of a camera - | (the point at the extramities of the lines - | represents the optical center, and the red - | rectangle represents the image plane). diff --git a/js/l3d/apps/prototype/GlobalFunctions.js b/js/l3d/apps/prototype/GlobalFunctions.js index 097771d..05f0cba 100644 --- a/js/l3d/apps/prototype/GlobalFunctions.js +++ b/js/l3d/apps/prototype/GlobalFunctions.js @@ -169,3 +169,11 @@ function appendTo(container) { }; } + +function setNextButton(target) { + $('#next').show(); + $('#next').click(function() { + window.location = target; + $('#next').prop('disabled', true); + }); +} diff --git a/js/l3d/apps/prototype/interactive/main.js b/js/l3d/apps/prototype/interactive/main.js index 231fb3c..fa9c28f 100644 --- a/js/l3d/apps/prototype/interactive/main.js +++ b/js/l3d/apps/prototype/interactive/main.js @@ -19,7 +19,7 @@ var startCanvas; window.onbeforeunload = function() { - if (initMainScene !== L3D.initPeach && initMainScene !== L3D.initSponza && Coin.total !== 8) { + if (initMainScene !== L3D.initPeach && initMainScene !== L3D.initSponza && !($('#next').is(":visible"))) { return 'Warning : you are going to leave the page and abort the current test !'; @@ -27,25 +27,15 @@ window.onbeforeunload = function() { }; +var nextPage = '/prototype/game'; + Coin.onCoinGot = function(coin) { if (coin === 6) { - setTimeout(function() { - $('#next').show(); - $('#next').click(function() { - window.location = '/prototype/next'; - $('#next').prop('disabled', true); - }); - }, 60*1000); + setTimeout(function() { setNextButton(nextPage); }, 60*1000); } }; -Coin.onLastCoin = function() { - $('#next').show(); - $('#next').click(function() { - window.location = '/prototype/next'; - }); - -} +Coin.onLastCoin = function() { setNextButton(nextPage); }; function main() { diff --git a/js/l3d/apps/prototype/tutorial/TutorialSteps.js b/js/l3d/apps/prototype/tutorial/TutorialSteps.js index f3e1ccf..5d15ac6 100644 --- a/js/l3d/apps/prototype/tutorial/TutorialSteps.js +++ b/js/l3d/apps/prototype/tutorial/TutorialSteps.js @@ -210,13 +210,6 @@ TutorialSteps.prototype.nextStep = function() { }); break; case 17: - setTimeout(function() { - $('#next').show(); - $('#next').click(function() { - window.location = '/before-begin'; - }); - }, 3*60*1000); - var cams = L3D.createPeachRecommendations(this.containerSize.width(), this.containerSize.height()); for (var i = 2; i < cams.length; i++) { this.addRecommendation(cams[i]); diff --git a/js/l3d/apps/prototype/tutorial/main.js b/js/l3d/apps/prototype/tutorial/main.js index 335760f..e14e301 100644 --- a/js/l3d/apps/prototype/tutorial/main.js +++ b/js/l3d/apps/prototype/tutorial/main.js @@ -18,18 +18,16 @@ var pointer; var startCanvas; var tutorial; +var nextPage = '/before-begin'; + Coin.onCoinGot = function(val) { if (val === 6) { - setTimeout(function() { - $('#next').show(); - $('#next').click(function() { - window.location = '/prototype/game'; - $('#next').unbind('click'); - }); - }, 60*1000); + setTimeout(function() {setNextButton(nextPage); }, 60*1000); } }; +Coin.onLastCoin = function() { setNextButton(nextPage); }; + function main() { // Main container that holds everything