diff options
-rw-r--r-- | plugins/webbox/TODO | 2 | ||||
-rw-r--r-- | plugins/webbox/html/webbox.css | 2 | ||||
-rw-r--r-- | plugins/webbox/html/webbox.js | 26 | ||||
-rw-r--r-- | response.cpp | 4 |
4 files changed, 27 insertions, 7 deletions
diff --git a/plugins/webbox/TODO b/plugins/webbox/TODO index ffa32db..108b645 100644 --- a/plugins/webbox/TODO +++ b/plugins/webbox/TODO @@ -1,7 +1,7 @@ Prio 1 (for next version) ====== -generate download link for selected file +provide index for nested directories, also if requested via url gallery Info if not selected: all Copy function 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 + "')\">☐</td>"; + if (filename != "..") { + selector = "<td class=\"selector\" onclick=\"toggleSelection('" + filename + "')\">☐</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>"; } } diff --git a/response.cpp b/response.cpp index a6f55e2..706090e 100644 --- a/response.cpp +++ b/response.cpp @@ -37,6 +37,8 @@ public: { } + // GetTarget() == GetPluginPath() + GetRelativePath() + const Path& GetPath() const {return m_path;} std::string GetPluginName() const {return m_path.params.at("plugin");} // can throw std::out_of_range @@ -146,7 +148,7 @@ std::unordered_map<std::string, std::function<std::string(RequestContext&)>> Get {"rel_target", [](RequestContext& req_ctx) {return req_ctx.GetRelativePath();}}, - {"target", [](RequestContext& req_ctx) {return req_ctx.GetTarget();}}, + {"target", [](RequestContext& req_ctx) {return req_ctx.GetTarget();}}, // target == plugin_path / rel_target }; std::string GetRequestParam(const std::string& key, RequestContext& req_ctx) |