add links for GPX downloads
authorRobert Kaiser <kairo@kairo.at>
Fri, 20 Oct 2017 20:40:28 +0000 (22:40 +0200)
committerRobert Kaiser <kairo@kairo.at>
Fri, 20 Oct 2017 20:40:28 +0000 (22:40 +0200)
js/library.js

index 3d0c521..2130f02 100644 (file)
@@ -24,8 +24,14 @@ function showLibrary() {
       else {
         for (var i = 0; i < aResult.length; i++) {
           var litem = document.createElement("li");
-          litem.textContent = aResult[i]["time_created"] + " - " + aResult[i]["comment"] +
-                              (aResult[i]["devicename"] ? " (" + aResult[i]["devicename"] +  ")" : "");
+          litem.textContent = aResult[i]["time_created"] + " - ";
+          var llink = document.createElement("a");
+          llink.setAttribute("href", gBackendURL + "/track_gpx?id=" + aResult[i]["id"]);
+          llink.textContent = aResult[i]["comment"];
+          litem.appendChild(llink);
+          if (aResult[i]["devicename"]) {
+            litem.appendChild(document.createTextNode(" (" + aResult[i]["devicename"] +  ")"));
+          }
           tlist.appendChild(litem);
         }
       }