diff --git a/gossa.go b/gossa.go index 38a0a43..d700187 100755 --- a/gossa.go +++ b/gossa.go @@ -34,6 +34,7 @@ type pageTemplate struct { Title template.HTML ExtraPath template.HTML Ro bool + HelpMessage bool RowsFiles []rowTemplate RowsFolders []rowTemplate } @@ -45,6 +46,7 @@ var symlinks = flag.Bool("symlinks", false, "follow symlinks \033[4mWARNING\033[ var verb = flag.Bool("verb", false, "verbosity") var skipHidden = flag.Bool("k", true, "\nskip hidden files") var ro = flag.Bool("ro", false, "read only mode (no upload, rename, move, etc...)") +var helpMessage = flag.Bool("m", true, "display small text showing how to open help menu") type rpcCall struct { Call string `json:"call"` @@ -98,6 +100,7 @@ func replyList(w http.ResponseWriter, r *http.Request, fullPath string, path str } p.ExtraPath = template.HTML(html.EscapeString(*extraPath)) p.Ro = *ro + p.HelpMessage = *helpMessage p.Title = template.HTML(html.EscapeString(title)) for _, el := range _files { @@ -281,7 +284,7 @@ func main() { handler = http.StripPrefix(*extraPath, http.FileServer(http.Dir(rootPath))) fmt.Printf("Gossa starting on directory %s\n", rootPath) - fmt.Printf("Verbose: %t, Symlinks: %t, Read-Only: %t, Hidden-Files Skipped: %t\n", *verb, *symlinks, *ro, *skipHidden) + fmt.Printf("Verbose: %t, Symlinks: %t, Read-Only: %t, Hidden-Files Skipped: %t, Display Help Message: %t\n", *verb, *symlinks, *ro, *skipHidden, *helpMessage) fmt.Printf("Listening on http://%s:%s%s\n", *host, *port, *extraPath) if err = server.ListenAndServe(); err != http.ErrServerClosed { check(err) diff --git a/ui/script.js b/ui/script.js index 52f3dd5..464b177 100755 --- a/ui/script.js +++ b/ui/script.js @@ -44,6 +44,9 @@ const flicker = w => w.classList.remove('runFade') || void w.offsetWidth || w.cl const encodeURIHash = e => encodeURI(e).replaceAll('#', '%23') +// Display help message +if (!window.helpMessage) document.getElementById("help_message").remove() + // Manual upload manualUpload.addEventListener('change', () => Array.from(manualUpload.files).forEach(f => isDupe(f.name) || postFile(f, '/' + f.name)), false) diff --git a/ui/style.css b/ui/style.css index cb85bfb..2d1dee8 100644 --- a/ui/style.css +++ b/ui/style.css @@ -388,12 +388,12 @@ h1 > span:hover { z-index: 101; } -.help_message { +#help_message { font-family: monospace; - font-size: 10px; - float: left; - position: absolute; + font-size: 12px; + position: fixed; bottom: 3px; + right: 12px; opacity: 50%; } diff --git a/ui/ui.tmpl b/ui/ui.tmpl index 05e50e6..c3cbbca 100644 --- a/ui/ui.tmpl +++ b/ui/ui.tmpl @@ -15,6 +15,7 @@ @@ -78,12 +79,12 @@ {{end}} +

Help: Ctrl/Cmd + h

-

Help: Ctrl/Cmd + h