-
Notifications
You must be signed in to change notification settings - Fork 0
/
new.html
130 lines (93 loc) · 3.26 KB
/
new.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
<!DOCTYPE html>
<html>
<title>Domestic water management system</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://cdn.socket.io/socket.io-1.2.0.js"></script>
<style>
html,body,h1,h2,h3,h4,h5 {font-family: "Raleway", sans-serif}
</style>
<body class="w3-light-grey">
<!--
<script type="text/javascript">
</script>
-->
<!-- Top container -->
<div class="w3-bar w3-top w3-black w3-large" style="z-index:4">
<button class="w3-bar-item w3-button w3-hide-large w3-hover-none w3-hover-text-light-grey" onclick="w3_open();"><i class="fa fa-bars"></i> Menu</button>
<span class="w3-bar-item w3-right">All is WELL</span>
</div>
<!-- !PAGE CONTENT! -->
<div class="w3-main" style="margin-left:20px;margin-top:43px;">
<hr>
<div class="w3-container" align="center">
<h1>Domestic Water Management System</h1>
</div>
<hr>
<div class="w3-container">
<h3>General Stats</h3>
<hr>
<h5>Over Head Tank</h5>
<div class="w3-grey">
<div id="tank" class="w3-container w3-center w3-padding w3-green" style="width:75%"><span id="tank_level"> </span></div>
</div>
<hr>
<center>
<h1 id="well_level"></h1>
</center>
<hr>
<hr>
<!-- Footer -->
<footer class="w3-container w3-padding-16 w3-light-grey">
<center><small>Powered by ACES Hackathon 2017</small></center>
</footer>
<!-- End page content -->
</div>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
// Get the Sidebar
var mySidebar = document.getElementById("mySidebar");
// Get the DIV with overlay effect
var overlayBg = document.getElementById("myOverlay");
// Toggle between showing and hiding the sidebar, and add overlay effect
function w3_open() {
if (mySidebar.style.display === 'block') {
mySidebar.style.display = 'none';
overlayBg.style.display = "none";
} else {
mySidebar.style.display = 'block';
overlayBg.style.display = "block";
}
}
// Close the sidebar with the close button
function w3_close() {
mySidebar.style.display = "none";
overlayBg.style.display = "none";
}
$(document).ready(function() {
function load(){
$.getJSON('http://localhost:5000/datafeed', function (data) {
tank_level = data.tank;
if (!tank_level) {
tank_level = 0;
}
$("#tank_level").text(tank_level+"%");
$("#tank").css("width", tank_level+"%");
var well = data.well;
if(well == 1)
$("#well_level").text("Well has plenty of water");
else if(well == 0)
$("#well_level").text("Well is empty");
else
$("#well_level").text("Loading...");
console.log(data);
});
}
setInterval(function() {load()}, 1);
});
</script>
</body>
</html>