summaryrefslogtreecommitdiffhomepage
path: root/plugins/webbox/html
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-05-11 19:46:30 +0200
committerRoland Reichwein <mail@reichwein.it>2020-05-11 19:46:30 +0200
commit15b2be158ac0147982dd30382251b3ce83e219c7 (patch)
treefbad8b504b91f141b0bfcd85f6ddaaef497b297b /plugins/webbox/html
parentb671c8c07ae7690e069c8e3c1ef54a31c591775d (diff)
Generate download link for files
Diffstat (limited to 'plugins/webbox/html')
-rw-r--r--plugins/webbox/html/webbox.css2
-rw-r--r--plugins/webbox/html/webbox.js26
2 files changed, 23 insertions, 5 deletions
diff --git a/plugins/webbox/html/webbox.css b/plugins/webbox/html/webbox.css
index 71e3673..6ea5147 100644
--- a/plugins/webbox/html/webbox.css
+++ b/plugins/webbox/html/webbox.css
@@ -248,10 +248,12 @@ table.list td.name {
}
/* Tooltip container */
+/*
.tooltip {
position: relative;
display: inline-block;
}
+*/
/* Tooltip text */
/*
diff --git a/plugins/webbox/html/webbox.js b/plugins/webbox/html/webbox.js
index c25b039..e056c16 100644
--- a/plugins/webbox/html/webbox.js
+++ b/plugins/webbox/html/webbox.js
@@ -41,25 +41,41 @@ function loadContents(dir) {
} else {
for (var i = 0; i < listElements.length; i++) {
var type = listElements[i].getAttribute("type");
+ var filename = listElements[i].textContent;
+ var mouse_click =
+ "onclick=\"entryMouse('" + filename + "')\"";
+
+ var full_path = currentDir + "/" + filename;
+ if (full_path.substr(0, 2) == "//") {
+ full_path = full_path.substr(1);
+ }
+
+ // make relative path
+ while (full_path.substr(0, 1) == "/") {
+ full_path = full_path.substr(1);
+ }
+
+ var name_td;
if (type == "file") {
type = "<img src=\"webbox-html/file.png\"/>";
+ name_td = "<td><a href=\"" + full_path + "\"><div class=\"name\" style=\"height:100%;width:100%\">" + filename + "</div></a></td>";
} else if (type == "dir") {
type = "<img src=\"webbox-html/directory.png\"/>";
+ name_td = "<td class=\"name\" " + mouse_click + ">" + filename + "</td>";
} else {
type = "";
}
var selector = "<td class=\"selector\"></td>";
- if (listElements[i].textContent != "..") {
- selector = "<td class=\"selector\" onclick=\"toggleSelection('" + listElements[i].textContent + "')\">&#9744;</td>";
+ if (filename != "..") {
+ selector = "<td class=\"selector\" onclick=\"toggleSelection('" + filename + "')\">&#9744;</td>";
}
- var mouse_click =
- "onclick=\"entryMouse('" + listElements[i].textContent + "')\"";
result += "<tr>" +
selector +
"<td class=\"type\" " + mouse_click + ">" + type + "</td>" +
- "<td class=\"name\" " + mouse_click + ">" + listElements[i].textContent + "</td></tr>";
+ name_td +
+ "</tr>";
}
}