summaryrefslogtreecommitdiffhomepage
path: root/plugins/webbox/html/webbox.js
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/webbox/html/webbox.js')
-rw-r--r--plugins/webbox/html/webbox.js26
1 files changed, 21 insertions, 5 deletions
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>";
}
}