anonstream/anonstream/templates/nojs_chat_form.html

259 行
8.2 KiB
HTML

{##
# SPDX-FileCopyrightText: 2022 n9k [https://git.076.ne.jp/ninya9k]
# SPDX-License-Identifier: AGPL-3.0-or-later
##}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-security-policy" content="default-src 'none'; img-src 'self'; style-src 'nonce-{{ csp }}';">
<style nonce="{{ csp }}">
:root {
--link-color: #42a5d7;
--padding-size: 0.5rem;
}
html {
height: 100%;
}
body {
margin: 0;
height: 100%;
color: #ddd;
font-family: sans-serif;
}
a {
color: var(--link-color);
}
input:not([type]), input[type="password"] {
min-width: 20ch;
}
.pseudolink {
color: var(--link-color);
cursor: pointer;
}
.pseudolink:hover {
text-decoration: underline;
}
.tripcode {
padding: 0 5px;
border-radius: 7px;
font-family: monospace;
font-size: 9pt;
cursor: default;
}
.tripcode:not(#tripcode) {
padding: 0;
}
#tripcode {
background-color: {{ user.tripcode.background_color }};
color: {{ user.tripcode.foreground_color }};
cursor: pointer;
}
.x {
font-size: 14pt;
}
#notice {
display: grid;
padding: 0 var(--padding-size);
text-align: center;
color: white;
text-decoration: none;
height: 100%;
box-sizing: border-box;
align-items: center;
cursor: pointer;
}
#notice h2 {
margin: 0;
font-size: 18pt;
line-height: 1.25;
}
#notice.verbose h2 {
font-size: 14pt;
}
#chat-form, #appearance-form {
padding: 0 var(--padding-size) var(--padding-size) var(--padding-size);
height: 100%;
box-sizing: border-box;
grid-gap: 0.375rem;
}
#chat-form__exit,
#appearance-form__buttons__exit,
#appearance-form__label-name,
#appearance-form__label-password {
font-size: 11pt;
align-self: center;
}
#chat-form {
display: grid;
grid: auto 2rem / auto min-content min-content 5rem;
}
#chat-form__comment {
resize: none;
grid-column: 1 / span 4;
background-color: #434347;
border-radius: 4px;
border: 2px solid transparent;
transition: 0.25s;
padding: 0.675rem;
color: #c3c3c7;
}
#chat-form__comment:not(:focus):hover {
border-color: #737377;
}
#chat-form__comment:focus {
background-color: black;
border-color: #3584e4;
}
#chat-form__exit,
#chat-form__captcha-image,
#chat-form__captcha-answer {
grid-row: 2;
}
#chat-form__captcha-image {
align-self: center;
font-size: 8pt;
color: inherit;
}
#chat-form__captcha-answer {
min-width: auto;
width: 8ch;
}
#chat-form__submit {
grid-column: 4;
}
#appearance-form {
display: grid;
grid-auto-rows: 1fr 1fr 2rem;
grid-auto-columns: min-content 1fr min-content;
}
#appearance-form__buttons {
grid-column: 1 / span 3;
display: grid;
grid-template-columns: auto 5rem;
}
#password-column {
display: grid;
grid-template-columns: auto auto 1fr;
grid-gap: 0.375rem;
align-items: center;
}
#appearance-form label:not(.tripcode):not(.x) {
font-size: 11pt;
}
#hide-password {
align-self: center;
}
#password-toggle,
#appearance-form__password {
display: none;
}
#hide-password {
visibility: hidden;
}
#password-toggle:checked + #cleared-toggle:not(:checked) ~ #appearance-form__password {
display: inline;
}
#password-toggle:checked + #cleared-toggle:not(:checked) ~ #hide-password {
visibility: visible;
}
#password-toggle:checked + #cleared-toggle:not(:checked) + #password-column {
display: none;
}
#cleared-toggle,
#cleared,
#hide-cleared {
display: none;
}
#cleared-toggle:checked + #password-column > #cleared,
#cleared-toggle:checked + #password-column > #hide-cleared {
display: inline;
}
#cleared-toggle:checked + #password-column > #tripcode,
#cleared-toggle:checked + #password-column > #show-cleared {
display: none;
}
#toggle {
opacity: 0;
position: absolute;
pointer-events: none;
}
#chat-form__exit > label,
#appearance-form__buttons__exit > label {
padding: 1px;
}
#toggle:focus-visible ~ #chat-form > #chat-form__exit > label,
#toggle:focus-visible ~ #appearance-form #appearance-form__buttons__exit > label {
padding: 0;
border: 1px dotted;
}
#notice-radio {
display: none;
}
#toggle:checked ~ #chat-form,
#toggle:not(:checked) ~ #appearance-form {
display: none;
}
#notice-radio:checked + #notice,
#notice-radio:not(:checked) ~ #chat-form,
#notice-radio:not(:checked) ~ #appearance-form {
display: none;
}
</style>
</head>
<body>
<input id="toggle" type="checkbox" {% if not prefer_chat_form %}checked {% endif %}accesskey="x">
{% if state.notice %}
<input id="notice-radio" type="radio" accesskey="z">
<label id="notice" for="notice-radio"{% if state.verbose %} class="verbose"{% endif %}>
<header><h2>{{ state.notice }}</h2></header>
<small>Click to dismiss</small>
</label>
{% endif %}
<form id="chat-form" action="{{ url_for('nojs_submit_message', token=user.token) }}" method="post">
<input type="hidden" name="nonce" value="{{ nonce }}">
<textarea id="chat-form__comment" name="comment" maxlength="512" {% if digest is none %}required {% endif %} placeholder="Send a message..." rows="1" tabindex="1" autofocus accesskey="m">{{ state.comment }}</textarea>
<input id="chat-form__submit" type="submit" value="Chat" tabindex="4" accesskey="p">
<div id="chat-form__exit"><label for="toggle" class="pseudolink">Settings</label></div>
{% if digest %}
<input type="hidden" name="captcha-digest" value="{{ digest }}">
<input id="chat-form__captcha-image" type="image" formaction="{{ url_for('nojs_chat_form_redirect', token=user.token) }}" formnovalidate src="{{ url_for('captcha', token=user.token, digest=digest) }}" width="72" height="30" alt="Captcha failed to load" title="Click for a new captcha" tabindex="2">
<input id="chat-form__captcha-answer" name="captcha-answer" required placeholder="Captcha" tabindex="3">
{% endif %}
</form>
<form id="appearance-form" action="{{ url_for('nojs_submit_appearance', token=user.token) }}" method="post">
<label id="appearance-form__label-name" for="appearance-form__name">Name:</label>
<input id="appearance-form__name" name="name" value="{{ user.name or '' }}" placeholder="{{ default_name }}" maxlength="24">
<input type="color" name="color" value="{{ user.color }}">
<label id="appearance-form__label-password" for="appearance-form__password">Tripcode:</label>
<input id="password-toggle" name="set-tripcode" type="checkbox" accesskey="s">
<input id="cleared-toggle" name="clear-tripcode" type="checkbox"{% if user.tripcode != none %} accesskey="c"{% endif %}>
<div id="password-column">
{% if user.tripcode is none %}
<span class="tripcode">(no tripcode)</span>
<label for="password-toggle" class="show-password pseudolink">set</label>
{% else %}
<label id="tripcode" for="password-toggle" class="show-password tripcode">{{ user.tripcode.digest }}</label>
<label id="show-cleared" for="cleared-toggle" class="pseudolink x">&cross;</label>
<div id="cleared" class="tripcode">(cleared)</div>
<label id="hide-cleared" for="cleared-toggle" class="pseudolink">undo</label>
{% endif %}
</div>
<input id="appearance-form__password" name="password" type="password" placeholder="(tripcode password)" maxlength="1024">
<div id="hide-password"><label for="password-toggle" class="pseudolink x">&cross;</label></div>
<div id="appearance-form__buttons">
<div id="appearance-form__buttons__exit"><label for="toggle" class="pseudolink">Return to chat</label></div>
<input type="submit" value="Update">
</div>
</form>
</body>
</html>