-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
272 lines (218 loc) · 13.6 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<script src="Lib/knockout-3.1.0.js"></script>
<script src="Lib/jquery-2.1.1.min.js"></script>
<script src="Lib/jquery.mobile.custom.min.js"></script>
<script src="Lib/moment-2.8.4.min.js"></script>
<!--<script src="cordova.js"></script>-->
<!--<script src="scripts/index.js"></script>-->
<!--<script src="plugins/require.js"></script>-->
<!--<script src="plugins/org.apache.cordova.media/www/Media.js"></script>-->
<script src="OvenViewModel.js"></script>
<script src="StatusProperties.js"></script>
<script src="UserInterface.js"></script>
<script src="Timers.js"></script>
<script src="Subscriptions.js"></script>
<script src="OvenManager.js"></script>
<script src="TemperatureManagement.js"></script>
<script src="TimerManagement.js"></script>
<script src="SoundManagement.js"></script>
<script src="OvenProgramManagement.js"></script>
<script src="OvenProgramFactory.js"></script>
<script src="OvenProgram.js"></script>
<script src="OvenProgramStage.js"></script>
<script src="TemperatureConfig.js"></script>
<script src="TemperatureConfigFactory.js"></script>
<script src="OvenScripts.js"></script>
<script>
$(document).ready(function () {
var isTesting = getParameterByName("Testing") === "true";
var soundOn = true;
if (isTesting) {
//This is just annoying during testing
soundOn = false;
}
var ovenViewModel = new OvenViewModel(soundOn, true, true); //soundEnabled, blinkingEnabled, defaultIsCelcius
ko.applyBindings(ovenViewModel);
//ovenViewModel.SoundEnabled = false;
//Testing code
if (isTesting) {
ovenViewModel.TurnOvenOn();
OvenScripts.Setup3StageProgram_All150WithTime12and3Minutes_BackToHome(ovenViewModel);
ovenViewModel.ProgramButtonTap();
//ovenViewModel.btnTimer_PlusButtonDown(); //Increase timer
//ovenViewModel.btnTimer_PlusButtonUp();
OvenScripts.SetActualTemperatureToTarget(ovenViewModel);
}
//new OvenScripts().SetProgram1_1TempToCP(ovenViewModel);
//ovenViewModel.Test();
//OvenScripts.Setup3StageProgram_All150WithTime_BackToHome(ovenViewModel);
//OvenScripts.SelectProgram1PreHeatAndStart(ovenViewModel);
//OvenScripts.StartTimerSet1SecondBeforeEnd(ovenViewModel);
//Testing
//ovenViewModel.IncreaseTimer();
//ovenViewModel.TimerButtonDown();
//ovenViewModel.ConnectCoreProbe();
//ovenViewModel.IncreaseTargetCoreTemperature();
//Use jQuery mobile to handle tap and tap hold events
$("#btnSteam").bind("taphold", ovenViewModel.SteamButtonTapHold);
$("#btnSteam").bind("tap", ovenViewModel.SteamButtonTap);
$("#btnProgram").bind("taphold", ovenViewModel.ProgramButtonTapHold);
$("#btnProgram").bind("tap", ovenViewModel.ProgramButtonTap);
$("#btnTemp").bind("taphold", ovenViewModel.TempButtonTapHold);
$("#btnTemp").bind("tap", ovenViewModel.TempButtonTap);
$("#btnLightPower").bind("taphold", ovenViewModel.LightPowerButtonTapHold);
$("#btnLightPower").bind("tap", ovenViewModel.LightPowerButtonTap);
$("#btnFan").bind("taphold", ovenViewModel.FanButtonTapHold);
$("#btnFan").bind("tap", ovenViewModel.FanButtonTap);
$("#btnTimer").bind("taphold", ovenViewModel.TimerButtonTapHold);
$("#btnTimer").bind("tap", ovenViewModel.TimerButtonTap);
//Dial tap up and down
$("#btnTemp_Minus").on("vmousedown", ovenViewModel.btnTemp_MinusButtonDown);
$("#btnTemp_Minus").on("vmouseup", ovenViewModel.btnTemp_MinusButtonUp);
$("#btnTemp_Minus").on("vmouseout", ovenViewModel.btnTemp_MinusButtonUp);
$("#btnTemp_Plus").on("vmousedown", ovenViewModel.btnTemp_PlusButtonDown);
$("#btnTemp_Plus").on("vmouseup", ovenViewModel.btnTemp_PlusButtonUp);
$("#btnTemp_Plus").on("vmouseout", ovenViewModel.btnTemp_PlusButtonUp);
$("#btnTimer_Minus").on("vmousedown", ovenViewModel.btnTimer_MinusButtonDown);
$("#btnTimer_Minus").on("vmouseup", ovenViewModel.btnTimer_MinusButtonUp);
$("#btnTimer_Minus").on("vmouseout", ovenViewModel.btnTimer_MinusButtonUp);
$("#btnTimer_Plus").on("vmousedown", ovenViewModel.btnTimer_PlusButtonDown);
$("#btnTimer_Plus").on("vmouseup", ovenViewModel.btnTimer_PlusButtonUp);
$("#btnTimer_Plus").on("vmouseout", ovenViewModel.btnTimer_PlusButtonUp);
//$.event.special.tap.tapholdThreshold = 2000;
$.event.special.tap.emitTapOnTaphold = false;
//function tapholdHandler(event) {
// console.log('HOLD');
//}
});
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
</script>
<script src="app.js"></script>
<title>Moffat Oven Simulator</title>
<link type="text/css" href="style.css" rel="stylesheet">
<style>
</style>
</head>
<body>
<div data-bind="css: (UseSmallClient() ? 'dialTempSmall' : 'dialTemp') + ' ' + DialTempCss()"></div>
<div id="btnTemp_Minus" data-bind="css: UseSmallClient() ? 'btnTemp_MinusSmall' : 'btnTemp_Minus'"></div>
<!--, event: { mousedown: btnTemp_MinusButtonDown, mouseup: btnTemp_MinusButtonUp, mouseover: btnTemp_MinusOver, mouseout: btnTemp_MinusOut }-->
<div id="btnTemp_Plus" data-bind="css: UseSmallClient() ? 'btnTemp_PlusSmall' : 'btnTemp_Plus'"></div>
<!--, event: { mousedown: btnTemp_PlusButtonDown, mouseup: btnTemp_PlusButtonUp, mouseover: btnTemp_PlusOver, mouseout: btnTemp_PlusOut }-->
<div data-bind="css: (UseSmallClient() ? 'dialTimerSmall' : 'dialTimer') + ' ' + DialTimerCss()"></div>
<div id="btnTimer_Minus" data-bind="css: UseSmallClient() ? 'btnTimer_MinusSmall' : 'btnTimer_Minus'"></div>
<!--, event: { mousedown: btnTimer_MinusButtonDown, mouseup: btnTimer_MinusButtonUp, mouseover: btnTimer_MinusOver, mouseout: btnTimer_MinusOut }-->
<div id="btnTimer_Plus" data-bind="css: UseSmallClient() ? 'btnTimer_PlusSmall' : 'btnTimer_Plus'"></div>
<!--, event: { mousedown: btnTimer_PlusButtonDown, mouseup: btnTimer_PlusButtonUp, mouseover: btnTimer_PlusOver, mouseout: btnTimer_PlusOut }-->
<!--<div class="btnTimer_Minus" data-bind="event: { mousedown: btnTimer_MinusButtonDown, mouseup: btnTimer_MinusButtonUp, mouseover: btnTimer_MinusOver, mouseout: btnTimer_MinusOut }"></div>
<div class="btnTimer_Plus" data-bind="event: { mousedown: btnTimer_PlusButtonDown, mouseup: btnTimer_PlusButtonUp, mouseover: btnTimer_PlusOver, mouseout: btnTimer_PlusOut }"></div>-->
<div data-bind="css: UseSmallClient() ? 'controlPanelSmall' : 'controlPanel'" style="float: left">
<div data-bind="css: UseSmallClient() ? 'TopPaddingSmall' : 'TopPadding'">
</div>
<div class="displayBox DisplayLeftMargin" data-bind="text: TopDisplay"></div>
<div class="ButtonsLeftMargin ButtonsTopMargin">
<!--Steam-->
<button id="btnSteam" class="btn" data-bind="css: LightOn_Steam() ? 'btnSteam_On' : 'btnSteam_Off'"></button>
<!--Program-->
<button id="btnProgram" class="btn ButtonLeftMargin" data-bind="css: LightOn_Program() ? 'btnProgram_On' : 'btnProgram_Off'"></button>
<!--Temp-->
<button id="btnTemp" class="btn ButtonLeftMargin" data-bind="css: LightOn_Temp() ? 'btnTemp_On' : 'btnTemp_Off'"></button>
</div>
<div class="TempTopPadding SplitLeftMargin">
<div style="height: 63px;">
</div>
<!--<div class="btnTemp_Minus" data-bind="click: btnTemp_MinusClick"></div>-->
<!--<div class="btnTemp_Plus" data-bind="click: btnTemp_PlusClick"></div>-->
<div style="clear: both"></div>
</div>
<div data-bind="css: UseSmallClient() ? 'BottomDisplayTopMarginSmall' : 'BottomDisplayTopMargin'">
<div class="displayBox DisplayLeftMargin" data-bind="text: BottomDisplay"></div>
</div>
<div class="ButtonsLeftMargin ButtonsTopMargin">
<!--LightPowerButton-->
<button id="btnLightPower" class="btn" data-bind="css: LightOn_LightPower() ? 'btnLightPower_On' : 'btnLightPower_Off'"></button>
<!--Fan-->
<button id="btnFan" class="btn ButtonLeftMargin" data-bind="css: LightOn_Fan() ? 'btnFan_On' : 'btnFan_Off'"></button>
<!--Timer-->
<button id="btnTimer" class="btn ButtonLeftMargin" data-bind="css: LightOn_Timer() ? 'btnTimer_On' : 'btnTimer_Off'"></button>
</div>
<div class="TimerTopPadding SplitLeftMargin">
<div style="height: 63px;">
</div>
<!--<div class="btnTimer_Minus" data-bind="click: btnTimer_MinusClick"></div>-->
<!--<div class="btnTimer_Plus" data-bind="click: btnTimer_PlusClick"></div>-->
</div>
</div>
<div style="float: left; padding: 10px;">
<!--<div data-bind="text: 'Core probe connected: ' + CoreProbeConnected()"></div>-->
<div style="padding-bottom: 5px">
<button data-bind="click: ConnectCoreProbe, visible: !CoreProbeConnected()">Connect Core Probe</button>
<button data-bind="click: DisconnectCoreProbe, visible: CoreProbeConnected">Disconnect Core Probe</button>
</div>
<!--<div>
<button data-bind="click: SetDefaults">Set Defaults</button>
</div>-->
<div style="padding-bottom: 5px">
<span data-bind="text: 'Actual Temp(' + CurrentTemperatureConfig().Unit() + ')' + ': '"></span><span data-bind="text: Math.round(ActualTemperature() * 10) / 10">Temperature</span>
</div>
<div style="padding-bottom: 5px">
<span data-bind="text: 'Target Temp(' + CurrentTemperatureConfig().Unit() + ')' + ': '">Target Temp:</span><span data-bind="text: Math.round(TargetTemperature() * 10) / 10">Temperature</span>
</div>
<div style="padding-bottom: 5px">
<span data-bind="text: 'Time: (x' + TimeDilation() + ')'"></span>
<button data-bind="click: DecreaseTimeDilation">slower</button>
<button data-bind="click: IncreaseTimeDilation">faster</button>
</div>
<div style="padding-bottom: 5px">
<span>Client Height:</span>
<span class="btn" data-bind="text: ClientHeight"></span>
</div>
<div style="padding-bottom: 5px" data-bind="if: DisplayingProgram">
<span>Total Time Remaining:</span>
<span class="btn" data-bind="text: ConvertDurtaionToDisplay(DisplayingProgram().TotalTimeRemaining())"></span>
<!--<button class="btn" data-bind="click: DisplayingProgram().TotalTimeRemainingTest">TEST</button>-->
</div>
<!-- <button data-bind="click: Test">Test</button>-->
<div style="padding-bottom: 5px">
<button data-bind="click: Beep">Beep Test</button>
</div>
<div style="padding-bottom: 5px">
<button data-bind="visible: !UseSmallClient(), click: UseSmallClientToggle">Use Small Display</button>
<button data-bind="visible: UseSmallClient, click: UseSmallClientToggle">Use Large Display</button>
</div>
<div style="padding-bottom: 5px">
<button data-bind="visible: CurrentTemperatureConfig().Id() === 1, click: SetTemperatureConfigCelsius">Use °C</button>
<button data-bind="visible: CurrentTemperatureConfig().Id() === 0, click: SetTemperatureConfigFahrenheit">Use °F</button>
<span>(This resets the oven to defaults)</span>
</div>
<div data-bind="if: DisplayingProgram() && DisplayingProgram().Name()">
<div><b data-bind="text: 'Current Program: ' + DisplayingProgram().Name()"></b></div>
<div><b data-bind="text: 'Current Program Stage: ' + DisplayingProgramStage().Name()"></b></div>
<div data-bind="foreach: DisplayingProgram().OvenProgramStages">
<div data-bind="if: IsOn">
<div data-bind="text: 'Stage: ' + Name()"></div>
<div style="margin-left: 20px" data-bind="text: 'TargetTemperature: ' + TargetTemperature()"></div>
<div style="margin-left: 20px" data-bind="text: 'TargetCoreTemperature: ' + TargetCoreTemperature()"></div>
<div style="margin-left: 20px" data-bind="text: 'TimerStartValue: ' + TimerStartValue()"></div>
<div style="margin-left: 20px" data-bind="text: 'TimerCurrentValue: ' + ConvertDurtaionToDisplay(TimerCurrentValue())"></div>
</div>
</div>
</div>
<audio controls id="beepControl" preload="auto" style="display: none">
<source src="Sounds/beep1.mp3" type="audio/mpeg">
</audio>
</div>
<!-- Cordova reference, this is added to your app when it's built. -->
<script src="cordova.js"></script>
<script src="scripts/platformOverrides.js"></script>
<script src="scripts/index.js"></script>
</body>
</html>