image/w/logs.html

changeset 84
d01de33231cb
parent 40
71e06f6d80fd
--- a/image/w/logs.html	Sun Jun 07 20:32:32 2020 +0200
+++ b/image/w/logs.html	Sun Jun 07 20:59:33 2020 +0200
@@ -14,11 +14,11 @@
  <table class="directory">
   <thead>
    <tr class="directory">
-    <th>Bestand</th>
-    <th>Grootte</th>
-    <th>Datum</th>
-    <th>Actie</th>
-    <th>Actie</th>
+    <th align="left">Bestand</th>
+    <th align="left">Grootte</th>
+    <th align="left">Datum</th>
+    <th align="left">Actie</th>
+    <th align="left">Actie</th>
    </tr>
   </thead>
   <tbody id="tbody">
@@ -33,6 +33,10 @@
 
  <script>
 
+function getFileExtension(filename) {
+  return filename.substring(filename.lastIndexOf('.')+1, filename.length) || filename;
+}
+
 $.getJSON("/logfiles.json", function(data) {
   var folder = data.Dir.map(function(item) {
     return item.Folder;
@@ -62,9 +66,13 @@
     + "<td>" + obj.File + "</td>"
     + "<td>" + obj.Size + " bytes</td>"
     + "<td>" + str + "</td>"
-    + "<td><a href=\"/log/" + obj.File + "\">Download</a></td>"
-    + "<td><a href=\"/chart.html?show=/log/" + obj.File + "\">Grafiek</a></td>"
-    + "</tr>";
+    + "<td><a href=\"/log/" + obj.File + "\">Download</a></td>";
+    if (getFileExtension(obj.File) == 'json') {
+      eachrow += "<td><a href=\"/chart.html?show=/log/" + obj.File + "\">Grafiek</a></td>";
+    } else {
+      eachrow += "<td> </td>";
+    }
+    eachrow += "</tr>";
     $('#tbody').append(eachrow);
   });
 });

mercurial