Better web directory display.

Sun, 07 Jun 2020 20:59:33 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 07 Jun 2020 20:59:33 +0200
changeset 84
d01de33231cb
parent 83
0cc064a4921b
child 85
1e75ca367461

Better web directory display.

image/version.txt file | annotate | diff | comparison | revisions
image/w/logs.html file | annotate | diff | comparison | revisions
--- a/image/version.txt	Sun Jun 07 20:32:32 2020 +0200
+++ b/image/version.txt	Sun Jun 07 20:59:33 2020 +0200
@@ -1,1 +1,1 @@
-0.3.7l
+0.3.7p
--- 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