forked from Lobby-Hoes/mathefacts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
81 lines (77 loc) · 2.49 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
<html lang="de">
<head>
<title>Mathefacts</title>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.12.0/css/jquery.dataTables.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script type="text/javascript" charset="utf8"
src="https://cdn.datatables.net/1.12.0/js/jquery.dataTables.js"></script>
</head>
<body>
<h1>Mathefacts</h1>
<table id="mathefacts" class="display" style="width:100%">
<thead>
<tr>
<th>Folge</th>
<th>Folgentitel</th>
<th>Faktthema</th>
<th>Fakt</th>
<th>Startzeit</th>
<th>Endzeit</th>
<th>Dauer</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Folge</th>
<th>Folgentitel</th>
<th>Faktthema</th>
<th>Fakt</th>
<th>Startzeit</th>
<th>Endzeit</th>
<th>Dauer</th>
</tr>
</tfoot>
</table>
<script type="text/javascript">
$(document).ready(function () {
// Setup - add a text input to each footer cell
$('#mathefacts tfoot th').each(function () {
var title = $(this).text();
$(this).html('<input type="text" placeholder="Suche ' + title + '" />');
});
// DataTable
var table = $('#mathefacts').DataTable({
responsive: true,
ajax: 'data.json',
columns: [
{data: 'id'},
{data: 'name'},
{data: 'faktthema'},
{data: 'beschreibung'},
{data: 'startzeit'},
{data: 'endzeit'},
{
data: null, render: function (data, type, row) {
const diff = new Date(new Date("1970-1-1 " + data["endzeit"]) - new Date("1970-1-1 " + data["startzeit"]));
return (diff.getMinutes() + ":" + diff.getSeconds())
}
}
],
initComplete: function () {
// Apply the search
this.api()
.columns()
.every(function () {
var that = this;
$('input', this.footer()).on('keyup change clear', function () {
if (that.search() !== this.value) {
that.search(this.value).draw();
}
});
});
}
});
});
</script>
</body>
</html>