author | Eugene Ostroukhov <eugeneo@symbian.org> |
Thu, 04 Nov 2010 13:43:25 -0700 | |
changeset 3 | b43377c07b0c |
parent 2 | 2da62bb63910 |
child 4 | 6c91568e58fd |
permissions | -rw-r--r-- |
0
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
1 |
/* |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
2 |
* JavaScript file |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
3 |
*/ |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
4 |
|
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
5 |
var SETUP_ID = 1; |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
6 |
|
2 | 7 |
var timervalue = 30; |
8 |
var initialTimer = 30; |
|
0
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
9 |
var timeoutId = null; |
1
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
10 |
var paused = true; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
11 |
var displayUp = true; |
0
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
12 |
|
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
13 |
function init() |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
14 |
{ |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
15 |
showMainWindow(); |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
16 |
widget.setDisplayPortrait(); |
1
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
17 |
watchSensorNotifications(); |
2 | 18 |
startTimer(); |
1
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
19 |
} |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
20 |
|
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
21 |
// Call this function to add a callback that will be notified of orientation |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
22 |
// changes |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
23 |
function watchSensorNotifications() { |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
24 |
var sensors = device.getServiceObject("Service.Sensor", "ISensor"); |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
25 |
var SensorParams = { |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
26 |
SearchCriterion : "Orientation" |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
27 |
}; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
28 |
var result = sensors.ISensor.FindSensorChannel(SensorParams); |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
29 |
|
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
30 |
if (result.ErrorCode != 0) { |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
31 |
var errorCode = result.ErrorCode; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
32 |
var errorMessage = result.ErrorMessage; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
33 |
return null; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
34 |
} |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
35 |
var result2 = sensors.ISensor.RegisterForNotification( |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
36 |
{ ChannelInfoMap : result.ReturnValue[0], |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
37 |
ListeningType : "ChannelData" }, sensorCallback); |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
38 |
if (result.ErrorCode == 0) { |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
39 |
var transactionId = result.TransactionID; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
40 |
return transactionId; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
41 |
} else { |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
42 |
var errorCode = result.ErrorCode; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
43 |
var errorMessage = result.ErrorMessage; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
44 |
return null; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
45 |
} |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
46 |
} |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
47 |
|
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
48 |
function turn(up) { |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
49 |
if (up != displayUp) { |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
50 |
displayUp = up; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
51 |
timervalue = initialTimer - timervalue; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
52 |
showValues(); |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
53 |
} |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
54 |
} |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
55 |
|
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
56 |
// This function can be passed as callback to |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
57 |
// sensors.ISensor.RegisterForNotification method |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
58 |
function sensorCallback(transactionId, code, result) { |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
59 |
if (result.ErrorCode == 0) { |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
60 |
var dataType = result.ReturnValue.DataType; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
61 |
var orientation = result.ReturnValue.DeviceOrientation; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
62 |
|
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
63 |
if (orientation == "DisplayUp") { |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
64 |
turn(true); |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
65 |
} else if (orientation == "DisplayDown") { |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
66 |
turn(false); |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
67 |
} |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
68 |
} else { |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
69 |
var errorCode = result.ErrorCode; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
70 |
var errorMessage = result.ErrorMessage; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
71 |
} |
0
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
72 |
} |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
73 |
|
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
74 |
function startTimer() { |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
75 |
var hr = parseInt(document.getElementById("hrs").value); |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
76 |
var min = parseInt(document.getElementById("min").value); |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
77 |
var sec = parseInt(document.getElementById("sec").value); |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
78 |
|
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
79 |
timervalue = hr * 3600 + min * 60 + sec; |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
80 |
initialTimer = timervalue; |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
81 |
showMainWindow(); |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
82 |
startCountdown(); |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
83 |
} |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
84 |
|
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
85 |
function startCountdown() { |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
86 |
if (timeoutId) { |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
87 |
clearInterval(timeoutId); |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
88 |
} |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
89 |
timeoutId = window.setInterval(tick, 1000); |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
90 |
tick(); |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
91 |
} |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
92 |
|
1
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
93 |
function showValues() { |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
94 |
var hrs = Math.floor(timervalue / 3600); |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
95 |
var mins = Math.floor((timervalue % 3600) / 60); |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
96 |
var sec = timervalue % 60; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
97 |
|
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
98 |
var sz = pad(hrs) + ":" + pad(mins) + ":" + pad(sec); |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
99 |
document.getElementById("timervalue").innerHTML = sz; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
100 |
var sand=document.getElementById("sand"); |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
101 |
var sandBottom = document.getElementById("sand-bottom"); |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
102 |
var top, bottom; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
103 |
top = (50 * (initialTimer-timervalue)/initialTimer).toFixed(0) + "%"; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
104 |
bottom = "50%"; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
105 |
if (displayUp) { |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
106 |
sand.style.top = top; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
107 |
sand.style.bottom = bottom; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
108 |
} else { |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
109 |
sandBottom.style.bottom = top; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
110 |
sandBottom.style.top = bottom; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
111 |
} |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
112 |
bottom = "0%"; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
113 |
top = (50 + (50 * timervalue/initialTimer)).toFixed(0) + "%"; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
114 |
if (displayUp) { |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
115 |
sandBottom.style.top = top; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
116 |
sandBottom.style.bottom = bottom; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
117 |
} else { |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
118 |
sand.style.top = bottom; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
119 |
sand.style.bottom = top; |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
120 |
} |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
121 |
} |
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
122 |
|
0
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
123 |
function tick() { |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
124 |
if (timervalue > 0) { |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
125 |
timervalue = timervalue - 1; |
1
8452783e7980
Updated eggtimer application
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
0
diff
changeset
|
126 |
showValues(); |
0
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
127 |
} |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
128 |
} |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
129 |
|
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
130 |
function pad(num) { |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
131 |
if (num < 10) { |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
132 |
return '0' + num; |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
133 |
} else { |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
134 |
return num; |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
135 |
} |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
136 |
} |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
137 |
|
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
138 |
function cancelTimer() { |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
139 |
clearInterval(timeoutId); |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
140 |
timeoutId = 0; |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
141 |
timervalue = 0; |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
142 |
document.getElementById("timervalue").innerHTML = "00:00:00"; |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
143 |
document.getElementById("sand").style.top="50%"; |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
144 |
document.getElementById("sand-bottom").style.top="50%"; |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
145 |
} |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
146 |
|
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
147 |
function showMainWindow() { |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
148 |
document.getElementById("main-window").style.display = "inherit"; |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
149 |
document.getElementById("time-setup").style.display = "none"; |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
150 |
var item = new MenuItem("Setup timer", SETUP_ID); |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
151 |
item.onSelect = showTimerSetup; |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
152 |
menu.append(item); |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
153 |
menu.setRightSoftkeyLabel("Exit", null); |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
154 |
} |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
155 |
|
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
156 |
function showTimerSetup() { |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
157 |
document.getElementById("main-window").style.display = "none"; |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
158 |
document.getElementById("time-setup").style.display = "inherit"; |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
159 |
var item = menu.getMenuItemById(SETUP_ID); |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
160 |
menu.remove(item); |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
161 |
menu.setRightSoftkeyLabel("Cancel", showMainWindow); |
0b6daedcf7e1
Initial commit of two sample projects
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
162 |
} |