From 0a4b9218017db3d058f5e215f855bc3f97bd161b Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Tue, 12 May 2020 19:18:16 +0200 Subject: Add links to partial pathes in directory line --- plugins/webbox/TODO | 1 - plugins/webbox/html/webbox.css | 4 ++++ plugins/webbox/html/webbox.js | 23 +++++++++++++++++++++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/plugins/webbox/TODO b/plugins/webbox/TODO index bbca6d3..2ce1274 100644 --- a/plugins/webbox/TODO +++ b/plugins/webbox/TODO @@ -7,7 +7,6 @@ gallery Prio 2 (for future versions) ====== -links in path line, to dirs google pagespeed insights https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Fwww.kneipenband.com%2Fwebbox%2F&tab=mobile chromecast player diff --git a/plugins/webbox/html/webbox.css b/plugins/webbox/html/webbox.css index 6ea5147..dbb151c 100644 --- a/plugins/webbox/html/webbox.css +++ b/plugins/webbox/html/webbox.css @@ -110,6 +110,10 @@ table.menudialog { overflow-y: scroll; } +span.link { + cursor: pointer; +} + table.menudialog td.entry { cursor: pointer; border-width: 0; 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 = ""; - name_td = "
" + filename + "
"; + name_td = "
" + filename + "
"; } else if (type == "dir") { type = ""; name_td = "" + filename + ""; @@ -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 += "" + path.substr(oldpos, pos - oldpos) + ""; + } + + 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) { -- cgit v1.2.3