Browse Source

Optimized compatibility mode css

Toby Chui 2 years ago
parent
commit
ed02f10a58

+ 4 - 3
mod/fileservers/servers/dirserv/dirserv.go

@@ -156,6 +156,9 @@ func (m *Manager) ServerWebFileRequest(w http.ResponseWriter, r *http.Request) {
 				html += getItemHTML(entry.Name(), arozfs.ToSlash(filepath.Join(r.RequestURI, entry.Name())), entry.IsDir(), finfo.ModTime().Format("2006-01-02 15:04:05"), byteCountIEC(finfo.Size()))
 			}
 
+			html += getPageFooter()
+			w.Write([]byte(html))
+
 		} else {
 			//Serve the file
 			f, err := fshAbs.ReadStream(rpath)
@@ -168,8 +171,6 @@ func (m *Manager) ServerWebFileRequest(w http.ResponseWriter, r *http.Request) {
 
 			io.Copy(w, f)
 		}
-
 	}
-	html += getPageFooter()
-	w.Write([]byte(html))
+
 }

+ 9 - 6
mod/fileservers/servers/dirserv/template.go

@@ -13,7 +13,7 @@ func getPageHeader(pathname string) string {
 	return `<!DOCTYPE HTML>
 	<html>
 		<head>
-			<meta name="viewport" content="width=device-width, initial-scale=1" />
+			<meta name="viewport" content="width=device-width, initial-scale=0.8" />
 			<title>Index of ` + pathname + `</title>
 			<style>
 				body{
@@ -30,6 +30,9 @@ func getPageHeader(pathname string) string {
 				td{
 					padding-left: 8px;
 					border-left: 1px solid #dbdbdb;
+					word-wrap: break-word;
+					overflow-wrap: break-word;
+					max-width: 25vw;
 				}
 
 				td.fx{
@@ -57,14 +60,14 @@ func getPageHeader(pathname string) string {
 }
 
 func getItemHTML(displayText string, link string, isDir bool, modTime string, size string) string {
-	icon := "🗋"
+	icon := "📄"
 	downloadBtn := ""
 	hidden := ""
 	if isDir {
-		icon = "🗀"
+		icon = "📁"
 		if strings.HasPrefix(displayText, ".") {
 			//Hidden folder
-			icon = "🖿"
+			icon = "📁"
 			hidden = "filter: alpha(opacity=50); opacity: 0.5;  zoom: 1;"
 		}
 
@@ -76,9 +79,9 @@ func getItemHTML(displayText string, link string, isDir bool, modTime string, si
 		} else if strings.HasPrefix(fileMime, "video/") {
 			icon = "🎞"
 		} else if strings.HasPrefix(fileMime, "image/") {
-			icon = "🖻"
+			icon = "🖼️"
 		} else if strings.HasPrefix(fileMime, "text/") {
-			icon = "🗎"
+			icon = "📝"
 		}
 		//fmt.Println(fileMime, filepath.Ext(displayText))