全局美化 v5
This commit is contained in:
@@ -0,0 +1,887 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ja">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>吃什么</title>
|
||||
<meta name="msvalidate.01" content="2F185E8E63C93635F50B3574F3B31E42" />
|
||||
<meta name="description" content="狼の質問箱は登録不要で使える匿名質問箱。誰でも匿名で質問でき、安心してやり取りできる場所です。">
|
||||
<meta name="keywords" content="匿名質問箱,質問箱,匿名質問,狼の質問箱,匿名で質問,匿名Q&A">
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var m = document.cookie.match(/(?:^|;\s*)theme=([^;]*)/);
|
||||
if (m && m[1] === 'dark') document.documentElement.setAttribute('data-theme', 'dark');
|
||||
})();
|
||||
</script>
|
||||
|
||||
<link rel="preconnect" href="https://r2.337845818.best" crossorigin>
|
||||
<link rel="preconnect" href="https://cdnjs.snrat.com" crossorigin>
|
||||
|
||||
<link rel="stylesheet" href="https://cdnjs.snrat.com/ajax/libs/uikit/3.3.3/css/uikit.min.css"/>
|
||||
|
||||
<link rel="stylesheet" href="/static/css/base.css?v=20261019c"/>
|
||||
|
||||
<link rel="stylesheet" href="https://r2.337845818.best/tamabox/cdn/waline/client/v2/waline-no-commits.css" media="print" onload="this.media='all'"/>
|
||||
<script defer src="https://cdnjs.snrat.com/ajax/libs/uikit/3.3.3/js/uikit.min.js"></script>
|
||||
<script defer src="https://cdnjs.snrat.com/ajax/libs/uikit/3.3.3/js/uikit-icons.min.js"></script>
|
||||
|
||||
<script defer src="https://cdnjs.snrat.com/ajax/libs/dayjs/1.10.8/dayjs.min.js"></script>
|
||||
<script defer src="https://cdnjs.snrat.com/ajax/libs/alpinejs/3.9.0/cdn.min.js"></script>
|
||||
|
||||
|
||||
<script defer src="https://cdnjs.snrat.com/ajax/libs/waline/2.15.8/waline.js"></script>
|
||||
|
||||
|
||||
<style>
|
||||
.captcha-equation-box {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
background: #f0f2f5;
|
||||
border: 1px solid #dcdcdc;
|
||||
border-radius: 8px;
|
||||
padding: 8px 8px 8px 16px;
|
||||
gap: 6px;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
.captcha-equation-box:focus-within {
|
||||
border-color: #1e87f0;
|
||||
box-shadow: 0 0 0 3px rgba(30,135,240,0.12);
|
||||
}
|
||||
.math-captcha-modal-question {
|
||||
font-size: 1.4rem;
|
||||
font-family: "Courier New", monospace;
|
||||
font-weight: 700;
|
||||
color: #333;
|
||||
letter-spacing: 1px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
#captcha-modal-answer {
|
||||
width: 80px;
|
||||
padding: 6px 10px;
|
||||
text-align: center;
|
||||
font-size: 1.2rem;
|
||||
font-family: "Courier New", monospace;
|
||||
font-weight: 600;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
outline: none;
|
||||
transition: border-color 0.15s, box-shadow 0.15s;
|
||||
background: #fff;
|
||||
}
|
||||
#captcha-modal-answer:focus {
|
||||
border-color: #1e87f0;
|
||||
box-shadow: 0 0 0 2px rgba(30,135,240,0.2);
|
||||
}
|
||||
|
||||
#captcha-modal-answer::-webkit-inner-spin-button,
|
||||
#captcha-modal-answer::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
#captcha-modal-answer {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta property="og:site_name" content="狼の質問箱 | 匿名質問箱" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="狼の質問箱 | 匿名質問箱" />
|
||||
<meta property="og:url" content="https://box-dev-api.337845818.best/vote/t86urUZo26xE" />
|
||||
<meta property="og:description" content="狼の質問箱は登録不要で使える匿名質問箱。誰でも匿名で質問でき、安心してやり取りできる場所です。" />
|
||||
<meta name="robots" content="noindex">
|
||||
|
||||
<meta itemprop="image" content="https://r2.337845818.best/tamabox/tamabox_low.png"/>
|
||||
<meta name="msapplication-TileImage" content="https://r2.337845818.best/tamabox/tamabox_low.png"/>
|
||||
<link rel="shortcut icon" href="https://r2.337845818.best/tamabox/tamabox_low.png" />
|
||||
<link rel="apple-touch-icon" href="https://r2.337845818.best/tamabox/tamabox_low.png"/>
|
||||
<link rel="icon" sizes="192x192" href="https://r2.337845818.best/tamabox/tamabox_low.png">
|
||||
<meta name="twitter:image:src" content="https://r2.337845818.best/tamabox/tamabox_low.png" />
|
||||
|
||||
|
||||
|
||||
<meta name="google-site-verification" content="fEPwRRJfiGsgwc5SINBQwZhPK8F0cwRaOvRx0YRurI4" />
|
||||
|
||||
<script>
|
||||
window.addEventListener("load", function () {
|
||||
var s = document.createElement("script");
|
||||
s.src = "https://mami.shiroko.one/tamami.js";
|
||||
s.setAttribute("data-website-id", "c42ebe8b-9281-4da0-83a4-8f18b3e710fe");
|
||||
document.body.appendChild(s);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
window.tbRenderQR = function (el, getOptions) {
|
||||
if (!el || typeof QRCode === 'undefined') return;
|
||||
var opts = getOptions();
|
||||
function remoteOf(o, key) {
|
||||
var v = o[key];
|
||||
return (typeof v === 'string' && v.indexOf('http') === 0) ? v : '';
|
||||
}
|
||||
var good = window._tbQrGood || (window._tbQrGood = {});
|
||||
var bad = window._tbQrBad || (window._tbQrBad = {});
|
||||
|
||||
function layerState(url) { return !url ? '' : (good[url] ? 1 : (bad[url] ? 0 : null)); }
|
||||
var layers = [
|
||||
{ url: remoteOf(opts, 'logo'), st: null, present: function (o, on) {
|
||||
if (on) { } else { o.logo = undefined; o.logoWidth = undefined; o.logoHeight = undefined; o.logoBackgroundTransparent = undefined; }
|
||||
} },
|
||||
{ url: remoteOf(opts, 'backgroundImage'), st: null, present: function (o, on) {
|
||||
if (on) { } else { o.backgroundImage = undefined; o.backgroundImageAlpha = undefined; }
|
||||
} }
|
||||
];
|
||||
var needProbe = false;
|
||||
for (var i = 0; i < layers.length; i++) {
|
||||
layers[i].st = layerState(layers[i].url);
|
||||
if (layers[i].st === null) needProbe = true;
|
||||
}
|
||||
function paint(states) {
|
||||
var o = {};
|
||||
for (var k in opts) o[k] = opts[k];
|
||||
for (var j = 0; j < layers.length; j++) layers[j].present(o, states[j] === 1);
|
||||
el.innerHTML = '';
|
||||
new QRCode(el, o);
|
||||
}
|
||||
|
||||
var initStates = [];
|
||||
for (var n = 0; n < layers.length; n++) initStates.push(layers[n].st === 1 ? 1 : 0);
|
||||
paint(initStates);
|
||||
if (!needProbe) return;
|
||||
|
||||
var pending = 0, cross = opts.crossOrigin || 'anonymous';
|
||||
layers.forEach(function (L) {
|
||||
if (L.st !== null) return;
|
||||
pending++;
|
||||
var im = new Image();
|
||||
im.onload = function () { good[L.url] = true; L.st = 1; onDone(); };
|
||||
im.onerror = function () { bad[L.url] = true; L.st = 0; onDone(); };
|
||||
if (cross) im.crossOrigin = cross;
|
||||
im.src = L.url;
|
||||
});
|
||||
function onDone() {
|
||||
if (--pending > 0) return;
|
||||
var finalStates = [];
|
||||
for (var m = 0; m < layers.length; m++) finalStates.push(layers[m].st === 1 ? 1 : 0);
|
||||
var changed = false;
|
||||
for (var q = 0; q < finalStates.length; q++) if (finalStates[q] !== initStates[q]) changed = true;
|
||||
if (changed) paint(finalStates);
|
||||
}
|
||||
|
||||
setTimeout(function () { if (pending > 0) { pending = 0; onDone(); } }, 3000);
|
||||
};
|
||||
</script>
|
||||
<nav class="uk-navbar-container uk-margin tb-navbar" uk-navbar>
|
||||
<div class="uk-navbar-center">
|
||||
<div class="uk-navbar-center-left">
|
||||
<div>
|
||||
<ul class="uk-navbar-nav">
|
||||
|
||||
<li><a href="/explore">探索</a></li>
|
||||
|
||||
|
||||
<li class="tb-mobile-balancer" aria-hidden="true"><a tabindex="-1" style="visibility:hidden">マイ</a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a class="uk-navbar-item uk-logo" href="/"><span class="emoji-placeholder" aria-label="random animal">🐺</span>の質問箱</a>
|
||||
|
||||
<div class="uk-navbar-center-right">
|
||||
<div>
|
||||
|
||||
<ul class="uk-navbar-nav">
|
||||
<li><a href="/register">登録</a></li>
|
||||
</ul>
|
||||
<ul class="uk-navbar-nav">
|
||||
<li><a href="/login">ログイン</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<ul class="uk-navbar-nav tb-nav-utils">
|
||||
<li>
|
||||
<a href="#" aria-label="言語" title="言語"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="9"/><path d="M3.2 9h17.6M3.2 15h17.6"/><ellipse cx="12" cy="12" rx="4" ry="9"/></svg></a>
|
||||
<div class="uk-navbar-dropdown" uk-drop="mode: click; pos: bottom-right">
|
||||
<ul class="uk-nav uk-navbar-dropdown-nav">
|
||||
|
||||
<li class="">
|
||||
<a href="/i18n/zh-CN?to=%2Fvote%2Ft86urUZo26xE">简体中文</a>
|
||||
</li>
|
||||
|
||||
<li class="">
|
||||
<a href="/i18n/zh-TW?to=%2Fvote%2Ft86urUZo26xE">繁體中文</a>
|
||||
</li>
|
||||
|
||||
<li class="">
|
||||
<a href="/i18n/en?to=%2Fvote%2Ft86urUZo26xE">English</a>
|
||||
</li>
|
||||
|
||||
<li class="uk-active">
|
||||
<a href="/i18n/ja?to=%2Fvote%2Ft86urUZo26xE">日本語</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<ul class="uk-navbar-nav tb-nav-utils">
|
||||
<li>
|
||||
<a href="#" id="theme-toggle" title="ダーク/ライトモード切替" aria-label="ダーク/ライトモード切替">
|
||||
<span class="tb-icon-light"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M20.5 14.3A8.6 8.6 0 0 1 9.7 3.5a8.6 8.6 0 1 0 10.8 10.8z"/></svg></span><span class="tb-icon-dark"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="4"/><path d="M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.2 5.2l1.4 1.4M17.4 17.4l1.4 1.4M18.8 5.2l-1.4 1.4M6.6 17.4l-1.4 1.4"/></svg></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const emojis = ["🐺","🐗","🐻","🐨","🐼","🐹","🐭","🐰","🦊","🐮","🐷","🐽","🐸","🐒","🦍","🐔","🐧","🐦","🐤","🐦⬛","🦅","🦉","🦇","🐴","🦄","🐝","🦎","🦖","🦕","🐙","🦑","🦐","🦞","🦀","🐡","🐠","🐟","🐬","🐳","🐋","🦈","🐊","🐅","🐆","🦓","🦍","🦧","🐘","🦛","🦏","🐪","🐫","🦒","🦘","🐃","🐂","🐄","🐎","🐖","🐏","🐑","🦙","🐐","🦌","🐕","🐩","🦮","🐕🦺","🐈","🐋","🐳","🐬","🐉","🐲"];
|
||||
const placeholder = document.querySelector('.emoji-placeholder');
|
||||
if (placeholder) {
|
||||
placeholder.textContent = emojis[Math.floor(Math.random() * emojis.length)];
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<div id="tb-mobile-utils">
|
||||
|
||||
<select id="mobile-lang-select" class="uk-select uk-form-small" aria-label="言語">
|
||||
|
||||
<option value="zh-CN" >简体中文</option>
|
||||
|
||||
<option value="zh-TW" >繁體中文</option>
|
||||
|
||||
<option value="en" >English</option>
|
||||
|
||||
<option value="ja" selected>日本語</option>
|
||||
|
||||
</select>
|
||||
|
||||
<button type="button" id="theme-toggle-mobile" class="uk-button uk-button-default uk-button-small"
|
||||
title="ダーク/ライトモード切替" aria-label="ダーク/ライトモード切替">
|
||||
<span class="tb-icon-light"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M20.5 14.3A8.6 8.6 0 0 1 9.7 3.5a8.6 8.6 0 1 0 10.8 10.8z"/></svg></span><span class="tb-icon-dark"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="4"/><path d="M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.2 5.2l1.4 1.4M17.4 17.4l1.4 1.4M18.8 5.2l-1.4 1.4M6.6 17.4l-1.4 1.4"/></svg></span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
|
||||
var THEME_COOKIE = 'theme';
|
||||
function getTheme() {
|
||||
var m = document.cookie.match(/(?:^|;\s*)theme=([^;]*)/);
|
||||
return m ? m[1] : '';
|
||||
}
|
||||
function applyTheme(theme) {
|
||||
if (theme === 'dark') {
|
||||
document.documentElement.setAttribute('data-theme', 'dark');
|
||||
} else {
|
||||
document.documentElement.removeAttribute('data-theme');
|
||||
}
|
||||
}
|
||||
function toggleTheme() {
|
||||
var next = getTheme() === 'dark' ? 'light' : 'dark';
|
||||
applyTheme(next);
|
||||
var expires = new Date(Date.now() + 365 * 24 * 3600 * 1000).toUTCString();
|
||||
document.cookie = THEME_COOKIE + '=' + next + '; path=/; max-age=' + (365 * 24 * 3600) + '; SameSite=Lax';
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
var buttons = document.querySelectorAll('#theme-toggle, #theme-toggle-mobile');
|
||||
buttons.forEach(function(btn) {
|
||||
btn.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
toggleTheme();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
var langSel = document.getElementById('mobile-lang-select');
|
||||
if (langSel) {
|
||||
langSel.addEventListener('change', function() {
|
||||
if (!this.value) return;
|
||||
var to = window.location.pathname + window.location.search;
|
||||
window.location.href = '/i18n/' + encodeURIComponent(this.value) + '?to=' + encodeURIComponent(to);
|
||||
});
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
|
||||
<div class="uk-container uk-container-xsmall">
|
||||
|
||||
|
||||
|
||||
<div id="math-captcha-modal" uk-modal>
|
||||
<div class="uk-modal-dialog uk-modal-body uk-text-center">
|
||||
<h3 class="uk-modal-title">人機認証</h3>
|
||||
<p class="uk-text-meta">以下の計算問題を解いて、ロボットでないことを証明してください</p>
|
||||
<div class="captcha-equation-box">
|
||||
<span id="captcha-modal-question" class="math-captcha-modal-question">読み込み中...</span>
|
||||
<input type="number" id="captcha-modal-answer" placeholder="?" autocomplete="off" inputmode="numeric">
|
||||
</div>
|
||||
<div style="margin-top:6px;">
|
||||
<button type="button" class="uk-button uk-button-text uk-text-small" id="captcha-modal-refresh">別の問題</button>
|
||||
</div>
|
||||
<div id="captcha-modal-error" class="uk-text-danger uk-text-small" style="display:none;min-height:20px;"></div>
|
||||
<div class="uk-margin-small-top">
|
||||
<button type="button" class="uk-button uk-button-primary" id="captcha-modal-submit">送信</button>
|
||||
<button type="button" class="uk-button uk-button-default uk-modal-close">キャンセル</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var CAPTCHA_I18N = {
|
||||
loading: "読み込み中...",
|
||||
loadFailed: "読み込み失敗",
|
||||
loadRetry: "読み込み失敗、再試行してください",
|
||||
inputAnswer: "答えを入力してください",
|
||||
wrongAnswer: "答えが違います。もう一度計算してください",
|
||||
verifyFailed: "認証失敗、再試行してください",
|
||||
needPassword: "この質問箱にはパスワードが必要です",
|
||||
needEmail: "通知を受け取るメールアドレスを入力してください"
|
||||
};
|
||||
</script>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
var captchaId = '';
|
||||
var pendingForm = null;
|
||||
var pendingNeedPassword = false;
|
||||
var verifying = false;
|
||||
|
||||
function fetchCaptcha() {
|
||||
var qEl = document.getElementById('captcha-modal-question');
|
||||
var errEl = document.getElementById('captcha-modal-error');
|
||||
var ansEl = document.getElementById('captcha-modal-answer');
|
||||
qEl.textContent = CAPTCHA_I18N.loading;
|
||||
fetch('/api/captcha/generate')
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(data) {
|
||||
if (data.code === 0 && data.data) {
|
||||
captchaId = data.data.id;
|
||||
qEl.textContent = data.data.question;
|
||||
if (errEl) errEl.style.display = 'none';
|
||||
if (ansEl) { ansEl.value = ''; ansEl.focus(); }
|
||||
} else {
|
||||
qEl.textContent = CAPTCHA_I18N.loadFailed;
|
||||
}
|
||||
})
|
||||
.catch(function() {
|
||||
qEl.textContent = CAPTCHA_I18N.loadRetry;
|
||||
});
|
||||
}
|
||||
|
||||
function getCSRFToken() {
|
||||
var input = document.querySelector('input[name="_csrf"]');
|
||||
return input ? input.value : '';
|
||||
}
|
||||
|
||||
function doSubmit(form) {
|
||||
|
||||
var ans = document.getElementById('captcha-modal-answer').value.trim();
|
||||
var hidden = form.querySelector('[name="g-recaptcha-response"]');
|
||||
if (hidden) hidden.value = captchaId + ':' + (ans || '0');
|
||||
|
||||
UIkit.modal('#math-captcha-modal').hide();
|
||||
|
||||
|
||||
if (pendingNeedPassword) {
|
||||
UIkit.modal.prompt(CAPTCHA_I18N.needPassword, '', 'password')
|
||||
.then(function(password) {
|
||||
if (password) {
|
||||
var pwInput = document.getElementById('ask_password_input');
|
||||
if (pwInput) pwInput.value = password;
|
||||
form.submit();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
document.getElementById('captcha-modal-submit').addEventListener('click', function() {
|
||||
if (verifying) return;
|
||||
var ans = document.getElementById('captcha-modal-answer').value.trim();
|
||||
if (!ans) {
|
||||
var errEl = document.getElementById('captcha-modal-error');
|
||||
errEl.textContent = CAPTCHA_I18N.inputAnswer;
|
||||
errEl.style.display = 'block';
|
||||
return;
|
||||
}
|
||||
verifying = true;
|
||||
fetch('/api/captcha/verify', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-Token': getCSRFToken()
|
||||
},
|
||||
body: JSON.stringify({ id: captchaId, answer: parseInt(ans, 10) })
|
||||
})
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(data) {
|
||||
verifying = false;
|
||||
if (data.correct) {
|
||||
if (pendingForm) doSubmit(pendingForm);
|
||||
} else {
|
||||
var errEl = document.getElementById('captcha-modal-error');
|
||||
errEl.textContent = CAPTCHA_I18N.wrongAnswer;
|
||||
errEl.style.display = 'block';
|
||||
fetchCaptcha();
|
||||
}
|
||||
})
|
||||
.catch(function() {
|
||||
verifying = false;
|
||||
var errEl = document.getElementById('captcha-modal-error');
|
||||
errEl.textContent = CAPTCHA_I18N.verifyFailed;
|
||||
errEl.style.display = 'block';
|
||||
fetchCaptcha();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
document.getElementById('captcha-modal-answer').addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
document.getElementById('captcha-modal-submit').click();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
document.getElementById('captcha-modal-refresh').addEventListener('click', fetchCaptcha);
|
||||
|
||||
|
||||
document.addEventListener('click', function(e) {
|
||||
var btn = e.target.closest('.math-captcha-trigger');
|
||||
if (!btn) return;
|
||||
e.preventDefault();
|
||||
|
||||
var form = btn.closest('form');
|
||||
if (!form) return;
|
||||
pendingForm = form;
|
||||
|
||||
|
||||
pendingNeedPassword = !!(form.querySelector('#ask_password_input'));
|
||||
|
||||
|
||||
var notifyCb = document.getElementById('notify-checkbox');
|
||||
var emailInput = document.getElementById('email-input');
|
||||
if (notifyCb && notifyCb.checked && emailInput && emailInput.value.trim() === '') {
|
||||
UIkit.modal.alert(CAPTCHA_I18N.needEmail);
|
||||
return;
|
||||
}
|
||||
|
||||
fetchCaptcha();
|
||||
UIkit.modal('#math-captcha-modal').show();
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
|
||||
<style>
|
||||
|
||||
.tb-field-head {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 6px 8px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.tb-field-head .tb-field-label {
|
||||
flex-basis: 100%;
|
||||
font-weight: 600;
|
||||
line-height: 1.5;
|
||||
word-break: break-word;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.tb-choice {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
padding: 12px 14px;
|
||||
margin-bottom: 8px;
|
||||
border: 1px solid var(--tb-border);
|
||||
border-radius: 8px;
|
||||
background: var(--tb-surface);
|
||||
cursor: pointer;
|
||||
transition: border-color 0.2s ease, background 0.2s ease;
|
||||
}
|
||||
.tb-choice:last-child { margin-bottom: 0; }
|
||||
.tb-choice input[type="radio"], .tb-choice input[type="checkbox"] {
|
||||
margin-top: 3px;
|
||||
}
|
||||
.tb-choice span {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
line-height: 1.5;
|
||||
word-break: break-word;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.tb-choice:hover {
|
||||
border-color: var(--tb-primary);
|
||||
background: var(--tb-surface-hover);
|
||||
}
|
||||
.tb-choice:has(input:checked) {
|
||||
border-color: var(--tb-primary);
|
||||
background: var(--tb-surface-active);
|
||||
}
|
||||
html[data-theme="dark"] .tb-choice {
|
||||
border-color: var(--tb-border);
|
||||
background: var(--tb-surface);
|
||||
}
|
||||
html[data-theme="dark"] .tb-choice:hover {
|
||||
border-color: var(--tb-primary);
|
||||
background: rgba(78, 168, 245, 0.08);
|
||||
}
|
||||
html[data-theme="dark"] .tb-choice:has(input:checked) {
|
||||
border-color: var(--tb-primary);
|
||||
background: rgba(78, 168, 245, 0.14);
|
||||
}
|
||||
|
||||
.tb-custom-input {
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.tb-text-counter {
|
||||
margin-top: 2px;
|
||||
text-align: right;
|
||||
}
|
||||
@media (max-width: 480px) {
|
||||
.tb-choice { padding: 10px 12px; }
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="uk-card uk-card-default uk-card-body uk-margin-bottom">
|
||||
<div class="uk-flex uk-flex-middle uk-margin-small-bottom" style="gap: 10px;">
|
||||
|
||||
<img class="uk-border-circle" src="https://r2.337845818.best/tamabox/picture/2026/08/19/9af3e38222d972ff9141e9cfdb0475" style="width: 40px; height: 40px;">
|
||||
<div>
|
||||
<a class="uk-text-bold" href="/_admin6">admin6</a>
|
||||
<div class="uk-text-meta uk-text-small">の投票</div>
|
||||
</div>
|
||||
|
||||
<div class="uk-margin-auto-left">
|
||||
|
||||
|
||||
<span class="uk-label uk-label-success">進行中</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3 class="uk-margin-remove-top uk-margin-small-bottom">吃什么</h3>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="uk-alert uk-alert-warning">
|
||||
この投票は登録ユーザーのみ参加できます。ログインしてください。 <a href="/login?to=%2fvote%2ft86urUZo26xE">ログイン</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<form method="post" action="/vote/t86urUZo26xE/submit" id="vote-form" onsubmit="return validateVoteForm()">
|
||||
<input type="hidden" name="_csrf" value="B1O7d1hhDznoA36CR6ndXmkVkLM6MTc5MjM4NDM3MTkzODQ1ODUwNw">
|
||||
<input type="hidden" name="g-recaptcha-response" id="g-recaptcha-response" value="">
|
||||
|
||||
<div class="uk-card uk-card-default uk-card-body uk-margin-bottom">
|
||||
|
||||
|
||||
<div class="uk-margin">
|
||||
<div class="tb-field-head">
|
||||
<span class="uk-label">1</span>
|
||||
<span class="uk-label ">一行テキスト</span>
|
||||
<div class="tb-field-label">是啊,吃什么?</div>
|
||||
</div>
|
||||
|
||||
<input class="uk-input" type="text" name="field_41" >
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="uk-margin">
|
||||
|
||||
<button type="button" class="uk-button uk-button-primary math-captcha-trigger" onclick="return voteValidate(event)">投票する</button>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
var MAX_CUSTOM_LEN = 200 ;
|
||||
|
||||
|
||||
|
||||
function countChars(s) { return Array.from(String(s || '')).length; }
|
||||
|
||||
|
||||
function setupTextCounters() {
|
||||
var form = document.getElementById('vote-form');
|
||||
if (!form) { return; }
|
||||
form.querySelectorAll('[data-tb-text-counter]').forEach(function (input) {
|
||||
var max = parseInt(input.getAttribute('data-tb-text-max'), 10);
|
||||
if (!max || max < 1) { max = MAX_CUSTOM_LEN; }
|
||||
var counter = document.createElement('div');
|
||||
counter.className = 'uk-text-meta uk-text-small tb-text-counter';
|
||||
if (input.parentNode) { input.parentNode.insertBefore(counter, input.nextSibling); }
|
||||
var update = function () {
|
||||
var n = countChars(input.value);
|
||||
counter.textContent = n + ' / ' + max;
|
||||
if (n > max) {
|
||||
counter.classList.add('uk-text-danger');
|
||||
input.setAttribute('data-tb-too-long', '1');
|
||||
} else {
|
||||
counter.classList.remove('uk-text-danger');
|
||||
input.removeAttribute('data-tb-too-long');
|
||||
}
|
||||
};
|
||||
input.addEventListener('input', update);
|
||||
update();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
function validateVoteForm() {
|
||||
var form = document.getElementById('vote-form');
|
||||
if (!form) { return true; }
|
||||
|
||||
var tooLong = form.querySelector('[data-tb-text-counter][data-tb-too-long]');
|
||||
if (tooLong) {
|
||||
alert('自由記入オプションは 200 字以内にしてください');
|
||||
tooLong.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
var groups = {};
|
||||
form.querySelectorAll('input[data-vote-required][type="radio"], input[data-vote-required][type="checkbox"]').forEach(function (el) {
|
||||
(groups[el.name] = groups[el.name] || []).push(el);
|
||||
});
|
||||
for (var name in groups) {
|
||||
var any = groups[name].some(function (el) { return el.checked; });
|
||||
if (!any) {
|
||||
alert('入力してください「' + groups[name][0].getAttribute('data-vote-label') + '」');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
var els = form.querySelectorAll('[data-vote-required]:not(input[type="radio"]):not(input[type="checkbox"])');
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
var el = els[i];
|
||||
if (el.disabled) { continue; }
|
||||
if ((el.value || '').trim() === '') {
|
||||
alert('入力してください「' + el.getAttribute('data-vote-label') + '」');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function voteValidate(e) {
|
||||
if (!validateVoteForm()) {
|
||||
if (e) { e.stopPropagation(); e.preventDefault(); }
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
if (validateVoteForm()) {
|
||||
document.getElementById('vote-form').submit();
|
||||
}
|
||||
}
|
||||
|
||||
(function () {
|
||||
var form = document.getElementById('vote-form');
|
||||
if (!form) { return; }
|
||||
setupTextCounters();
|
||||
var maxChoices = 0;
|
||||
if (maxChoices > 0) {
|
||||
var boxes = form.querySelectorAll('input[type="checkbox"][name="option_ids"]');
|
||||
boxes.forEach(function (box) {
|
||||
box.addEventListener('change', function () {
|
||||
var checked = form.querySelectorAll('input[type="checkbox"][name="option_ids"]:checked').length;
|
||||
if (checked > maxChoices) { this.checked = false; }
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
var CUSTOM_MARKER = "__tb_custom_option__";
|
||||
form.querySelectorAll('[data-vote-custom-input]').forEach(function (input) {
|
||||
var fid = input.getAttribute('data-vote-custom-input');
|
||||
var group = form.querySelectorAll('input[name="field_' + fid + '"]');
|
||||
var select = form.querySelector('select[name="field_' + fid + '"]');
|
||||
var sync = function () {
|
||||
var on = false;
|
||||
if (select) {
|
||||
on = (select.value === CUSTOM_MARKER);
|
||||
} else {
|
||||
group.forEach(function (r) { if (r.value === CUSTOM_MARKER && r.checked) { on = true; } });
|
||||
}
|
||||
input.disabled = !on;
|
||||
if (!on) { input.value = ''; }
|
||||
};
|
||||
if (select) { select.addEventListener('change', sync); } else { group.forEach(function (r) { r.addEventListener('change', sync); }); }
|
||||
sync();
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
<p class=" uk-text-right uk-text-muted uk-text-small">
|
||||
<br>
|
||||
<a href="/rules">ルール</a> |
|
||||
|
||||
<a href="https://box.shiroko.one/_/tamakyi" target="_blank">管理者へ</a>
|
||||
<br>
|
||||
<a href="https://share.shiroko.one" target="_blank">ドライブ</a>
|
||||
| <a href="https://blog.shiroko.one" target="_blank">お知らせ</a>
|
||||
| <a href="https://chat.shiroko.one" target="_blank">チャット</a>
|
||||
| <a href="https://status.shiroko.one" target="_blank">ステータス</a>
|
||||
| <a href="https://shiroko.one" target="_blank">リンク</a>
|
||||
<br>Powered by NekoBox | 狼ICP备 20230101
|
||||
<br>質問箱は稼働中:<span id="box_runtime"></span>
|
||||
</p>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
|
||||
(function () {
|
||||
var create = Math.round(Date.UTC(2023, 6, 1, 18, 15, 43) / 1000);
|
||||
function tick() {
|
||||
var el = document.getElementById("box_runtime");
|
||||
if (!el) return;
|
||||
var s = Math.round((Date.now() + 8 * 3600 * 1000) / 1000) - create;
|
||||
var t = [0, 0, 0, 0, 0];
|
||||
if (s >= 31536000) { t[0] = s / 31536000 | 0; s %= 31536000; }
|
||||
if (s >= 86400) { t[1] = s / 86400 | 0; s %= 86400; }
|
||||
if (s >= 3600) { t[2] = s / 3600 | 0; s %= 3600; }
|
||||
if (s >= 60) { t[3] = s / 60 | 0; s %= 60; }
|
||||
if (s > 0) { t[4] = s; }
|
||||
el.innerHTML = t[0] + '年 ' + t[1] + '天 ' + t[2] + '时 ' + t[3] + '分 ' + t[4] + '秒 ';
|
||||
}
|
||||
tick();
|
||||
setInterval(tick, 1000);
|
||||
})();
|
||||
</script>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
|
||||
var SUBMIT_I18N = {
|
||||
submitting: '送信中...',
|
||||
uploading: 'アップロード中...'
|
||||
};
|
||||
|
||||
function tbResetSubmitButtons() {
|
||||
document.querySelectorAll('button[data-tb-submitting]').forEach(function(b) {
|
||||
b.disabled = false;
|
||||
b.removeAttribute('data-tb-submitting');
|
||||
var orig = b.getAttribute('data-tb-restore');
|
||||
if (orig !== null) {
|
||||
b.innerHTML = orig;
|
||||
b.removeAttribute('data-tb-restore');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('submit', function(e) {
|
||||
var form = e.target;
|
||||
if (!form || form.tagName !== 'FORM') return;
|
||||
|
||||
|
||||
|
||||
if (e.defaultPrevented || form.getAttribute('data-tb-skip-submit-feedback') === '1') {
|
||||
form.removeAttribute('data-tb-skip-submit-feedback');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (form.getAttribute('target') === '_blank') return;
|
||||
|
||||
|
||||
var trigger = e.submitter || form.querySelector('button[type="submit"]');
|
||||
|
||||
|
||||
var hasFile = false;
|
||||
form.querySelectorAll('input[type="file"]').forEach(function(f) {
|
||||
if (f.files && f.files.length > 0) hasFile = true;
|
||||
});
|
||||
var label = hasFile ? SUBMIT_I18N.uploading : SUBMIT_I18N.submitting;
|
||||
|
||||
if (trigger && trigger.tagName === 'BUTTON') {
|
||||
trigger.setAttribute('data-tb-restore', trigger.innerHTML);
|
||||
trigger.innerHTML = '<span uk-spinner="ratio: 0.6"></span> ' + label;
|
||||
}
|
||||
|
||||
|
||||
form.querySelectorAll('button').forEach(function(b) {
|
||||
b.disabled = true;
|
||||
b.setAttribute('data-tb-submitting', '1');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
window.addEventListener('pageshow', tbResetSubmitButtons);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user