equal
deleted
inserted
replaced
2 * JavaScript file |
2 * JavaScript file |
3 */ |
3 */ |
4 |
4 |
5 var SETUP_ID = 1; |
5 var SETUP_ID = 1; |
6 |
6 |
7 var timervalue = 60; |
7 var timervalue = 30; |
8 var initialTimer = 60; |
8 var initialTimer = 30; |
9 var timeoutId = null; |
9 var timeoutId = null; |
10 var paused = true; |
10 var paused = true; |
11 var displayUp = true; |
11 var displayUp = true; |
12 |
12 |
13 function init() |
13 function init() |
14 { |
14 { |
15 showMainWindow(); |
15 showMainWindow(); |
16 widget.setDisplayPortrait(); |
16 widget.setDisplayPortrait(); |
17 watchSensorNotifications(); |
17 watchSensorNotifications(); |
|
18 startTimer(); |
18 } |
19 } |
19 |
20 |
20 // Call this function to add a callback that will be notified of orientation |
21 // Call this function to add a callback that will be notified of orientation |
21 // changes |
22 // changes |
22 function watchSensorNotifications() { |
23 function watchSensorNotifications() { |
121 |
122 |
122 function tick() { |
123 function tick() { |
123 if (timervalue > 0) { |
124 if (timervalue > 0) { |
124 timervalue = timervalue - 1; |
125 timervalue = timervalue - 1; |
125 showValues(); |
126 showValues(); |
126 if (timervalue == 0) { |
|
127 cancelTimer(); |
|
128 } |
|
129 } |
127 } |
130 } |
128 } |
131 |
129 |
132 function pad(num) { |
130 function pad(num) { |
133 if (num < 10) { |
131 if (num < 10) { |
160 document.getElementById("time-setup").style.display = "inherit"; |
158 document.getElementById("time-setup").style.display = "inherit"; |
161 var item = menu.getMenuItemById(SETUP_ID); |
159 var item = menu.getMenuItemById(SETUP_ID); |
162 menu.remove(item); |
160 menu.remove(item); |
163 menu.setRightSoftkeyLabel("Cancel", showMainWindow); |
161 menu.setRightSoftkeyLabel("Cancel", showMainWindow); |
164 } |
162 } |
165 |
|
166 |
|
167 function pauseStart() { |
|
168 if (paused) { |
|
169 startCountdown(); |
|
170 document.getElementById("pausestart").style.backgroundPosition = "0px 0px"; |
|
171 paused = false; |
|
172 } else { |
|
173 if (timeoutId) { |
|
174 window.clearInterval(timeoutId); |
|
175 timeoutId = null; |
|
176 } |
|
177 document.getElementById("pausestart").style.backgroundPosition = "0px 32px"; |
|
178 paused = true; |
|
179 } |
|
180 } |
|