diff --git a/assets/multi.js b/assets/multi.js index 68ed51c..71330d4 100644 --- a/assets/multi.js +++ b/assets/multi.js @@ -27,9 +27,9 @@ let setSelected = (files) => { const hasDirectory = files.reduce((a, f) => a || f.type == "directory", false); const totalSize = files.map(f => f.size).reduce((a, b) => a + b); if (hasDirectory) { - $(".multi-files-total").text("Unknown"); + $(".multi-files-total").val(""); } else { - $(".multi-files-total").text(filesize(totalSize)); + $(".multi-files-total").val(filesize(totalSize)); } }; diff --git a/index.js b/index.js index 248228f..570b1e4 100755 --- a/index.js +++ b/index.js @@ -490,6 +490,16 @@ if (shellable || cmdable) { }); } +const EXT_IMAGES = [".jpg", ".jpeg", ".png", ".webp", ".svg", ".gif", ".tiff"]; +function isimage(f) { + for (const ext of EXT_IMAGES) { + if (f.endsWith(ext)) { + return true; + } + } + return false; +} + app.get("/*", (req, res) => { if (res.stats.error) { res.render("list", flashify(req, { @@ -525,6 +535,7 @@ app.get("/*", (req, res) => { resolve({ name: f, isdirectory: stats.isDirectory(), + isimage: isimage(f), size: stats.size }); }); diff --git a/views/list.handlebars b/views/list.handlebars index 1971b18..5e848a7 100644 --- a/views/list.handlebars +++ b/views/list.handlebars @@ -1,41 +1,48 @@ {{> navbar path=path}}
-
- {{#each errors as |error|}} -
{{> toolbar shellable=shellable cmdable=cmdable}} diff --git a/views/partials/dialogue-delete.handlebars b/views/partials/dialogue-delete.handlebars index 6e3c7a6..dd0f637 100644 --- a/views/partials/dialogue-delete.handlebars +++ b/views/partials/dialogue-delete.handlebars @@ -7,14 +7,14 @@ diff --git a/views/partials/dialogue-download.handlebars b/views/partials/dialogue-download.handlebars index 194241c..62fdd01 100644 --- a/views/partials/dialogue-download.handlebars +++ b/views/partials/dialogue-download.handlebars @@ -3,7 +3,7 @@