-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
134 lines (115 loc) · 3.9 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<title>Unplug » Dashboard</title>
<link href="file:///home/rvb/Documents/HackTheClimate/htc/bootstrap/css/bootstrap-flatly.min.css" rel="stylesheet">
</head>
<body>
<div class="container appliances">
<div class='row' id='tv'>
<div class='col-md-2 switch'>
<span class="glyphicon glyphicon-off" aria-hidden="true"></span>
</div>
<div class='col-md-8 appliance-detail'>
<span class='appliance-name'>Name here</span>
<span class='appliance-phantom-load'>PLC % </span>
<span class='appliance-savings'>PLC</span>
</div>
</div>
<div class='row' id='ac'>
<div class='col-md-2 switch'>
<span class="glyphicon glyphicon-off" aria-hidden="true"></span>
</div>
<div class='col-md-8 appliance-detail'>
<span class='appliance-name'>Name here</span>
<span class='appliance-phantom-load'>PLC %</span>
<span class='appliance-savings'>PLC</span>
</div>
</div>
</div><!-- /.container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="file:///home/rvb/Documents/HackTheClimate/htc/bootstrap/js/jquery.min.js"></script>
<script src="file:///home/rvb/Documents/HackTheClimate/htc/bootstrap/js/bootstrap.min.js"></script>
<style type="text/css">
.appliances .row {
background-color: #00a65a;
transition: background-color 0.5s ease;
border-bottom: 1px solid #eee;
margin-bottom:10px;
}
/*default switch state is on*/
.appliances .row .switch{
width:90px;
height: 90px;
background: rgba(0,0,0,0.2);
float:left;
display: inline-block;
cursor: pointer;
}
.appliances .row.off {
background-color: #828E76;
color:;
}
.appliances .row .switch span {
color:white;
font-size:34px;
margin:40% 20%;
}
.appliances .row .appliance-detail{
padding: 8px;
margin-left: 12px;
float:left;
}
.appliances .row .appliance-detail span {
color:white;
display: block;
}
span.appliance-name {
text-transform: uppercase;
font-size:12px;
}
span.appliance-phantom-load{
font-weight: bold;
font-size:17px;
}
span.appliance-savings{
margin-top:8px;
border-top:1px solid #fff;
}
body{
background:#eee;
}
</style>
<script type="text/javascript">
//animate, save state, send sms...
$(document).ready(function(){
var canPersist = typeof(Storage) !== "undefined";
$(".switch").on('click',function(){
var appliance_id = $(this).parents('.row').attr('id');
$(this).parents(".row").toggleClass('off');
//store the state of this appliance
if (canPersist) {
localStorage.setItem(appliance_id, $($(this).parents('.row')).hasClass('off') ? 'off' : 'on');
}
});
//restore the original state of the appliance
$(".appliances .row").each(function(i,el){
if(canPersist){
var state = localStorage.getItem($(el).attr('id'));
if(state == 'off'){
$(el).addClass(state);
}
}
});
});
</script>
</body>
</html>