-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathnewsletter-frontend-alt.html
104 lines (92 loc) · 3.55 KB
/
newsletter-frontend-alt.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
<!doctype html>
<html lang="de">
<head>
<title>COVID-19 Landkreis Newsletter - Konfiguration</title>
<meta charset="utf-8">
<meta name="author" content="Dr. Torben Menke">
<link rel="stylesheet" href="/style.css" />
<script src="./newsletter-frontend.js"></script>
<script src="./eCharts/jquery-3.5.0.min.js"></script>
<!-- Polyfiles for IE, suggested by Tabulator : http://tabulator.info/docs/4.6/browsers#ie -->
<script src="./tabulator/polyfill.min.js"></script>
<script src="./tabulator/fetch.umd.js"></script>
<!-- Tabulator -->
<link href="./tabulator/tabulator.min.css" rel="stylesheet">
<script src="./tabulator/tabulator-4.6.min.js"></script>
<script>
// from https://stackoverflow.com/questions/4297765/make-a-javascript-array-from-url
// needed as
// const urlParams = new URLSearchParams(window.location.search);
// is not available in Edge and IE :-(
</script>
</head>
<body onload="refresh_userdata()">
<script>
var hash;
var urlParams = [];
ensureHashIsValid()
</script>
<h1>COVID-19 Landkreis Newsletter - Konfiguration</h1>
<table>
<tr>
<th>E-Mail</th>
<!-- <th>verified</th> -->
<th>Sende-<br />Häufigkeit</th>
<th>Schwellwert*</th>
<!-- <th>Landkreise</th> -->
<th> </th>
</tr>
<tr>
<td><input type="email" id="email" name="email" readonly></td>
<td>
<select id="frequency" name="frequency" onchange="setFrequency()">
<option value="0">Schwellwertüberschreitung</option>
<option value="1">täglich</option>
<option value="7">wöchentlich (Sonntags)</option>
</select>
</td>
<td><input type="number" id="threshold" name="threshold" min="50" max="500" step="1" value="300"></td>
<!-- <td><input type="checkbox" id="verified" name="verified" value="verified" disabled readonly></td> -->
<!-- <td><input type="text" id="regions" name="regions" readonly></td> -->
<td><button onclick="refresh_userdata()">Reload</button> </td>
</tr>
</table>
<small>*Schwellwert bezieht sich auf Neu-Infizierte letzte 7 Tage pro Mill.EW.<br /> Enter zum Speichern</small>
<h2>Landkreisauswahl</h2>
<p>Weitere Daten zu den Landkreisen siehe die <a href="https://entorb.net/COVID-19-coronavirus/#DeDistrictTable" target="_blank">Landkreistabelle</a> in meinen Auswertungen.</p>
<!-- Start Table -->
<div id="table-de-districts"></div>
<p> <button onclick="unsubscribe()">Den Newsletter abbestellen</button></p>
<!-- Start Footer -->
<hr>
<a href="/">Home</a> - <a href="/contact.php?origin=COVID-19">Contact</a> - <a href="/impressum.php">Impressum</a>
<!--
Start JavaScript
-->
<script>
// variables
const promises = []; // array of promises for async fetching
var l_my_regions;
// logic for form elements
var input_email = document.getElementById("email");
var input_frequency = document.getElementById("frequency");
// var input_verified = document.getElementById("verified");
// var input_regions = document.getElementById("regions");
var input_threshold = document.getElementById("threshold");
input_threshold.addEventListener("keydown", function (e) {
// Enter is pressed
if (e.keyCode === 13) {
event.preventDefault();
setThreshold();
}
}, false);
// handling of action=verify
if ('action' in urlParams && urlParams.action == "verify") {
setVerified();
}
// define and populate table
var table = defineTable();
promises.push(fetch_table_data());
</script>
</body>
</html>