-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweb-site_logscript.html
66 lines (51 loc) · 2.49 KB
/
web-site_logscript.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
<!--
Copyright 2017 Lars Bremer
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
//////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// Dynamische Daten fue Site mit Statuslog laden und Tabelle erstellen //
// //
// V1.0 2017-02-27 LB Initiale Version zum internen Test //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////////
-->
<!DOCTYPE html>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
//Beim Seite Laden beide Listen erstellen
$(function() {
google.script.run.withSuccessHandler(buildLog).getLogData();
TimeStamp();
//Alle 10 Sekunden Daten neu laden
setInterval(function(){
google.script.run.withSuccessHandler(buildLog).getLogData();
TimeStamp();
}, 10000);
});
//Zeitstempel fuer Stand der Daten aktualisieren
function TimeStamp() {
var d = new Date();
//Zeitangabe selbst zusammenbauen, Monate und Stunden/Minuten korrigieren
document.getElementById("timestamp").innerHTML = d.getDate().toString() + '.' + (d.getMonth()+1).toString() + '.' + d.getFullYear().toString()
+ ' - ' + ((d.getHours()<10?'0':'').toString() + d.getHours().toString()) + ':' + ((d.getMinutes()<10?'0':'').toString() + d.getMinutes().toString());
}
//Gesamtsummentabelle erstellen
function buildLog(log) {
var loglist = $('#loglist');
loglist.empty();
//Ueberschrift
loglist.append('<tr><th>Meldung am</th> <th>Meldung</th></tr>');
//Werte
for (var i = 0; i < log.length; i++) {
loglist.append('<tr> <td>' + log[i][0] + '</td>' + '<td>' + log[i][1] + '</td> </tr>');
}
}
</script>