summaryrefslogtreecommitdiffhomepage
path: root/plugins/webbox/html/webbox.js
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-05-12 19:18:16 +0200
committerRoland Reichwein <mail@reichwein.it>2020-05-12 19:18:16 +0200
commit0a4b9218017db3d058f5e215f855bc3f97bd161b (patch)
tree6be4a54e6979549493a9f8126ebd62d4d7e40867 /plugins/webbox/html/webbox.js
parent11bf077027ec2833d1944a79eeb4d5407195af09 (diff)
Add links to partial pathes in directory line
Diffstat (limited to 'plugins/webbox/html/webbox.js')
-rw-r--r--plugins/webbox/html/webbox.js23
1 files changed, 21 insertions, 2 deletions
diff --git a/plugins/webbox/html/webbox.js b/plugins/webbox/html/webbox.js
index 6201e55..f1c01f5 100644
--- a/plugins/webbox/html/webbox.js
+++ b/plugins/webbox/html/webbox.js
@@ -58,7 +58,7 @@ function loadContents(dir) {
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>";
+ name_td = "<td><a href=\"" + full_path + "\"><div class=\"name\">" + filename + "</div></a></td>";
} else if (type == "dir") {
type = "<img src=\"webbox-html/directory.png\"/>";
name_td = "<td class=\"name\" " + mouse_click + ">" + filename + "</td>";
@@ -384,13 +384,32 @@ function initMainpage2() {
}
}
+function addDirectoryLinks(path) {
+ var pos = 0;
+ var result = "";
+ var partial_path = "";
+
+ while (pos < path.length) {
+ var oldpos = pos;
+ pos = path.indexOf("/", pos + 1);
+ if (pos == -1) {
+ pos = path.length;
+ }
+
+ partial_path += path.substr(oldpos, pos - oldpos);
+ result += "<span class=\"link\" onclick=\"setCurrentDir('" + partial_path + "')\">" + path.substr(oldpos, pos - oldpos) + "</span>";
+ }
+
+ return result;
+}
+
function setCurrentDir(newDir) {
currentDir = newDir;
loadContents(newDir);
var menu = document.getElementsByClassName("menu")[0];
var firsttd = menu.getElementsByClassName("firsttd")[0];
- firsttd.innerHTML = newDir;
+ firsttd.innerHTML = addDirectoryLinks(newDir);
}
function download(filename) {