From: Paul Hänsch Date: Wed, 6 Jan 2021 22:12:50 +0000 (+0100) Subject: force nick menu to be open, when no other options available X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=fbeb46144ca938828cd1df9710cb5893483ec1f5;p=httpchat force nick menu to be open, when no other options available --- diff --git a/index.cgi b/index.cgi index ac9a110..a1b6a08 100755 --- a/index.cgi +++ b/index.cgi @@ -37,6 +37,7 @@ yield_page(){ } settings_menu(){ + local nick="$(HTML "${nickname#\?}")" printf ' [form #settings method="POST" action="?settings" [hidden "session_key" "%s"] @@ -46,17 +47,22 @@ settings_menu(){ printf '[p .error %s %s]' "${ERROR%% *}" "$(HTML "${ERROR#.* }")" unset ERROR fi - printf ' + if [ "$NICK_REGISTRATION" != on -o "$nickname" = '?Guest' ]; then + printf ' + [a .section href="#nick" Nickname] + [div #nick .open [input name="nickname" placeholder="%s"][submit "action" "nick" Set Cookie]] + ' "$nick" + else + printf ' [a .section href="#nick" Nickname] [div #nick [input name="nickname" placeholder="%s"][submit "action" "nick" Set Cookie]] - ' "$(HTML "${nickname#\?}")" - [ "$NICK_REGISTRATION" = on -a "$nickname" != '?Guest' ] && printf ' [a .section href="#register" Register Nickname] [div #register [p Registration will set a permanent Cookie in your Browser. Registration requires neither a password, nor an email address.] [input name="regnick" value="%s"][submit "action" "register" Register] - ]' "$(HTML "${nickname#\?}")" + ]' "$nick" "$nick" + fi printf ']' } diff --git a/webchat.css b/webchat.css index 1335fe6..f2b6931 100644 --- a/webchat.css +++ b/webchat.css @@ -78,7 +78,7 @@ button { } #settings .error.nick ~ a.section + #nick, #settings .error.register ~ a.section + #register, -#settings a.section + #nick, +#settings a.section + .open, #settings a.section + *:target { max-height: 20ex; padding: 1ex 1ex .5ex 1ex;