-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index_table.html
496 lines (454 loc) · 22.1 KB
/
index_table.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
<!DOCTYPE html>
<html lang="en">
<head>
<title>COVID19-Statistik für Thüringen</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="refresh" content="3600">
<meta name="author" content="Michael Böhme, Florian Kleiner">
<meta name="robots" content="all">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#176fa1">
<meta name="keywords" content="Corona, COVID, COVID19, Altenburger Land, Eichsfeld, Eisenach, Erfurt, Gera, Gotha, Greiz, Hildburghausen, Ilm-Kreis, Jena, Kyffhäuserkreis, Nordhausen, Saale-Holzland-Kreis, Saale-Orla-Kreis, Saalfeld-Rudolstadt, Schmalkalden-Meiningen, Sömmerda, Sonneberg, Suhl, Unstrut-Hainich-Kreis, Wartburgkreis, Weimar, Weimarer Land Thüringen, Statistik, Michael Böhme, Florian Kleiner">
<meta name="description" content="Zusammenfassung und Visualisierung der Coronavirus-Fälle in Jena, Erfurt, Weimar und Thüringen">
<meta name="msapplication-square70x70logo" content="./icons/smalltile.png">
<meta name="msapplication-square150x150logo" content="./icons/mediumtile.png">
<meta name="msapplication-square310x310logo" content="./icons/largetile.png">
<meta property="og:site_name" content="Coronavirus-Fälle in Thüringen">
<meta property="og:title" content="Coronavirus-Fälle in Thüringen">
<meta property="og:description" content="COVID19-Statistik für Thüringen">
<meta property="og:image" content="/corona/logo.jpg">
<meta property="og:type" content="website">
<meta property="og:image:type" content="image/jpeg">
<meta property="og:image:width" content="300">
<meta property="og:image:height" content="300">
<meta property="og:url" content="https://www.michael-böhme.de/corona">
<meta property="og:locale" content="de_DE">
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@theochemiker" />
<meta name="twitter:creator" content="@theochemiker" />
<meta name="twitter:title" content="Coronavirus-Fälle in Thüringen" />
<meta name="twitter:image" content="https://xn--michael-bhme-djb.de/corona/logo.jpg" />
<meta name="twitter:description" content="COVID19-Statistik für Thüringen" />
<link rel="icon" href="./favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="./icons/android-icon.png" sizes="196x196">
<link rel="apple-touch-icon" href="./icons/apple-touch-icon.png">
<link rel="stylesheet" type="text/css" href="./css/styles.css">
<link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css">
<base target="_blank">
<style>
#THtable {
border-spacing: 0;
width: 100%;
border: 1px solid #ddd;
}
#THtable th, td {
text-align: left;
padding: 16px;
}
#THtable #emptyrow {
padding: 0px;
background-color: #d8d8d8;
height: 4px;
line-height: 4px;
}
#THtable #THsums {
font-weight: bold;
}
#THtable #headerrow {
background-color: #d0d0d0;
}
#THtable tr {
background-color: #e2e2e2;
}
#THtable tr:nth-child(even) {
background-color: #f2f2f2;
}
#THtable tr:hover {
background-color: #c9c9c9;
}
#THtable tr th:nth-child(1),td:nth-child(1) {
text-align: right;
}
#THtable tr th:nth-child(3),td:nth-child(3) {
text-align: center;
}
#THtable tr th:nth-child(4),td:nth-child(4) {
text-align: right;
}
#THtable tr th:nth-child(5),td:nth-child(5) {
text-align: right;
}
#THtable tr th:nth-child(6),td:nth-child(6) {
text-align: right;
}
#THtable tr th:nth-child(7),td:nth-child(7) {
text-align: right;
}
#THtable tr th:nth-child(8),td:nth-child(8) {
text-align: right;
}
.minipie {
width: 36px;
height: 36px;
margin-bottom: -18px;
}
.changevalue {
display: inline-block;
vertical-align: middle
}
.changeicon {
display: inline-block;
padding-top: 2px;
vertical-align: middle;
}
.changeRed {
color: #800000;
}
.changeNeutral {
color: #AAAAAA;
}
.changeGreen {
color: #008000;
}
.headerClass {
}
.sortableColumn {
cursor: pointer;
}
@media (max-width: 800px) {
#THtable th, td {
font-size: 10px;
padding-left: 2px;
padding-right: 2px;
}
#THtable tr th:nth-child(1),td:nth-child(1) {
display: none;
}
#THtable th p {
writing-mode: vertical-lr;
min-width: 40px;
transform: rotate(180deg);
margin: 0px;
}
#THtable th:nth-child(2) p {
writing-mode: inherit;
transform: rotate(0deg);
}
#THtable th:nth-child(3) p {
writing-mode: inherit;
transform: rotate(0deg);
}
.minipie {
width: 28px;
height: 28px;
margin-bottom: -13px;
}
}
</style>
</head>
<body>
<div class="navBar">
<div class="navDropdown">
<button class="navButton"><i class="fa fa-bars" aria-hidden="true"></i></button>
<div class="navLinks">
<a target="_self" href="./index.html">Startseite</a>
<a target="_self" href="./index_7d_incidence.html">7-Tages-Inzidenz</a>
<a target="_self" href="./index_active_cases.html">aktive Fälle</a>
<a target="_self" href="./index_th_all.html">alle Regionen</a>
<a target="_self" href="./index_rki.html">RKI-Daten</a>
<a target="_self" href="./index_map.html">interaktive Karte</a>
<hr>
<a target="_self" href="#Info">Info</a>
</div>
</div>
</div>
<noscript>
<strong>Diese Tabelle benötigt JavaScript!</strong>
</noscript>
<div class="centerText">
<h1>COVID19-Statistik für Thüringen</h1>
Quelle: <a href="https://corona.rki.de">Robert Koch-Institut</a><span id="labelDate"></span>
<br>
<a target="_self" href="./index_7d_incidence.html">Visualisierung der 7-Tages-Inzidenz</a> · <a target="_self" href="./index_active_cases.html">Visualisierung der aktiven Fälle</a><br>
<br>
<br>
<select id="RKI_date" style="display: none;"></select><br>
<div lang="de" style="hyphens: auto;">
<table id="THtable">
<tr id="headerrow">
<th class="sortableColumn" title="nach Nummer sortieren"><p>#</p></th>
<th class="sortableColumn" title="nach Namen sortieren"><p>Region</p></th>
<th class="sortableColumn" title="nach aktiven Fällen (prozentual) sortieren"><p>%</p></th>
<th class="sortableColumn" title="nach Neuinfektionen sortieren"><p>Neu­in­fek­ti­onen</p></th>
<th class="sortableColumn" title="nach aktiven Fällen sortieren"><p>aktive Fälle<sup>*</sup></p></th>
<th class="sortableColumn" title="nach bestätigten Fällen sortieren"><p>be­stätigte Fälle</p></th>
<th class="sortableColumn" title="nach Genesungen sortieren"><p>Ge­ne­sung­en<sup>*</sup></p></th>
<th class="sortableColumn" title="nach Todesfällen sortieren"><p>Todes­fälle</p></th>
</tr>
</table>
</div>
<br>
<sup>*</sup> Zahl der Genesenen ist durch das Robert Koch-Institut geschätzt<br>
<br>
</div>
<script>
var THtable = document.getElementById('THtable');
var loadedJSON = false;
var loadedJSONDates = false;
var firstRun = true;
var regions = {
"ABG": { i: 1, s: 0, l: "Altenburger Land", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index_th_all.html#graph_ABG" },
"EIC": { i: 2, s: 0, l: "Eichsfeld", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index_th_all.html#graph_EIC" },
"EA": { i: 3, s: 1, l: "Eisenach", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index_th_all.html#graph_EA" },
"EF": { i: 4, s: 1, l: "Erfurt", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index.html#Erfurt" },
"G": { i: 5, s: 1, l: "Gera", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index.html#Gera" },
"GTH": { i: 6, s: 0, l: "Landkreis Gotha", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index_th_all.html#graph_GTH" },
"GRZ": { i: 7, s: 0, l: "Landkreis Greiz", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index_th_all.html#graph_GRZ" },
"HBN": { i: 8, s: 0, l: "Landkreis Hildburghausen", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index_th_all.html#graph_HBN" },
"IK": { i: 9, s: 0, l: "Ilm-Kreis", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index_th_all.html#graph_IK" },
"J": { i: 10, s: 1, l: "Jena", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index.html#Jena" },
"KYF": { i: 11, s: 0, l: "Kyffhäuserkreis", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index_th_all.html#graph_KYF" },
"NDH": { i: 12, s: 0, l: "Landkreis Nordhausen", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index_th_all.html#graph_NDH" },
"SHK": { i: 13, s: 0, l: "Saale-Holzland-Kreis", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index_th_all.html#graph_SHK" },
"SOK": { i: 14, s: 0, l: "Saale-Orla-Kreis", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index_th_all.html#graph_SOK" },
"SLF": { i: 15, s: 0, l: "Landkreis Saalfeld-Rudolstadt", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index_th_all.html#graph_SLF" },
"SM": { i: 16, s: 0, l: "Landkreis Schmalkalden-Meiningen", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index_th_all.html#graph_SM" },
"SHL": { i: 17, s: 1, l: "Suhl", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index_th_all.html#graph_SHL" },
"SOM": { i: 18, s: 0, l: "Landkreis Sömmerda", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index_th_all.html#graph_SOM" },
"SON": { i: 19, s: 0, l: "Landkreis Sonneberg", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index_th_all.html#graph_SON" },
"UH": { i: 20, s: 0, l: "Unstrut-Hainich-Kreis", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index_th_all.html#graph_UH" },
"WAK": { i: 21, s: 0, l: "Wartburgkreis", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index_th_all.html#graph_WAK" },
"WE": { i: 22, s: 1, l: "Weimar", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index.html#Weimar" },
"AP": { i: 23, s: 0, l: "Weimarer Land", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index_th_all.html#graph_AP" },
"TH": { i: 0, s: 2, l: "Thüringen", ti: 0, tr: 0, td: 0, ni: 0, nr: 0, nd: 0, u: "./index.html#TH" },
};
function getPrefix( value ) {
return ( value >= 0 ) ? '+' : '−';;
}
function parseRKIData(jsonObj) {
loadedJSON = true;
for (var region in regions) {
if ( jsonObj.hasOwnProperty(region) ) {
regions[region]['ti'] = jsonObj[region][0];
regions[region]['tr'] = jsonObj[region][1];
regions[region]['td'] = jsonObj[region][2];
regions[region]['ta'] = jsonObj[region][0] - jsonObj[region][1] - jsonObj[region][2];
regions[region]['ni'] = jsonObj[region][3];
regions[region]['nr'] = jsonObj[region][4];
regions[region]['nd'] = jsonObj[region][5];
regions[region]['na'] = jsonObj[region][3] - jsonObj[region][4] - jsonObj[region][5];
}
}
setupTable();
}
function loadRKIData(url) {
var request = new XMLHttpRequest();
request.open('GET', url, true);
request.responseType = 'json';
request.onload = function() {
if ( request.status == 200 )
parseRKIData(request.response);
}
request.send();
}
function parseRKIDates(jsonObj) {
loadedJSONDates = true;
jsonObj.reverse();
var comboBox = document.getElementById('RKI_date');
if ( comboBox == null )
return;
if ( THtable == null )
return;
for ( d in jsonObj ) {
var option = document.createElement("option");
option.text = "Stand: " + jsonObj[d]["date"];
option.setAttribute("file", jsonObj[d]["file"]);
comboBox.add(option);
}
comboBox.selectedIndex = 0;
comboBox.onchange = function(){ onDateChanged(); };
comboBox.style = "display: block; margin: auto;";
}
function onDateChanged() {
var comboBox = document.getElementById('RKI_date');
if ( comboBox == null )
return;
var option = comboBox.options[ comboBox.selectedIndex ]
loadedJSON = false;
while ( THtable.rows.length > 1 ) {
THtable.deleteRow(-1);
}
setTimeout(function () { if ( loadedJSON == false) { showErrorMsg(); } }, 3000);
loadRKIData("./data/rki_th_by_date/" + option.getAttribute('file'));
}
function loadRKIDates() {
var url = './data/rki_th_by_date/cases_by_region_list.json';
var request = new XMLHttpRequest();
request.open('GET', url, true);
request.responseType = 'json';
request.onload = function() {
if ( request.status == 200 )
parseRKIDates(request.response);
}
request.send();
}
function checkPieChartVisibility() {
var comboBox = document.getElementById('RKI_date');
if ( ( comboBox == null ) || ( THtable == null ) )
return;
var headerCells = Array.from(THtable.querySelectorAll('th'));
headerCells[2].style = (comboBox.selectedIndex == 0 ? "display: table-cell; vertical-align: middle" : "display: none;" );
var tableRows = Array.from(THtable.querySelectorAll('tr'));
for ( row in tableRows ) {
var cellsInRow = Array.from(tableRows[row].querySelectorAll('td'));
if ( cellsInRow.length > 0 ) {
if ( cellsInRow[2].innerHTML != " " ) {
if (cellsInRow[2].style['display'] != 'none') {
cellsInRow[2].style = (comboBox.selectedIndex == 0 ? "display: inline-block; vertical-align: middle" : "display: none;" );
}
} else {
if (cellsInRow[2].style['display'] != 'none') {
cellsInRow[2].style = (comboBox.selectedIndex == 0 ? "display: inline; vertical-align: middle" : "display: none;" );
}
}
}
}
}
function getFAIncClass(inc) {
return ( inc < 0 ? "fa-arrow-circle-o-down" : ( inc > 0 ? "fa-arrow-circle-o-up" : "fa-circle-o" ) )
}
function getIncColor(inc, inv) {
return ( inc < 0 ? ( inv ? "changeRed" : "changeGreen" ) : ( inc > 0 ? ( inv ? "changeGreen" : "changeRed" ) : "changeNeutral" ) );
}
function setupTable() {
if ( THtable == null )
return;
for (var region in regions) {
// add a new row
if ( regions[region]['s'] == 2 ) {
var row = THtable.insertRow(1);
row.id = "emptyrow";
for ( var i = 0; i < 8; i++ ) {
var emptycell = row.insertCell(-1);
emptycell.innerHTML = " ";
emptycell.style = "padding: 0px;";
}
var row = THtable.insertRow(1);
row.id = "THsums";
} else {
var row = THtable.insertRow(-1);
}
var tooltip = "bestätigte Fälle: " + regions[region]['ti'] + "\n";
tooltip += "aktive Fälle: " + regions[region]['ta'] + " (" + (100.0*regions[region]['ta']/regions[region]['ti']).toFixed(1) + "%)\n";
tooltip += "Genesene: " + regions[region]['tr'] + " (" + (100.0*regions[region]['tr']/regions[region]['ti']).toFixed(1) + "%)\n";
tooltip += "Todesfälle: " + regions[region]['td'] + " (" + (100.0*regions[region]['td']/regions[region]['ti']).toFixed(1) + "%)";
// add the cells
var theCell = row.insertCell(-1);
theCell.innerHTML = regions[region]['s'] != 2 ? regions[region]['i'] : "" ;
theCell.setAttribute('sorttable_customkey', regions[region]['i']);
theCell.setAttribute('title', tooltip);
var theCell = row.insertCell(-1);
theCell.innerHTML = "<a target=\"_self\" href=\"" + regions[region]['u'] + "\">" + regions[region]['l'] + "</a>";
theCell.setAttribute('sorttable_customkey', regions[region]['l']);
theCell.setAttribute('title', tooltip);
var theCell = row.insertCell(-1);
theCell.innerHTML = "<img class=\"minipie\" src=\"./icons/pie_chart_mini_" + region + ".png\">";
theCell.setAttribute('sorttable_customkey', 100.0 * regions[region]['ta'] / regions[region]['ti']);
theCell.setAttribute('title', tooltip);
var theCell = row.insertCell(-1);
theCell.innerHTML = getPrefix(regions[region]['ni']) + Math.abs(regions[region]['ni']);
theCell.setAttribute('sorttable_customkey', regions[region]['ni']);
theCell.setAttribute('title', tooltip);
var theCell = row.insertCell(-1);
theCell.innerHTML = "<div class=\"changevalue\">" + regions[region]['ta'] + "</div> <div class=\"changeicon\"><i class=\"fa " + getFAIncClass(regions[region]['na']) + " " + getIncColor(regions[region]['na'], false) + "\" aria-hidden=\"true\"></i></div>";
theCell.setAttribute('sorttable_customkey', regions[region]['ta']);
var tooltip = "" + getPrefix(regions[region]['na']) + Math.abs(regions[region]['na']) + " (" + getPrefix(regions[region]['na']) + ( regions[region]['ta'] != 0 ? (100.0*Math.abs(regions[region]['na'])/regions[region]['ta']).toFixed(1) : "0.0") + "%) gegenüber Vortag";
theCell.setAttribute('title', tooltip);
var theCell = row.insertCell(-1);
theCell.innerHTML = "<div class=\"changevalue\">" + regions[region]['ti'] + "</div> <div class=\"changeicon\"><i class=\"fa " + getFAIncClass(regions[region]['ni']) + " " + getIncColor(regions[region]['ni'], false) + "\" aria-hidden=\"true\"></i></div>";
theCell.setAttribute('sorttable_customkey', regions[region]['ti']);
var tooltip = "" + getPrefix(regions[region]['ni']) + Math.abs(regions[region]['ni']) + " (" + getPrefix(regions[region]['ni']) + ( regions[region]['ti'] != 0 ? (100.0*Math.abs(regions[region]['ni'])/regions[region]['ti']).toFixed(1) : "0.0" ) + "%) gegenüber Vortag";
theCell.setAttribute('title', tooltip);
var theCell = row.insertCell(-1);
theCell.innerHTML = "<div class=\"changevalue\">" + regions[region]['tr'] + "</div> <div class=\"changeicon\"><i class=\"fa " + getFAIncClass(regions[region]['nr']) + " " + getIncColor(regions[region]['nr'], true ) + "\" aria-hidden=\"true\"></i></div>";
theCell.setAttribute('sorttable_customkey', regions[region]['tr']);
var tooltip = "" + getPrefix(regions[region]['nr']) + Math.abs(regions[region]['nr']) + " (" + getPrefix(regions[region]['nr']) + ( regions[region]['tr'] != 0 ? (100.0*Math.abs(regions[region]['nr'])/regions[region]['tr']).toFixed(1) : "0.0" ) + "%) gegenüber Vortag";
theCell.setAttribute('title', tooltip);
var theCell = row.insertCell(-1);
theCell.innerHTML = "<div class=\"changevalue\">" + regions[region]['td'] + "</div> <div class=\"changeicon\"><i class=\"fa " + getFAIncClass(regions[region]['nd']) + " " + getIncColor(regions[region]['nd'], false) + "\" aria-hidden=\"true\"></i></div>";
theCell.setAttribute('sorttable_customkey', regions[region]['td']);
var tooltip = "" + getPrefix(regions[region]['nd']) + Math.abs(regions[region]['nd']) + " (" + getPrefix(regions[region]['nd']) + ( regions[region]['td'] != 0 ? (100.0*Math.abs(regions[region]['nd'])/regions[region]['td']).toFixed(1) : "0.0" ) + "%) gegenüber Vortag";
theCell.setAttribute('title', tooltip);
}
if ( firstRun == true ) {
firstRun = false;
return;
}
checkPieChartVisibility();
}
function showErrorMsg() {
if ( THtable == null )
return;
var row = THtable.insertRow(-1);
emptycell = row.insertCell(-1);
emptycell.colSpan = 9;
emptycell.style="color: #FF0000; text-align: center;";
emptycell.innerHTML = "<b>Fehler! Daten konnten nicht geladen werden!</b>";
}
window.onload = function () {
loadRKIData("./data/rki_th/current_cases_by_region.json");
loadRKIDates();
setTimeout(function () { if ( loadedJSON == false) { showErrorMsg(); } }, 3000);
}
// sortable table inspired by https://stackoverflow.com/a/49041392
const getCellValue = (tr, idx) => tr.children[idx].getAttribute('sorttable_customkey');
const comparer = (idx, asc) => (a, b) => ((v1, v2) => v1 !== '' && v2 !== '' && !isNaN(v1) && !isNaN(v2) ? v1 - v2 : v1.toString().localeCompare(v2))(getCellValue(asc ? a : b, idx), getCellValue(asc ? b : a, idx));
document.querySelectorAll('th.sortableColumn').forEach(th => th.addEventListener('click', (() => {
if ( loadedJSON == false )
return;
// exclude and remove last two lines
var sLine1 = document.getElementById('emptyrow');
var sLine2 = document.getElementById('THsums');
THtable.deleteRow(1);
THtable.deleteRow(1);
// change text color of selected column
var iIndex = Array.from(th.parentNode.children).indexOf(th);
var headerCells = Array.from(THtable.querySelectorAll('th'));
var tableRows = Array.from(THtable.querySelectorAll('tr'));
for (cell in headerCells) {
headerCells[cell].style = (headerCells[cell] == th ? "color: #5070A0;" : "color: #000000;" );
}
for (row in tableRows) {
var rowCells = Array.from(tableRows[row].querySelectorAll('td'));
for ( cell in rowCells ) {
rowCells[cell].style = (iIndex == cell ? "color: #305080;" : "color: #000000;" );
}
}
// sort the rows
var theArray = Array.from(THtable.querySelectorAll('tr:nth-child(n+2)'));
theArray.sort(comparer(iIndex, this.asc = !this.asc)).forEach(tr => THtable.appendChild(tr) );
// add the last two lines again
THtable.insertBefore(sLine1, theArray[0]);
THtable.insertBefore(sLine2, sLine1);
checkPieChartVisibility();
})));
</script>
<div class="centerText">
<a target="_self" href="./index.html">« zurück zur Startseite «</a>
<br>
<br>
<h1 id="Info">Info über diese Seite</h1>
<br>
Die Daten können je nach Quelle und Uhrzeit variieren und werden stündlich aktualisiert.<br>
<br>
<a href="https://www.uni-jena.de/200422_Boehme_Interview">Interview</a> · <a href="https://github.com/micb25/corona-jena/blob/master/README.md">Zusammenfassung</a> · <a href="https://github.com/micb25/corona-jena/blob/master/data/README.md">Daten</a> · <a href="https://github.com/micb25/corona-jena">Quellcode</a><br>
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=HGW4VMH2XP5WY&source=url">☕ Kaffee spendieren ☕</a><br>
<br>
Autor: <a href="https://www.michael-böhme.de/">Michael Böhme</a><br>
mit Unterstützung von <a href="https://floriankleiner.de">Florian Kleiner</a><br>
Abbildungen sind lizensiert unter <a href="https://creativecommons.org/licenses/by-nc-sa/3.0/de/">CC BY-NC-SA</a><br>
<br>
<br>
</div>
</body>
</html>