-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin.html
45 lines (41 loc) · 1.2 KB
/
admin.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
<html>
<head>
<title>Admin</title>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<style type="text/css">
.row{
margin-bottom: 10px;
}
button{
height: 100px;
}
body{
margin-top: 100px;
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-xs-4"><button class="btn btn-block btn-lg" data-power="50">Fan</button></div>
<div class="col-xs-4"><button class="btn btn-block btn-lg" data-power="1400">Clothing Iron</div>
<div class="col-xs-4"><button class="btn btn-block btn-lg" data-power="1000">Hairdryer</button></div>
</div>
</div>
<script src="javascripts/jquery-2.1.0.min.js"></script>
<script>
$('button').click(function(){
$(this).toggleClass('active');
var isOn = $(this).hasClass('active');
var itemName = $(this).html();
var power = $(this).data('power');
if (isOn == false){
power = power * -1
}
$.post('/api/update?amount=' + power, function(response){
console.log('successfully posted!');
});
});
</script>
</body>
</html>