-
Notifications
You must be signed in to change notification settings - Fork 0
/
kitchen.html
596 lines (536 loc) · 21.7 KB
/
kitchen.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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kitchen</title>
<!-- jquery local link replaced with CDN -->
<!--script type="text/javascript" src="js/jquery-1.10.2.min.js"></script-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css" />
<!-- This page doesn't work with local boostrap Javascript. replacing it with CDN -->
<!--script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script-->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="font-awesome/css/font-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="css/local.css" />
<link href="assets/css/style.css" rel="stylesheet" />
<script src="assets/js/script.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.0.0/moment.min.js"></script>
<link href="bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet">
<script src="bootstrap-switch/js/bootstrap-switch.min.js"></script>
<style>
.bootstrap-switch-container{
width:159px !important;
}
h4{
text-align:center;
}
textarea{
color:black;
}
.progress{
background:#fff;
}
.padBottom {
padding-bottom:20px;
}
label{
color:white;
}
.demo{
margin-bottom: -10px;
padding-bottom: 10px;
//background-color:#efefef;
}
#equalheight {
overflow: hidden;
}
</style>
</head>
<body>
<div id="wrapper">
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!--a class="navbar-brand" href="index.html"><img src="assets/img/logo-new.png" style="margin-top: -5px;" width="65" height="40"></img></a-->
</div>
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav side-nav">
<li><a href="homePage.html"><i class="fa fa-home fa-lg"></i> Home</a></li>
<li><a href="index.html"><i class="fa fa-tachometer fa-lg"></i> Dashboard</a></li>
<li><a href="demoPage.html"><i class="fa fa-tasks fa-lg"></i> Demo Page</a></li>
<li><a href="bedRoom.html"><i class="fa fa-bed fa-lg"></i> Bed Room</a></li>
<li class="selected"><a href="kitchen.html"><i class="fa fa-cutlery fa-lg"></i> Kitchen</a></li>
<li><a href="livingRoom.html"><i class="fa fa-gamepad fa-lg"></i> Living Room</a></li>
<li><a href="exitDoor.html"><i class="fa fa-sign-out fa-lg"></i> Exit Door</a></li>
<li><a href="support.html"><i class="fa fa-question-circle fa-lg"></i> Support</a></li>
</ul>
<ul class="nav navbar-nav navbar-right navbar-user">
<li class="dropdown user-dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user"></i> Aswin<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#"><i class="fa fa-user"></i> Profile</a></li>
<li><a href="#"><i class="fa fa-gear"></i> Settings</a></li>
<li class="divider"></li>
<li><a href="#"><i class="fa fa-power-off"></i> Log Out</a></li>
</ul>
</li>
</ul>
</div>
</nav>
<div id="page-wrapper">
<!-- Adding Priyanka's code -->
<h2 style="text-align:center;">Kitchen</h2>
<ul class="pager">
<li class="previous"><a href="bedRoom.html">Previous</a></li>
<li class="next"><a href="livingRoom.html">Next</a></li>
</ul>
<div class="row">
<div class="col-md-6">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-bar-chart-o"></i>Coffee Machine</h3>
</div>
<div class="panel-body">
<div class="form-group">
<img class="displayed" src="assets/img/coffee.png" width="200" height="150"></img>
</div>
<div class="form-group">
<label for="company" class="col-sm-6 control-label">Power:</label>
<div class="col-sm-6">
<input type="checkbox" name="my-checkbox" class="machine" id="coffee" data-off-color="danger" data-on-color="success" disabled />
</div>
</div>
<div class="form-group">
<label for="company" class="col-sm-6 control-label">Coffee Status:</label>
<div class="col-sm-6">
<div class="progress">
<div class="progress-bar" id="coffeeStatus" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width:100%">Ideal
</div></div>
</div>
</div>
<div class="form-group">
<label for="company" class="col-sm-6 control-label">Water Level:</label>
<div class="col-sm-6">
<label for="company" class="col-sm-6 control-label" id="water"></label>
</div>
</div>
<div class="form-group">
<label for="company" class="col-sm-6 control-label">Powder Level:</label>
<div class="col-sm-6">
<label for="company" class="col-sm-6 control-label" id="powder"></label>
</div>
</div>
<div class="form-group">
<label for="company" class="col-sm-6 control-label">Filter Status:</label>
<div class="col-sm-6">
<label for="company" class="col-sm-6 control-label" id="filter"></label>
</div>
</div>
<div class="form-group">
<label for="company" class="col-sm-6 control-label">Click to take Coffee:</label>
<div class="col-sm-6">
<button class="btn btn-success" id="coffeeCup"><i class="fa fa-coffee fa-lg"></i> Coffee</button>
</div>
</div>
<div class="form-group">
<label for="company" class="col-sm-6 control-label">Meetings Message:</label>
<div class="col-sm-6">
<button class="btn btn-default" id="replayMsg">Replay</button>
</div>
</div>
</div><!-- body-->
</div>
</div>
<div class="col-md-6">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Toaster</h3>
</div>
<div class="panel-body">
<div class="form-group">
<img class="displayed" src="assets/img/toaster.png" width="200" height="150"></img>
</div>
<div class="form-group">
<label for="state" class="col-sm-6 control-label">Power:</label>
<div class="col-sm-6">
<input type="checkbox" name="my-checkbox" class="machine" id="toaster" data-off-color="danger" data-on-color="success" disabled />
</div>
</div>
<div class="form-group">
<label for="company" class="col-sm-6 control-label">Toast Status:</label>
<div class="col-sm-6">
<div class="progress">
<div class="progress-bar" id="toastStatus" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width:100%">Ideal
</div></div>
</div>
</div>
<div class="form-group">
<label for="company" class="col-sm-6 control-label">Timer set:</label>
<div class="col-sm-6">
<label for="company" class="col-sm-6 control-label" id="timer"></label>
</div>
</div>
<div class="form-group">
<label for="company" class="col-sm-6 control-label">Bread:</label>
<div class="col-sm-6">
<label for="company" class="col-sm-6 control-label" id="bread">TBD</label>
</div>
</div>
</div><!--body-->
</div>
</div>
</div><!-- row -->
<div class="row">
<div class="col-md-offset-2 col-md-8 col-md-offset-2">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Refrigerator</h3>
</div>
<div class="panel-body">
<div class="form-group">
<img class="displayed" src="assets/img/fridge.png" width="200" height="150"></img>
</div>
<div class="form-group">
<div class="well col-md-12"><h4>Milk Section</h4>
<label for="company" class="col-sm-4 control-label">Milk Expiry Date:</label>
<div class="col-sm-8">
<div class="progress">
<div class="progress-bar progress-bar-warning" role="progressbar" id="milkBar" aria-valuenow="1" aria-valuemin="0" aria-valuemax="21" style="">
</div></div>
</div>
<label for="company" class="col-sm-4 control-label">Milk Quantity:</label>
<div class="col-sm-8">
<div class="progress">
<div class="progress-bar" role="progressbar" id="milkQty" aria-valuenow="1" aria-valuemin="0" aria-valuemax="100" style="">
</div></div>
</div>
</div>
</div>
<div class="form-group">
<div class="well col-md-12"><h4>Produce Section</h4>
<table class="table table striped">
<tr><td>Items</td>
<td>Quantities</td>
<td>Expiry Meter</td>
</tr>
<tr>
<td>Produce</td>
<td><textarea id="produce" rows="1" disabled></textarea></td>
<td>
<div class="progress">
<div class="progress-bar progress-bar-warning" id="produceBar" role="progressbar" aria-valuenow="1" aria-valuemin="0" aria-valuemax="21" style="">1 day
</div></div>
</td>
</tr>
<tr>
<td>Eggs</td>
<td><textarea id="eggs" rows="1" disabled></textarea></td>
<td>
<div class="progress">
<div class="progress-bar progress-bar-warning" id="eggsBar" role="progressbar" aria-valuenow="1" aria-valuemin="0" aria-valuemax="15" style="">1 day
</div></div>
</td>
</tr>
<tr>
<td>Meat</td>
<td><textarea id="meat" rows="1" disabled ></textarea></td>
<td>
<div class="progress">
<div class="progress-bar progress-bar-warning" id="meatBar" role="progressbar" aria-valuenow="1" aria-valuemin="0" aria-valuemax="7" style="">1 day
</div></div>
</td>
</tr>
</table>
</div>
</div>
</div><!-- body-->
</div>
</div>
</div>
</div>
</div>
</body>
<script>
$( "#coffeeCup" ).click(function() {
// disable the button and then start reading...
$("#coffeeCup").prop("disabled",true);
textToSpeech();
});
$( "#replayMsg" ).click(function() {
textToSpeech();
});
$(".machine").bootstrapSwitch();
function textToSpeech(){
var text1 = "Good Morning!";
var text2 = "You have the following meetings today,ten thirty to eleven, meet professor and show the demo,then from tweleve to one, lunch with teammates, and from three to five, work on the project Expo";
console.log("came to speech");
var msg = new SpeechSynthesisUtterance();
var voices = window.speechSynthesis.getVoices();
msg.voice = voices[10]; // Note: some voices don't support altering params
msg.voiceURI = 'native';
msg.volume = 1; // 0 to 1
msg.rate = 1; // 0.1 to 10
msg.pitch = 2; //0 to 2
//msg.text = 'Hello World';
msg.text = text1 + text2;
msg.lang = 'en-US';
msg.onend = function(e) {
console.log('Finished in ' + event.elapsedTime + ' seconds.');
};
speechSynthesis.speak(msg);
}
/* Fridge Section */
/* MILK Section */
/**** Default Page Code ***/
var milkFreshness = Math.floor(Math.random() * 16);
console.log("milk current Fresh ", milkFreshness , "days");
var milkLife = 15;
var milkExpiry = exp(milkFreshness, milkLife);
var milkId = "#milkQty";
var milkQty = Math.floor(Math.random() * 101);
displayMilkQty(milkQty, milkId);
/* end MILK Section */
<!----- MILK ------>
function displayMilkQty(milkQty, milkId){
var full = milkQty + 100;
if(milkQty == 100){
console.log("value 100");
$(milkId).removeClass().addClass("progress-bar progress-bar-success");
$(milkId).css("width", milkQty + "%");
$(milkId).attr("aria-valuenow", milkQty + "%");
$(milkId).text("Full");
}else if(milkQty <= 10){
console.log("value less than 10");
$(milkId).addClass("progress-bar-danger");
$(milkId).css("width", full + "%");
$(milkId).attr("aria-valuenow", full + "%");
$(milkId).text("Empty! Stock up!");
} else if(milkQty > 70 && milkQty < 100){
console.log("between 70-100");
$(milkId).removeClass().addClass("progress-bar progress-bar-success");
$(milkId).css("width", milkQty + "%");
$(milkId).attr("aria-valuenow", milkQty + "%");
$(milkId).text(milkQty + " %");
} else if(milkQty > 40 && milkQty < 70){
console.log("between 40-70");
$(milkId).removeClass().addClass("progress-bar");
$(milkId).css("width", milkQty + "%");
$(milkId).attr("aria-valuenow", milkQty + "%");
$(milkId).text(milkQty + " %");
} else{
console.log("between 10-40");
$(milkId).removeClass().addClass("progress-bar progress-bar-warning");
$(milkId).css("width", milkQty + "%");
$(milkId).attr("aria-valuenow", milkQty + "%");
$(milkId).text(milkQty + " %");
}
} // closing function
<!----- end MILK ------>
<!----- PRODUCE QUANTITY ---->
//Produce
var produceQty = Math.floor(Math.random() * 101);
if(produceQty == 0){
produceQtyMsg = "Out of fresh Produce! Stock Up!";
} else if(produceQty == 100){
produceQtyMsg = "Produce Section full!";
} else{
produceQtyMsg = produceQty + "% of fresh produce left";
}
document.getElementById("produce").value = produceQtyMsg;
//Eggs
var eggsQty = Math.floor(Math.random() * 13);
if(eggsQty == 0){
eggsQtyMsg = "No eggs left! Stock up!";
}else if(eggsQty == 1){
eggsQtyMsg = "only " + eggsQty + " egg left";
} else if(eggsQty == 12){
eggsQtyMsg = "Full Stock";
}else{
eggsQtyMsg = eggsQty + " eggs left";
}
document.getElementById("eggs").value = eggsQtyMsg;
//Meat
var meatQty = Math.floor(Math.random() * 3);
if(meatQty > 0){
var meat = ["Fish","Chicken","turkey"];
var meatVariety = meat[Math.floor(Math.random() * meat.length)];
var meatQtyMsg = meatQty + " servings of " + meatVariety + " left";
}else{ meatQtyMsg = "Stock up! No more meat!";
}
document.getElementById("meat").value = meatQtyMsg;
console.log("eggs: "+eggsQty);
<!----- end QUANTITY ---->
<!------ EXPIRY ------>
var produceFreshness = Math.floor(Math.random() * 16);
var eggsFreshness = Math.floor(Math.random() * 22);
var meatFreshness = Math.floor(Math.random() * 8);
console.log(produceFreshness);
var produceLife = 15;
var eggsLife = 21;
var meatLife = 7;
var produceExpiry = exp(produceFreshness, produceLife);
var eggsExpiry = exp(eggsFreshness, eggsLife);
var meatExpiry = exp(meatFreshness, meatLife);
function exp(currentFreshness, shelfLife){
if(currentFreshness == 0){
var send = 0;
} else if(currentFreshness < shelfLife){
send = shelfLife - currentFreshness;
} else if(currentFreshness == shelfLife+1){
send = shelfLife+1;
} else{
send = shelfLife;
}
return send;
}
<!------ end EXPIRY ------>
$(document).ready(function() {
var status = localStorage.getItem('buttonStatus');
console.log("status is ", status);
if(status){
$(".machine").bootstrapSwitch('disabled', false);
$(".machine").bootstrapSwitch('state', true);
$(".machine").bootstrapSwitch('disabled', true);
var coffeeStat = "Brewing";
var toastStat = "Toasting"
var coffeeBar = $('#coffeeStatus');
var toastBar = $('#toastStatus');
/*** coffee status ***/
statusBar(coffeeStat, coffeeBar);
/*** toast status ***/
statusBar(toastStat, toastBar);
//setInterval(statusBar(toastStat, toastBar),5000);
function statusBar(status, progressBar){
width = 0;
progressBar.css('width', width + '%');
progressBar.attr("aria-valuenow", width + "%");
var interval = setInterval(function() {
width += 33;
progressBar.css('width', width + '%');
progressBar.attr("aria-valuenow", width + "%");
if(width == 33){
progressBar.text('Started');
progressBar.removeClass().addClass("progress-bar progress-bar-danger");
}else if(width == 66){
progressBar.text(status);
progressBar.removeClass().addClass("progress-bar progress-bar-warning");
}else{
progressBar.text('Finished');
progressBar.removeClass().addClass("progress-bar progress-bar-success");
}
if (width >= 100) {
clearInterval(interval);
}
}, 2000);
return
}
} else{
console.log("error Occured");
}
localStorage.clear();
<!----- PRODUCE ------>
var produceId = "#produceBar";
test(produceLife, produceExpiry, produceId);
var eggsId = "#eggsBar";
test(eggsLife, eggsExpiry, eggsId);
var meatId = "#meatBar";
test(meatLife, meatExpiry, meatId);
var milkEId = "#milkBar";
test(milkLife, milkExpiry, milkEId);
function test(shelfLife, expiryDay, progId){
var pct_left = (expiryDay/shelfLife) * 100;
var fullWidth = 100
if(shelfLife > 7){
var week = 7;
} else{ week = 0;}
if (expiryDay == 0) {
$(progId).removeClass("progress-bar-warning");
$(progId).addClass("progress-bar-success");
$(progId).text("Super Fresh");
$(progId).css("width", fullWidth + "%");
$(progId).attr("aria-valuenow", fullWidth + "%");
} else if (expiryDay == shelfLife + 1) {
$(progId).removeClass("progress-bar-warning");
$(progId).addClass("progress-bar-danger");
$(progId).text("Expired");
$(progId).css("width", fullWidth + "%");
$(progId).attr("aria-valuenow", fullWidth + "%");
} else if (expiryDay == shelfLife) {
$(progId).text("Expires Today!");
$(progId).css("width", fullWidth + "%");
$(progId).attr("aria-valuenow", fullWidth + "%");
} else{
$(progId).text(" " + expiryDay + " days left");
$(progId).css("width", pct_left + "%");
$(progId).attr("aria-valuenow", pct_left + "%");
}
}
/* storage */
if(typeof(Storage) !== "undefined") {
sessionStorage.setItem('milkQuantity', milkQty);
sessionStorage.setItem('produceQuantity', produceQty);
sessionStorage.setItem('eggsQuantity', eggsQty);
sessionStorage.setItem('meatQuantity', meatQty);
var milk_qty = sessionStorage.getItem('milkQuantity');
var pro_qty = sessionStorage.getItem('produceQuantity');
var eggs_qty = sessionStorage.getItem('eggsQuantity');
var meat_qty = sessionStorage.getItem('meatQuantity');
console.log(" milk qty is: " + milk_qty , "produce is: ", pro_qty, "eggs: ", eggs_qty, "meat: ", meat_qty);
} else {
alert("Sorry! No Web Storage support..");
}
}); <!-- closing document.ready -->
<!----- end PRODUCE ------>
/* storage
if(typeof(Storage) !== "undefined") {
sessionStorage.setItem('milkQuantity', milkQty);
sessionStorage.setItem('produceQuantity', produceQty);
sessionStorage.setItem('eggsQuantity', eggsQty);
sessionStorage.setItem('meatQuantity', meatQty);
var milk_qty = sessionStorage.getItem('milkQuantity');
var pro_qty = sessionStorage.getItem('produceQuantity');
var eggs_qty = sessionStorage.getItem('eggsQuantity');
var meat_qty = sessionStorage.getItem('meatQuantity');
console.log(" milk qty is: " + milk_qty , "produce is: ", pro_qty, "eggs: ", eggs_qty, "meat: ", meat_qty);
} else {
alert("Sorry! No Web Storage support..");
} */
var meetings = [];
// Get Events from the API
if(typeof(Storage) !== "undefined") {
var val = localStorage.getItem('meetArray');
if(val){
console.log("nothing");
var value = JSON.parse(val);
var value = JSON.parse(localStorage["meetArray"]);
//console.log("value is: ",value);
for(var i=0; i<val.length; i++){
console.log("msg is:",val[i].msg);
}
}
}else{
alert("Sorry! No Web Storage support..");
}
/**** COFFEE MACHINE ****/
var waterLevel = Math.floor((Math.random() * 100)+1);
var powderLevel = Math.floor((Math.random() * 100)+1);
var filterStatus = ['Excellent', 'Good', 'Fine', 'Bad', 'Very Bad'];
var randFilterStatus = filterStatus[Math.floor(Math.random() * filterStatus.length)];
var machineStatus = ['Started', 'Brewing', 'Finished'];
var randMachineStatus = machineStatus[Math.floor(Math.random() * machineStatus.length)];
document.getElementById('water').innerHTML = waterLevel;
document.getElementById('powder').innerHTML = powderLevel;
document.getElementById('filter').innerHTML = randFilterStatus;
/** Toaster **/
var toasterTime = Math.floor((Math.random() * 5)+1);
document.getElementById('timer').innerHTML = toasterTime + " secs";
var breadLevel = Math.floor((Math.random() * 10)+1);
document.getElementById('bread').innerHTML = breadLevel + " left";
</script>
</html>