|
6 | 6 | var revertTimeoutDelay = 5 * 60 * 1000; // milliseconds since last click/touch |
7 | 7 |
|
8 | 8 | /* State information */ |
9 | | - var currentMode = ""; |
| 9 | + var currentMode = null; |
10 | 10 | var revertTimeout = null; |
11 | 11 |
|
12 | 12 | /* Functions */ |
|
47 | 47 | }); |
48 | 48 | } |
49 | 49 |
|
| 50 | + function getCurrentMode() { |
| 51 | + return currentMode; |
| 52 | + } |
| 53 | + |
50 | 54 | function loadScreen(mode) { |
51 | 55 | // Load mode-specific CSS |
52 | 56 | $("<link href=\"../../earthlapse-hci/modes-" + escape(mode) + ".css\" rel=\"stylesheet\" type=\"text/css\" />").appendTo("head"); |
|
88 | 92 | EarthlapseUI.bind("init", function() { |
89 | 93 | // Setup basic Earthlapse Modes UI |
90 | 94 | $("body").addClass("earthlapse-modes"); |
91 | | - var $backToMenu = $("<button class=\"ui-button earthlapse-modes-homebutton earthlapse-modes-container\">Menu</button>"); |
92 | | - $backToMenu.on("click", function(e) { |
93 | | - e.preventDefault(); |
94 | | - changeModeTo("menu"); |
95 | | - }); |
96 | | - $("#timeMachine").append($backToMenu); |
97 | 95 |
|
98 | 96 | // Convert CREATE Lab UI into Earthlapse exploration mode |
99 | 97 | var $explore = $(".location_search_div, .presentationSlider, .current-location-text, .player > div[class]:not(#timeMachine_timelapse), #timeMachine_timelapse > div"); |
100 | 98 | $explore.addClass("earthlapse-modes-container earthlapse-modes-explore-container"); |
101 | | - $backToMenu.addClass("earthlapse-modes-explore-container"); |
102 | 99 |
|
103 | 100 | // Disable panning/zooming on screens |
104 | 101 | document.addEventListener("touchmove", function (e) { |
|
116 | 113 | loadScreen("menu"); |
117 | 114 | loadScreen("story"); |
118 | 115 |
|
| 116 | + // Configure explore mode: Back to menu |
| 117 | + EarthlapseUI.GlobalControl.bindAction("home", function () { |
| 118 | + if (EarthlapseUI.Modes.getCurrentMode() !== "explore") { return; } |
| 119 | + changeModeTo("menu"); |
| 120 | + }); |
| 121 | + |
119 | 122 | // Set up timeout to revert to default mode |
120 | 123 | $(document).on("click touchstart touchmove", function () { |
121 | 124 | resetRevertTimeout(); |
|
125 | 128 | // Expose modes API |
126 | 129 | EarthlapseUI.Modes = { |
127 | 130 | changeModeTo: changeModeTo, |
| 131 | + getCurrentMode: getCurrentMode, |
128 | 132 | loadScreen: loadScreen, |
129 | 133 | revertToDefault: revertToDefault, |
130 | 134 | resetRevertTimeout: resetRevertTimeout |
|
0 commit comments