From 5feb36c907d3a475363a573fcc52d7219e623bdf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Sun, 7 Mar 2021 00:01:29 +0100 Subject: [PATCH] style rewrite --- index.cgi | 34 ++-- list.sh | 2 +- style.css | 538 +++++++++++++++++++---------------------------------- view.sh | 2 +- widgets.sh | 27 ++- 5 files changed, 229 insertions(+), 374 deletions(-) diff --git a/index.cgi b/index.cgi index d16e874..1b84d2f 100755 --- a/index.cgi +++ b/index.cgi @@ -90,22 +90,26 @@ case $ACTION in fi;; esac -case $PATH_INFO in - /style.css) - . "$_EXEC/cgilite/file.sh" - [ -r "$_DATA/$PATH_INFO" ] \ - && FILE "$_DATA/$PATH_INFO" \ - || FILE "$_EXEC/style.css" - return 0 - ;; - /stereoview.js) - . "$_EXEC/cgilite/file.sh" - FILE "$_EXEC/stereoview.js" - return 0 - ;; -esac +# case $PATH_INFO in +# /style.css) +# . "$_EXEC/cgilite/file.sh" +# [ -r "$_DATA/$PATH_INFO" ] \ +# && FILE "$_DATA/$PATH_INFO" \ +# || FILE "$_EXEC/style.css" +# return 0 +# ;; +# /stereoview.js) +# . "$_EXEC/cgilite/file.sh" +# FILE "$_EXEC/stereoview.js" +# return 0 +# ;; +# esac -if [ -f "$_DATA/$PATH_INFO" ]; then +if [ -f "$_EXEC/$PATH_INFO" ]; then + . "$_EXEC/cgilite/file.sh" + FILE "$_EXEC/$PATH_INFO" + return 0 +elif [ -f "$_DATA/$PATH_INFO" ]; then . "$_EXEC/view.sh" return 0 elif [ -d "$_DATA/$PATH_INFO" ]; then diff --git a/list.sh b/list.sh index 1ae43f1..6c09a43 100644 --- a/list.sh +++ b/list.sh @@ -207,13 +207,13 @@ printf 'Content-Type: text/html;charset=utf-8\r\n\r\n' printf ' by %s]' "$ORDER" printf ' [meta name="viewport" content="width=device-width"] + [link rel=stylesheet href="/cgilite/common.css" ] [link rel=stylesheet href="/style.css" ] ] [body [div #navigation [a #t_bookmarks href="#bookmarks" ★]' w_search printf ' - [a #t_avsearch href="#advsearch" Advanced] [a #t_prefs href="#prefs" ⚙] ]' w_bookmarks diff --git a/style.css b/style.css index 2e461e1..ce9813a 100644 --- a/style.css +++ b/style.css @@ -1,424 +1,268 @@ -* { - box-sizing: border-box; - margin: 0; padding: 0; - text-align: left; -} -button { padding: .125em .5em; } -a { color: inherit; text-decoration: none;} - -input { - border: 1px solid; - padding: .25em .5em; - line-height: 1em; - vertical-align: bottom; -} -input[type=number] { padding-right: 0; } -input[type=radio], input[type=checkbox] { vertical-align: baseline; } -select { - border: 1px solid; - padding: .125em .5em; -} -select[multiple] { padding: 0; } -select[multiple] option { padding: .25em .5em; } - body { - color: white; - background-color: black; - min-height: 100%; + color: #EEE; + background-color: #000; + padding-bottom: 2.5em; } +/* ====== TOP CONTROL BAR ====== */ -/* ### Main Page Elements ### */ - -#navigation{ - position: relative; +#navigation { text-align: center; - border-bottom: 1px solid; + margin-bottom: 1em; padding: 0 2em; background-color: #333; + box-shadow: .125em .125em .25em #000; } +#navigation > a { + position: absolute; bottom: .25em; + padding: 0 .125em; + font-size: 1.5em; + text-decoration: none; +} +#navigation > a[href="#bookmarks"] { left: 0; } +#navigation > a[href="#prefs"] { right: 0; } -#editing, -#multitag { +#bookmarks, #advsearch, #prefs, #multitag { + -display: none; + height: 0; + overflow: hidden; +} + +#editing { position: fixed; bottom: 0; width: 100%; - padding: .25em 0; - border-top: 1px solid; + padding: 0 .5em; background-color: #333; } -#search { display: inline; } - -a[href="#prefs"], -a[href="#bookmarks"] { +:target a[href="#"] { position: absolute; - top: 0; - margin: 0 .25em; + top: 0; right: 0; font-size: 1.5em; -} -a[href="#prefs"] { right: 0; } -a[href="#bookmarks"] { left: 0; } - -a[href="#advsearch"] { margin-left: .5em; } -a[href="#advsearch"]:before { - content: '\25b8'; - margin: 0 .5em; + font-weight: bold; + text-decoration: none; + padding: 0 .25em; + z-index: 1; } +/* ====== MAIN LIST VIEW ====== */ -/* ### Expandable Drawers ### */ +.itemlist { text-align: center; } +.itemlist > * { text-align: left; } +.itemlist .list { + display: inline-block; + vertical-align: top; + width: 99%; + -padding: 0 .25em; + margin: 0 .5%; + margin-bottom: 1em; +} +@media(min-width: 20em) { .itemlist .list { max-width: 49%; } } +@media(min-width: 40em) { .itemlist .list { max-width: 32%; } } +@media(min-width: 60em) { .itemlist .list { max-width: 24%; } } +@media(min-width: 80em) { .itemlist .list { max-width: 19%; } } +@media(min-width: 100em) { .itemlist .list { max-width: 19em; } } -#prefs, #bookmarks, #multitag, #advsearch { - display: block; position: absolute; - max-height: 0; width: 100%; max-width: 100%; - margin-top: -1px; - padding: 0 1em; - border: 1px none; - overflow: hidden; - background-color: #333; - transition: max-height .3s linear; - z-index: 1; +.itemlist .list img { + width: 100%; height: 11em; + background-color: #111; + object-fit: contain; } -#bookmarks { - left: 0; width: 30%; - min-width: 300px; - margin-right: auto; +.itemlist .list label { + display: block; + font-weight: bolder; + word-break: break-word; } -#prefs { - right: 0; width: 20%; - min-width: 200px; - margin-left: auto; +.itemlist .list .time, +.itemlist .list .dim { + position: absolute; top: 9.75em; + background-color: rgba(0,0,0,.5); + padding: .125em .25em; } -#advsearch { - text-align: center; +.itemlist .list .time { right: 0; } +.itemlist .list .dim { left: 0; } +.itemlist .list input[type=checkbox] { display: none; } +.itemlist .list .tag, +.itemlist .list input[type=checkbox] + label { + display: inline-block; + background-color: #333; + margin-top: .125em; + margin-left: 0; + padding: 0 .25em; + border-radius: 1pt; } - -#advsearch:target, #multitag:target, -#prefs:target, #bookmarks:target { - max-height: 25em; overflow-y: scroll; -} -#advsearch:target { border-style: none none solid none; } -#prefs:target { border-style: none none solid solid; } -#bookmarks:target { border-style: none solid solid none; } -#multitag:target { border-style: solid none none none; } - -#advsearch a[href="#"], -#multitag a[href="#"], -#bookmarks a[href="#"], -#prefs a[href="#"] { - display: block; - line-height: 2em; - font-weight: bold; - background-color: inherit; +.itemlist .list input[type=checkbox]:checked + label { + background-color: #383; } --#prefs a[href="#"] { width: 2.5em; left: auto; } --#bookmarks a[href="#"] { width: 2.5em; right: auto; } -#advsearch a[href="#"] { border-bottom: 1px solid; } -/* ### Preferences Drawer ### */ +/* ====== PAGINATION LIST ====== */ -#prefs label[for=prefs_ps] { - font-weight: bold; -} -#prefs #prefs_ps { - max-width: 4em; - margin-bottom: 1em; -} -#prefs button { - margin: 1em 0; +.pagination { + display: block; + font-size: 1.25em; + max-width: 98%; + margin: 0 auto; + padding: .25em 0; + background-color: #333; + border-radius: 2pt; } -#prefs input { vertical-align: top; } -#prefs input[type=radio] + label, -#prefs input[type=checkbox] + label { +.pagination a { display: inline-block; - margin-bottom: .5em; - max-width: 85%; + padding: 0 .5em; + margin: 0 .5em; + border-radius: 2pt; +} +.pagination a.current { + background-color: #BBB; } +/* ====== BOOKMARK PANEL ====== */ -/* ### Bookmarks Drawer ### */ - -#bookmarks input, -#bookmarks button { - margin-bottom: 1.25em; +#bookmarks:target, +#prefs:target { + display: block; position: fixed; + top: 50%; left: 50%; + transform: translate( -50%, -50% ); + width: 40em; max-width: 90%; + height: 30em; max-height: 90vh; + background-color: #333; + padding: 0 .5em; + z-index: 1; + box-shadow: .25em .25em .5em #000; + overflow-y: auto; } + #bookmarks label { display: block; font-weight: bold; + font-size: 1.125em; + margin-left: 0; + margin-top: .75em; word-break: break-word; - overflow: hidden; -} -#bookmarks a.link { - display: inline-block; - font-size: .75em; - text-decoration: underline; - margin: 0 1em 1.25em 0; } +/* ====== ADVSEARCH PANEL ====== */ -/* ### Advance Search Drawer ###*/ +#advsearch:target { + display: block; position: fixed; + top: 0; width: 100%; + height: 30em; max-height: 90vh; + background-color: #333; + padding: 0 .5em; + z-index: 1; + box-shadow: .25em .25em .5em #000; + overflow-y: auto; +} + +-#advsearch { text-align: center; } +-#advsearch > * { text-align: left; } #advsearch .help { - display: block; - margin: 1em .5em 1em .5em; - padding: .5em 1em; + width: 95%; + margin: 1em auto; padding: 0 .5em; background-color: #444; - line-height: 1.5em; + white-space: pre-line; } -#advsearch input.and {display: none;} -#advsearch input.and + label {display: none} -#advsearch input.and + label + .select { - display: inline-block; - position: relative; - width: 100%; min-width: 0; max-width: 0; - min-height: 12em; - overflow: hidden; - vertical-align: top; - border: none; - transition: max-width .3s linear; -} -#advsearch .submit { +#advsearch input.and + label { display: inline-block; - width: 100%; vertical-align: top; -} - -#advsearch input.and + label:nth-of-type(2), -#advsearch input.and:checked + label + .select + input + label { - display: inline-block; - vertical-align: top; - margin: 0 .5% 1em .5%; - width: 4%; min-width: 4em; - padding: .5em 0; - text-align: center; font-weight: bold; - border: 1px solid; } - -#advsearch input.and:checked + label + .select + input:checked + label, -#advsearch input.and:checked + label:nth-of-type(2), -#advsearch input.and:checked + label { display: none; } - -#advsearch input.and + label + .select:first-of-type, -#advsearch input.and:checked + label + .select { - min-width: 200px; max-width: 100%; - margin: 0 .5% 1em .5%; - border: 1px solid; -} - -@media (min-width: 460px){ -#advsearch .submit, -#advsearch input.and + label + .select:first-of-type, -#advsearch input.and:checked + label + .select { - width: 49%; -} } -@media (min-width: 660px){ -#advsearch .submit, -#advsearch input.and + label + .select:first-of-type, -#advsearch input.and:checked + label + .select { - width: 32%; -} } -@media (min-width: 860px){ -#advsearch .submit, -#advsearch input.and + label + .select:first-of-type, -#advsearch input.and:checked + label + .select { - width: 24%; -} } -@media (min-width: 1060px){ -#advsearch .submit, -#advsearch input.and + label + .select:first-of-type, -#advsearch input.and:checked + label + .select { - width: 19%; -} } - -#advsearch .submit { min-height: 0; } -#advsearch .submit * { width: 50%; } - -#advsearch .select input.pol { - margin: .5em .25em 0 .5em; -} -#advsearch .select input.pol + label { - font-weight: bold; -} -#advsearch .select label.head { - display: block; - font-weight: bold; - padding: .5em 0 0 .5em; - border-bottom: 1px solid; -} - -#advsearch .select select {display: none;} -#advsearch .select input.cat { display: none; } -#advsearch .select input.cat + label { +#advsearch fieldset.select { + display: inline-block; + width: 18em; max-width: 100%; + margin: 0 .5em; padding: 0 .375em; + box-shadow: .125em .125em .25em #000; +} +#advsearch fieldset.select > label.head { + display: none; + width: 40%; + text-align: right; +} +#advsearch fieldset.select > input.cat { display: none; } +#advsearch fieldset.select > input.cat + label + .catselect { display: none; } +#advsearch fieldset.select > input.cat + label { display: block; - margin-right: 50%; - padding: .25em .5em; - font-size: 1.125em; - border-bottom: 1px solid; + width: 40%; + margin: 0; padding: 0 .5em; + text-align: right; } -#advsearch .select input.cat:checked + label { +#advsearch fieldset.select > input.cat:checked + label { background-color: #444; } +#advsearch fieldset.select > input.cat:checked + label + .catselect { + display: block; position: absolute; + top: 1.5em; bottom: 0; right: 0; + width: 60%; + padding: 0 .25em; background-color: #444; + overflow-y: auto; } -#advsearch .select input.cat:checked + label + select { +#advsearch fieldset.select > input.cat + label + .catselect > * { display: block; - position: absolute; - top: 3.5em; bottom: 0; - right: 0; left: 50%; - width: 50%; + white-space: pre; } +#advsearch input.and { display: none; } +#advsearch input.and + label { display: none; } +#advsearch input.and + label + fieldset { display: none; } +#advsearch input.and:checked + label + fieldset { display: inline-block; } +#advsearch input.and:checked + label + fieldset + input + label { display: inline-block; } +#advsearch input.and:checked + label + fieldset + input:checked + label { display: none; } -/* ### Item Listing ### */ +/* ====== MULTITAG DIALOG ====== */ -.list { - position: relative; - display: inline-block; - width: 100%; - padding: .375em; - vertical-align: top; - overflow: hidden; -} - -.list.dir { padding: .5em 1em; } -.list:before { - position: absolute; - top: .25em; left: .25em; - bottom: .25em; right: .25em; - content: ''; - z-index: -2; -} -.list.dir:before { background-color: #CCF; color: black; } -.list.file:before { background-color: #333; } -.list.file:first-of-type { clear: left; } - -.list.file a img{ - display: block; - width: 100%; - min-height: 4em; - border-bottom: 1px solid black; -} -.list.file a + label{ - display: inline-block; - width: 100%; max-height: 2.5em; - margin-right: -10em; - padding: .25em .5em; - word-break: break-word; - background-color: #222; - overflow: hidden; +#multitag:target { + display: block; position: fixed; + bottom: 0; left: 0; width: 100%; + height: 30em; max-height: 90vh; + background-color: #333; + padding: 0 .5em; + z-index: 1; + box-shadow: .25em .25em .5em #000; + overflow-y: auto; } -.list.file .time, .list.file .dim { - float: right; position: relative; - display: inline-block; - top: -1.5em; bottom: 1.5; - margin-right: .125em; - padding: .125em .25em; - background-color: rgba(0,0,0,.75); -} +-#multitag { text-align: center; } +-#multitag > * { text-align: left; } -.list.file .tag, -.list.file input + label { +#multitag fieldset { display: inline-block; - margin: .125em -.125em 0 0; - padding: .125em .5em; - color: black; - background-color: #DCC; + width: 99%; + margin: 0 .5%; margin-top: 1em; } +@media(min-width: 20em) { #multitag fieldset { max-width: 49%; } } +@media(min-width: 40em) { #multitag fieldset { max-width: 32%; } } +@media(min-width: 60em) { #multitag fieldset { max-width: 24%; } } +@media(min-width: 80em) { #multitag fieldset { max-width: 19%; } } +@media(min-width: 100em) { #multitag fieldset { max-width: 19em; } } -.list.file input[type="checkbox"] { display: none; } -.list.file input[type="checkbox"] + label { - border: 1px solid; - background-color: #ECC; +#multitag fieldset select { + width: 100%; height: 10em; } -.list.file input[type="checkbox"]:checked + label { - background-color: #8F8; +#multitag fieldset .tagselect { + height: 10em; + background-color: #444; + overflow-y: auto; } - -.itemlist, -.pagination { +#multitag fieldset .tagselect > label { display: block; - text-align: center; - margin-top: 1em; + white-space: pre; } -.pagination { margin-bottom: 3em;} -.page { - display: inline-block; - margin: 0 .125em; - padding: .25em .5em; - color: #DAA; - background-color: #000; - border: 1px solid; -} -.page.current { - font-weight: bold; - color: black; - background-color: #FDD; - border-color: #DAA; -} - -#index label:first-of-type { font-weight: bold; } -#index input, #index button { margin-left: 1em;} -/* ### Video View ### */ +/* ====== VIEW PAGE ====== */ -body#view { padding-bottom: 6em; } - -#view h1 { - max-width: 100%; - margin: .5em .75em; - font-size: 1.25em; - font-weight: bold; - word-break: break-word; - text-decoration: none; -} - -#view #mainvideo { +body#view video { display: block; - width: 98%; - margin-left: auto; margin-right: auto; - max-height: 240px; -} -@media(min-height: 400px) { #view #mainvideo { max-height: 320px; } } -@media(min-height: 480px) { #view #mainvideo { max-height: 460px; } } -@media(min-height: 520px) { #view #mainvideo { max-height: 480px; } } -@media(min-height: 640px) { #view #mainvideo { max-height: 600px; } } -@media(min-height: 700px) { #view #mainvideo { max-height: 640px; } } -@media(min-height: 760px) { #view #mainvideo { max-height: 720px; } } -@media(min-height: 1000px){ #view #mainvideo { max-height: 960px; } } -@media(min-height: 1200px){ #view #mainvideo { max-height: 1080px;} } - -#view a[href$=download], -#view a[href^=javascript] { - margin-left: 1em; -} - -#view .time, #view .dim, -#view .tag { - margin-right: -.125em; - padding: .125em .25em; - color: black; + max-height: 80vh; + margin: 0 auto; } -#view .time, -#view .dim { background-color: #CCD; } -#view .tag { background-color: #DCC; } - - - -/* ### Multi Tagging Drawer ### */ -#multitag fieldset{ +body#view .tag { display: inline-block; - width: 100%; - vertical-align: top; + background-color: #333; + margin-top: .125em; + margin-left: 0; padding: 0 .25em; - border: none; + border-radius: 1pt; } - -@media (min-width: 520px) { .list, #multitag fieldset { width: 50%; min-width: 250px; } } -@media (min-width: 760px) { .list, #multitag fieldset { width: 33%; } } -@media (min-width: 1020px){ .list, #multitag fieldset { width: 25%; } } - -#multitag fieldset * { width: 100%; } -#multitag fieldset button { width: 50%; } diff --git a/view.sh b/view.sh index 3aa4d97..9bd507c 100644 --- a/view.sh +++ b/view.sh @@ -15,6 +15,7 @@ printf 'Content-Type: text/html;charset=utf-8\r\n\r\n' HTML "${ITEM##*/}" printf '] [meta name="viewport" content="width=device-width"] + [link rel=stylesheet href="/cgilite/common.css" ] [link rel=stylesheet href="/style.css" ] ] [body #view [script type="text/javascript" src="/stereoview.js"\n] @@ -22,7 +23,6 @@ printf 'Content-Type: text/html;charset=utf-8\r\n\r\n' [a #t_bookmarks href="#bookmarks" ★]' w_search printf ' - [a #t_avsearch href="#advsearch" Advanced] [a #t_prefs href="#prefs" ⚙] ]' w_bookmarks diff --git a/widgets.sh b/widgets.sh index fc6818e..cd9dda3 100644 --- a/widgets.sh +++ b/widgets.sh @@ -98,7 +98,7 @@ w_bookmarks(){ [a .link target=blank href="/?o=Date&s=%s&f=%s" by Date] [a .link target=blank href="/?o=Length&s=%s&f=%s" by Length] [a .link target=blank href="/?o=Group&s=%s&f=%s" by Group] - [br]' \ + ' \ "$(HTML "$name" |sed 's;,\;;&[wbr];g;')" \ "$search" "$filter" \ "$search" "$filter" \ @@ -119,6 +119,7 @@ w_search(){ [option value=Group %s Group] ] [input name=s placeholder=Search value="%s"] + [a #t_avsearch href="#advsearch" Advanced] ] ' \ "$w_coname" "$w_codate" "$w_colength" "$w_cogroup" \ @@ -167,8 +168,8 @@ w_advsearch(){ filter="$(HTML "${FILTER}^")" printf '[form #advsearch action=./?a=advsearch method=POST - [a href="#" Hide] - [p .help Select multiple tags from each category by holding down the [strong Ctrl] key on your keyboard.[br] + [a href="#" X] + [p .help Select multiple tags from each category by holding down the [strong Ctrl] key on your keyboard. Refine the search further by setting additional search tags using the [strong "+and"] button.]' for n in 1 2 3 4 5 6 7 8 9 10; do @@ -196,9 +197,12 @@ w_advsearch(){ [ "$category" != '*' -a ! "${f%%|${category}:*}" ] && t=checked [ "$category" != '*' -a ! "${f%%|-${category}:*}" ] && t=checked + # printf '[radio "cat_%i" "%s" .cat %s id="%s"][label for="%s" %s] + # [select name=tag_%s size=10 multiple' \ + # $n "$category" "$t" "$lbid" "$lbid" "$category" $n printf '[radio "cat_%i" "%s" .cat %s id="%s"][label for="%s" %s] - [select name=tag_%s size=10 multiple' \ - $n "$category" "$t" "$lbid" "$lbid" "$category" $n + [div .catselect\n' \ + $n "$category" "$t" "$lbid" "$lbid" "$category" printf '%s\n' "$w_tags" \ | { [ "$category" = '*' ] && grep -avF ':' || grep -awF "${category}"; } \ @@ -210,7 +214,8 @@ w_advsearch(){ [ "$tag" ] || continue t=''; [ ! "${f%%*|${tag}|*}" ] && t=checked d="${tag#-}"; d="${d#*:}" - printf '[option %s value="%s"\n%s]' "$t" "$tag" "$d" + # printf '[option %s value="%s"\n%s]' "$t" "$tag" "$d" + printf '[label [checkbox "tag_%s" "%s" %s] %s]' "$n" "$tag" "$t" "$d" done printf '\n]' done @@ -232,7 +237,7 @@ w_advsearch(){ w_delete(){ printf '[a href="#multitag" Add Tags / Remove Tags] [div #multitag [input type="hidden" name="ref" value="%s"] - [a href="#" Hide][br] + [a href="#" X] [fieldset [legend New:] [submit "op" "filedelete" Delete Files] ]]' "$w_refuri" @@ -242,12 +247,13 @@ w_tagging(){ local tag category d printf '[a href="#multitag" Add Tags / Remove Tags] [div #multitag [input type="hidden" name="ref" value="%s"]' "$w_refuri" - printf '[a href="#" Hide][br]' + printf '[a href="#" X]' printf 'Tags\n%s\n' "$w_tagcategories" \ | while read -r category; do [ "$category" ] || continue - printf '[fieldset [legend %s:][select name=tag size=4 multiple\n' "$category" + # printf '[fieldset [legend %s:][select name=tag size=4 multiple\n' "$category" + printf '[fieldset [legend %s:][div .tagselect\n' "$category" printf %s "$w_tags" \ | { [ "$category" = 'Tags' ] && grep -avF ':' || grep -awF "${category}"; } \ | { for n in 1 2 3 4 5 6 7 8 9 0; do @@ -257,7 +263,8 @@ w_tagging(){ } | while read -r tag; do [ "$tag" ] || continue d="${tag#-}"; d="${d#*:}" - printf '[option value="%s"\n%s]' "$tag" "$d" + # printf '[option value="%s"\n%s]' "$tag" "$d" + printf '[label [checkbox "tag" "%s"] %s]\n' "$tag" "$d" done printf ']]' done -- 2.39.2