-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
157 lines (136 loc) · 5.11 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
<!DOCTYPE html><html><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><title>Widget Engine</title>
<style>
body {
-ms-overflow-style: none;
height: 434px;
margin: 46px 0 0 0;
position:relative;
/*background-image: url("SMEGbackground.jpg");
background:#000000;
font-family: 'Gill Sans PSA', arial, sans-serif;
font-size: 14px;*/
background:#000000;
color:#FFFFFF;
}
a{
color:#FF0;
}
#infos {
position: absolute;
left: 100px;
top: 0;
width: 600px;
}
#infos .bloc {
float: left;
width: 136px;
height: 94px;
margin: 0 0 1px 1px;
border: 1px white solid;
padding: 18px 5px;
text-align: center;
margin: 0px 10px;
margin-bottom: 5px;
}
#infos .bloc .valeur {
font-size: 200%;
padding-top: 10px;
color: white;
}
#infos .bloc.small {
float: left;
width: 136px;
height: 45px;
margin: 0 0 1px 1px;
border: 1px white solid;
padding: 10px 5px;
text-align: center;
}
#infos .bloc.small .titre {
padding-bottom: 5px;
}
#infos .bloc.small .valeur {
font-size: 150%;
padding-top: 5px;
color: white;
display:inline;
}
#infos .bloc.small .unite {
font-size: 150%;
padding-left: 5px;
display:inline;
}
#infos .bloc.small.nav-button-container {
width: 34px;
height: 246px;
word-wrap: break-word;
}
.titre.button {
position: relative;
top: 35%;
}
</style>
</head>
<body>
<div id="infos">
<div>
<div style="float: right; margin: 5px 20px 0 0" id="obd2-status"></div>
<h2 style="margin: 5px 0">SMEG PowerUp! v0.1</h2>
</div>
<br style="clear:both"/>
<div style="float: left; width:696px">
<div style="margin-left: 57px;" class="bloc" id="bloc-screenmirror"><a href="screenmirror.php"><img src="mirror_phone.png"></a></div>
<div class="bloc" id="bloc-property-list"><a href="list.html"><img src="code.png"></a></div>
<div class="bloc" id="bloc-configuration"><a href="config.html"><img src="sliders.png"></a></div>
<div style="margin-left: 57px;" class="bloc" id="bloc-configuration"><a href="adblue-fill.html"><img src="adblue.png"></a></div>
<div class="bloc" id="bloc-mileage"><div class="titre">Mileage</div><div id="mileage-val" class="valeur" style="font-size: 165%"></div><div class="unite">km</div></div>
<div class="bloc" id="bloc-autonomy"><div class="titre">Autonomy</div><div id="autonomy-val" class="valeur"></div><div class="unite">km</div></div>
<br style="clear:both"/>
<div style="border: 1px solid #FFFFFF; background-color: black; height: 50px; width: 86%">
<div id="adblue-level" style="height:50px; width: 50%; background-color: #246db0; text-align: center; font-size: 40px; white-space: nowrap;">?L / 17L</div>
</div>
</div>
<div>
</div>
</div>
</body>
<script>
(function(){
var D = document, P = /complete|loaded|interactive/,
onready = function(a) {
P.test(D.readyState) ? a() : D.addEventListener("DOMContentLoaded", function () {
a()
}, !1);
},
updateAdblue = function() {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(event) {
if (this.readyState === 4) { // XMLHttpRequest.DONE === 4
if (this.status === 200) {
var resp = this.responseText;
console.log("response: " + resp);
if(typeof resp.error == "undefined") {
var remaining = resp.toString();
var adblueLevelElement = document.getElementById("adblue-level");
adblueLevelElement.innerHTML = remaining + "L / 17L";
adblueLevelElement.style.width = (parseFloat(remaining)/17)*100 + "%";
}
}
}
};
xhr.open('GET', 'write_sd.php?type=adblue&mileage=' + top.GetCar.Mileage(), true);
xhr.send(null);
},
updateValues = function() {
document.getElementById("autonomy-val").innerHTML = top.GetCar.Autonomy();
document.getElementById("mileage-val").innerHTML = top.GetCar.Mileage();
},
mainFunction = function() {
setInterval(updateValues, 1000);
setInterval(updateAdblue, 5000);
}
onready(mainFunction);
updateAdblue();
})();
</script>
</html>