From a306c5f769d876adf1f93d350c8a523b2c3fe760 Mon Sep 17 00:00:00 2001 From: glowinthedark <48893368+glowinthedark@users.noreply.github.com> Date: Sat, 16 Sep 2023 03:05:45 +0200 Subject: fileserver: browse template SVG icons and UI tweaks (#5812) * fileserver browse.html UI tweaks: folder-symlink icon, search fileserver browse.html UI tweaks: folder-symlink icon, search - ui - add folder-symlink SVG icon - search: use `` instead of `text` - fix npe with `sizebar.style.width` = null in grid mode * tabify whitespace Co-authored-by: Francis Lavoie --------- Co-authored-by: Francis Lavoie --- modules/caddyhttp/fileserver/browse.html | 443 ++++++++++++++++--------------- 1 file changed, 227 insertions(+), 216 deletions(-) (limited to 'modules/caddyhttp/fileserver/browse.html') diff --git a/modules/caddyhttp/fileserver/browse.html b/modules/caddyhttp/fileserver/browse.html index 0b558ce..88036d0 100644 --- a/modules/caddyhttp/fileserver/browse.html +++ b/modules/caddyhttp/fileserver/browse.html @@ -1,288 +1,296 @@ {{- define "icon"}} {{- if .IsDir}} - - - - + {{- if .IsSymlink}} + + + + + + {{- else}} + + + + + {{- end}} {{- else if or (eq .Name "LICENSE") (eq .Name "README")}} - - - - + + + + {{- else if .HasExt ".jpg" ".jpeg" ".png" ".gif" ".webp" ".tiff" ".bmp" ".heif" ".heic" ".svg"}} {{- if eq .Tpl.Layout "grid"}} {{- else}} - - - - - + + + + + {{- end}} {{- else if .HasExt ".mp4" ".mov" ".mpeg" ".mpg" ".avi" ".ogg" ".webm" ".mkv" ".vob" ".gifv" ".3gp"}} - - - - - - - - - + + + + + + + + + {{- else if .HasExt ".mp3" ".m4a" ".aac" ".ogg" ".flac" ".wav" ".wma" ".midi" ".cda"}} - - - - - + + + + + {{- else if .HasExt ".pdf"}} - - - - - - - + + + + + + + {{- else if .HasExt ".csv" ".tsv"}} - - - - - - + + + + + + {{- else if .HasExt ".txt" ".doc" ".docx" ".odt" ".fodt" ".rtf"}} - - - - - - + + + + + + {{- else if .HasExt ".xls" ".xlsx" ".ods" ".fods"}} - - - - - - + + + + + + {{- else if .HasExt ".ppt" ".pptx" ".odp" ".fodp"}} - - - - - - - - + + + + + + + + {{- else if .HasExt ".zip" ".gz" ".xz" ".tar" ".7z" ".rar" ".xz" ".zst"}} - - - - - - - - - + + + + + + + + + {{- else if .HasExt ".deb" ".dpkg"}} - - - + + + {{- else if .HasExt ".rpm" ".exe" ".flatpak" ".appimage" ".jar" ".msi" ".apk"}} - - - - - - + + + + + + {{- else if .HasExt ".ps1"}} - - - - + + + + {{- else if .HasExt ".py" ".pyc" ".pyo"}} - - - - - - + + + + + + {{- else if .HasExt ".bash" ".sh" ".com" ".bat" ".dll" ".so"}} - - + + {{- else if .HasExt ".dmg"}} - - - - - - + + + + + + {{- else if .HasExt ".iso" ".img"}} - - - - - + + + + + {{- else if .HasExt ".md" ".mdown" ".markdown"}} - - - - + + + + {{- else if .HasExt ".ttf" ".otf" ".woff" ".woff2" ".eof"}} - - - - - - + + + + + + {{- else if .HasExt ".go"}} - - - - - - + + + + + + {{- else if .HasExt ".html" ".htm"}} - - - - - - - - - - + + + + + + + + + + {{- else if .HasExt ".js"}} - - - - - + + + + + {{- else if .HasExt ".css"}} - - - - - - + + + + + + {{- else if .HasExt ".json" ".json5" ".jsonc"}} - - - - - + + + + + {{- else if .HasExt ".ts"}} - - - - - - - + + + + + + + {{- else if .HasExt ".sql"}} - - - - - - - - + + + + + + + + {{- else if .HasExt ".db" ".sqlite" ".bak" ".mdb"}} - - - - + + + + {{- else if .HasExt ".eml" ".email" ".mailbox" ".mbox" ".msg"}} - - - + + + {{- else if .HasExt ".crt" ".pem" ".x509" ".cer" ".ca-bundle"}} - - - - - - - + + + + + + + {{- else if .HasExt ".key" ".keystore" ".jks" ".p12" ".pfx" ".pub"}} - - - + + + {{- else}} {{- if .IsSymlink}} - - - - - + + + + + {{- else}} - - - + + + {{- end}} {{- end}} @@ -789,19 +797,19 @@ footer { - - - + + + List - - - - - + + + + + Grid @@ -826,22 +834,22 @@ footer { {{- if and (eq .Sort "namedirfirst") (ne .Order "desc")}} - - + + {{- else if and (eq .Sort "namedirfirst") (ne .Order "asc")}} - - + + {{- else}} - - + + {{- end}} @@ -850,16 +858,16 @@ footer { Name - - + + {{- else if and (eq .Sort "name") (ne .Order "asc")}} Name - - + + {{- else}} @@ -870,11 +878,11 @@ footer {
- - - + + + - +
@@ -882,16 +890,16 @@ footer { Size - - + + {{- else if and (eq .Sort "size") (ne .Order "asc")}} Size - - + + {{- else}} @@ -905,16 +913,16 @@ footer { Modified - - + + {{- else if and (eq .Sort "time") (ne .Order "asc")}} Modified - - + + {{- else}} @@ -933,8 +941,8 @@ footer { - - + + Up @@ -1075,7 +1083,10 @@ footer { }); document.querySelectorAll('.size').forEach(el => { const size = Number(el.dataset.size); - el.querySelector('.sizebar-bar').style.width = `${size/largest * 100}%`; + const sizebar = el.querySelector('.sizebar-bar'); + if (sizebar) { + sizebar.style.width = `${size/largest * 100}%`; + } }); } -- cgit v1.2.3