-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
69 lines (64 loc) · 2 KB
/
index.php
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
<!DOCTYPE HTML>
<HTML>
<html>
<head>
<title>Tankstellen Preise</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#e1b12c">
<link rel="stylesheet" type="text/css" href="./css/viewport.css">
<link rel="manifest" href="tankapp.webmanifest">
<link rel="manifest" href="tankapp.json">
<link rel="apple-touch-icon" href="./image/diesel.png">
<link rel="shortcut icon" href="./image/favicon.ico" type="image/x-icon">
<link rel="icon" href="./image/favicon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" type="text/css" href="./css/nav.css">
<script type="text/javascript">
/*if('serviceWorker' in navigator) {
navigator.serviceWorker.register('./worker.js');
}*/
</script>
</head>
<nav>
<div class="nav">
<a href="./chart.php">Chart</a>
</div>
</nav>
<body>
<table cellspacing=10px>
<tr class=head>
<th>Tankstelle</th>
<th>Ort</th>
<th>Marke</th>
<th>Offen</th>
<th>Preis</th>
</tr>
</table>
<hr/>
<p class="cWhite">Project on <a class="cWhite" href="https://github.com/BukkitGerman/Tankstellen_Application">Github</a></p>
<script type="text/javascript">
let table = document.querySelector("table")
fetch('./data.php?anzahl=12')
.then(response => response.json())
.then(data => {
data["stations"].forEach(station => {
console.log(station)
let row = table.insertRow(1)
let tankstelle = row.insertCell(0)
let ort = row.insertCell(1)
let marke = row.insertCell(2)
let offen = row.insertCell(3)
let preis = row.insertCell(4)
tankstelle.innerText = station.NAME
ort.innerText = station.PLACE
marke.innerText = station.BRAND
offen.innerText = station.ISOPEN ? "Offen" : "Geschlossen"
let preisText = station.PRICE.toString().split("")
preisText.splice(-1, 0, "<sup class='tiny'>")
preis.innerHTML = preisText.join("")+"</sup>"
})
})
</script>
<script src="./js/app.js"></script>
</body>
</html>