diff --git a/assets/pregame.js b/assets/pregame.js index bbea719..7158fd2 100644 --- a/assets/pregame.js +++ b/assets/pregame.js @@ -9,6 +9,18 @@ function appendMessage(container, text, extraClass = '') { window.scrollTo(0, document.body.scrollHeight); } +function dockBackButton(inputField) { + const backButton = document.getElementById('back-button'); + const inputContainer = document.getElementById('input'); + if (!backButton || !inputContainer) { + return; + } + + inputField.style.display = 'none'; + backButton.classList.add('docked'); + inputContainer.appendChild(backButton); +} + document.addEventListener('DOMContentLoaded', () => { console.log('Pregame bundle loaded'); @@ -336,6 +348,7 @@ document.addEventListener('DOMContentLoaded', () => { playSequence(tutorialEndFollowUp, messageContainer, () => { tutorialStage = 'complete'; inputField.disabled = true; + dockBackButton(inputField); }); return; } diff --git a/assets/styles/pregame.css b/assets/styles/pregame.css index 3245f7e..1357e46 100644 --- a/assets/styles/pregame.css +++ b/assets/styles/pregame.css @@ -69,3 +69,32 @@ input#input-message { box-sizing: border-box; font-family: monospace; } + +a#back-button { + position: fixed; + top: 16px; + left: 16px; + padding: 6px 14px; + background: #111; + border: 1px solid #A00000; + color: #C0C0C0; + font-size: 13px; + font-family: monospace; + text-decoration: none; + z-index: 200; +} + +a#back-button:hover { + background: #1a1a1a; + color: #FFF; +} + +a#back-button.docked { + position: static; + display: block; + width: 100%; + padding: 6px 10px; + font-size: 14px; + text-align: center; + box-sizing: border-box; +} diff --git a/templates/pregame/default.html.twig b/templates/pregame/default.html.twig index 2119b09..13163ad 100644 --- a/templates/pregame/default.html.twig +++ b/templates/pregame/default.html.twig @@ -10,6 +10,8 @@
+ ← Back +
No tutorial is available for this game yet.
diff --git a/templates/pregame/game1.html.twig b/templates/pregame/game1.html.twig index 6dd5f40..b73b84f 100644 --- a/templates/pregame/game1.html.twig +++ b/templates/pregame/game1.html.twig @@ -17,6 +17,8 @@ style="display:none">
+ ← Back +