summaryrefslogtreecommitdiff
path: root/web/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'web/index.html')
-rw-r--r--web/index.html84
1 files changed, 84 insertions, 0 deletions
diff --git a/web/index.html b/web/index.html
index 404b367..e02159c 100644
--- a/web/index.html
+++ b/web/index.html
@@ -54,6 +54,47 @@
to { opacity: 1; transform: scale(1); }
}
.pop { animation: pop 90ms ease-out; }
+ /* intro page: red, the photo, and the title */
+ #intro {
+ position: fixed; inset: 0; z-index: 10;
+ background: #c8102e; color: #fff;
+ display: flex; flex-direction: column;
+ align-items: center; justify-content: center;
+ gap: 3.2vh; padding: 6vh 6vw; box-sizing: border-box;
+ text-align: center;
+ }
+ #intro[hidden] { display: none; }
+ #intro img {
+ max-width: min(74vw, 1150px);
+ max-height: 44vh;
+ box-shadow: 0 0 0 5px rgba(0,0,0,.28), 0 18px 50px rgba(0,0,0,.35);
+ filter: grayscale(1) contrast(1.06);
+ }
+ #intro h1 {
+ margin: 0;
+ font-size: clamp(44px, 11vh, 190px);
+ font-weight: 900;
+ line-height: 1;
+ letter-spacing: .05em;
+ text-indent: .05em;
+ }
+ #intro h2 {
+ margin: 0;
+ font-family: "Noto Sans", "DejaVu Sans", sans-serif;
+ font-size: clamp(16px, 3.4vh, 56px);
+ font-weight: 800;
+ letter-spacing: .34em;
+ text-indent: .34em;
+ }
+ #intro .hint {
+ position: absolute; bottom: 4.5vh;
+ font: 600 clamp(12px, 1.7vh, 22px)/1 "Noto Sans", "DejaVu Sans", sans-serif;
+ letter-spacing: .1em; opacity: .9;
+ }
+ #intro .hint .key {
+ display: inline-block; padding: .12em .45em; margin-right: .5em;
+ border: 2px solid currentColor; border-radius: .28em; font-weight: 700;
+ }
#d {
position: fixed; right: 12px; bottom: 10px; display: none;
font: 12px/1.4 ui-monospace, monospace; color: #bbb; letter-spacing: 0;
@@ -61,6 +102,12 @@
</style>
</head>
<body>
+<div id="intro">
+ <img id="intro-img" src="/intro.jpg" alt="">
+ <h1 id="intro-zh">批斗大会</h1>
+ <h2 id="intro-en">STRUGGLE SESSION</h2>
+ <div class="hint"><span class="key">&#9166;</span> Press enter to start</div>
+</div>
<div id="wrap"><div id="stack"><div id="zh"></div><div id="en"></div></div></div>
<div id="d"></div>
<script>
@@ -162,6 +209,13 @@
addEventListener('resize', function () { measurePad(); fit(); });
addEventListener('keydown', function (e) {
+ if (introVisible) {
+ if (e.key === 'Enter' || e.key === ' ') {
+ e.preventDefault();
+ startTalk();
+ }
+ return;
+ }
if (e.key === 'Enter') {
e.preventDefault();
keep();
@@ -181,6 +235,29 @@
measurePad();
+ const introEl = document.getElementById('intro');
+ let introVisible = !introEl.hidden;
+
+ function showIntro(cfg) {
+ document.getElementById('intro-zh').textContent = cfg.introZH || '';
+ document.getElementById('intro-en').textContent = cfg.introEN || '';
+ const img = document.getElementById('intro-img');
+ if (cfg.introImg) img.src = cfg.introImg; else img.remove();
+ introEl.hidden = false;
+ introVisible = true;
+ }
+
+ function hideIntro() {
+ introEl.hidden = true;
+ introVisible = false;
+ }
+
+ function startTalk() {
+ hideIntro();
+ fetch('/start', { method: 'POST', keepalive: true }).catch(function () {});
+ }
+
+ if (q.has('text') || q.has('cut')) hideIntro();
if (q.has('invert')) body.classList.add('invert');
if (q.has('keep')) body.classList.add('keep');
if (q.has('cut')) { body.classList.add('cut'); return; }
@@ -190,6 +267,12 @@
return;
}
+ fetch('/config').then(function (r) { return r.json(); }).then(function (cfg) {
+ if (cfg.translate) body.classList.add('en');
+ if (cfg.debug) d.style.display = 'block';
+ if (cfg.intro && !cfg.started) showIntro(cfg); else hideIntro();
+ }).catch(function () {});
+
const es = new EventSource('/events');
es.onmessage = function (e) {
try {
@@ -197,6 +280,7 @@
body.classList.toggle('invert', !!s.invert);
body.classList.toggle('cut', !!s.cut);
body.classList.toggle('keep', !!s.keep);
+ if (s.start && introVisible) hideIntro();
if (s.cut) { curZh = ''; curEn = ''; zh.textContent = ''; en.textContent = ''; return; }
if (s.keep && s.text === curZh) return; // only the colour changed
render(s.text, s.en, s.cap);