From 7da359ddda244932d10f8a674cda425be01bd06c Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Mon, 31 Oct 2022 01:40:59 +0400 Subject: [PATCH] Added tabindex for tr elements. Filter is hidden by default. If JS is enabled, then it will be displayed. --- web/index.jade.go | 39 +++++++++++++++++++++++---------------- web/templates/index.jade | 11 ++++++----- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/web/index.jade.go b/web/index.jade.go index 8cc88f5..d8e8b78 100644 --- a/web/index.jade.go +++ b/web/index.jade.go @@ -9,6 +9,7 @@ import ( "html" "io" "net/http" + "strconv" ) const ( @@ -17,14 +18,16 @@ const ( index__2 = `

Files: ` index__3 = ` (` index__4 = `); Directories: ` - index__5 = `.

` - index__6 = `
NameDateSize
../
` - index__7 = `

In an overlay use a mouse wheel to change a scale of a video or a picture. Use left and right arrow keys to go through media. Use escape key to close an overlay, or click outside a media. An audio volume is being kept across site using LocalStorage API.

Privacy statements

I collect access logs that include access date and time, IP-address, User-Agent, referer URL that tells me where have you came from, request that you sent to me. In addition there are GeoIP information added based on your IP-address that includes country, region, and city for my convenience.

This site makes use of JavaScript purely for convenient functionality, like being able to watch video, listen to music, and look images in an overlay without the need to open a file in a new tab or return back.

` - index__8 = `` - index__10 = `` - index__11 = `` - index__12 = `` + index__5 = `.

` + index__7 = `
NameDateSize
../
` + index__8 = `

On a page use up and down arrow keys to navigate through list. Use home and end keys to go to the start and end of a list. Use Ctrl+Backspace to return to a parent directory.

In an overlay use a mouse wheel to change a scale of a video or a picture. Use left and right arrow keys to go through media. Use space key to toggle pause. Use escape key to close an overlay, or click outside a media. An audio volume is being kept across site using LocalStorage API.

Privacy statements

I collect access logs that include access date and time, IP-address, User-Agent, referer URL that tells me where have you came from, request that you sent to me. In addition there are GeoIP information added based on your IP-address that includes country, region, and city for my convenience.

This site makes use of JavaScript purely for convenient functionality, like being able to watch video, listen to music, and look images in an overlay without the need to open a file in a new tab or return back.

` + index__9 = `` + index__12 = `` + index__13 = `` + index__14 = `` ) func Index(mainSite, currentPath string, stats *files.DirStats, items *[]files.DirEntry, r *http.Request, wr io.Writer) { @@ -41,21 +44,25 @@ func Index(mainSite, currentPath string, stats *files.DirStats, items *[]files.D buffer.WriteString(index__4) buffer.WriteString(html.EscapeString(fmt.Sprintf("%v", stats.Directories))) buffer.WriteString(index__5) + buffer.WriteString(html.EscapeString(strconv.FormatInt(int64(0), 10))) + buffer.WriteString(index__6) - for _, item := range *items { - buffer.WriteString(index__8) - buffer.WriteString(html.EscapeString(fmt.Sprintf("%v", item.Link))) + for i, item := range *items { buffer.WriteString(index__9) - buffer.WriteString(html.EscapeString(fmt.Sprintf("%v", item.Name))) + buffer.WriteString(html.EscapeString(strconv.FormatInt(int64(i+1), 10))) buffer.WriteString(index__10) - buffer.WriteString(utils.ToClientTimezone(item.Datetime, r).Format(files.FileDateFormat)) + buffer.WriteString(html.EscapeString(fmt.Sprintf("%v", item.Link))) buffer.WriteString(index__11) - buffer.WriteString(html.EscapeString(fmt.Sprintf("%v", item.Size))) + buffer.WriteString(html.EscapeString(fmt.Sprintf("%v", item.Name))) buffer.WriteString(index__12) + buffer.WriteString(utils.ToClientTimezone(item.Datetime, r).Format(files.FileDateFormat)) + buffer.WriteString(index__13) + buffer.WriteString(html.EscapeString(fmt.Sprintf("%v", item.Size))) + buffer.WriteString(index__14) } - buffer.WriteString(index__6) - buffer.WriteString(currentPath) buffer.WriteString(index__7) + buffer.WriteString(currentPath) + buffer.WriteString(index__8) } diff --git a/web/templates/index.jade b/web/templates/index.jade index 0aafc3b..690b0ac 100644 --- a/web/templates/index.jade +++ b/web/templates/index.jade @@ -26,25 +26,26 @@ html(lang='en') section#files span!= currentPath p Files: #{stats.Files} (#{stats.FilesSize}); Directories: #{stats.Directories}. - input(type="text", name="filter" placeholder="Type in to filter (case insensitive)") + input.hidden(type="text", name="filter" placeholder="Type in to filter this directory (case insensitive)") table thead tr th Name th Date th Size - tr + tr(tabindex=0) td #[a(href="../") ../] tbody - each item in *items - tr + each item, i in *items + tr(tabindex=i+1) td #[a(href=item.Link) #{item.Name}] td!= utils.ToClientTimezone(item.Datetime, r).Format(files.FileDateFormat) td= item.Size section span!= currentPath section#usage - p In an overlay use a mouse wheel to change a scale of a video or a picture. Use left and right arrow keys to go through media. Use escape key to close an overlay, or click outside a media. An audio volume is being kept across site using LocalStorage API. + p On a page use up and down arrow keys to navigate through list. Use home and end keys to go to the start and end of a list. Use Ctrl+Backspace to return to a parent directory. + p In an overlay use a mouse wheel to change a scale of a video or a picture. Use left and right arrow keys to go through media. Use space key to toggle pause. Use escape key to close an overlay, or click outside a media. An audio volume is being kept across site using LocalStorage API. section#privacy h2 Privacy statements p I collect access logs that include access date and time, IP-address, User-Agent, referer URL that tells me where have you came from, request that you sent to me. In addition there are GeoIP information added based on your IP-address that includes country, region, and city for my convenience.