From f2ff20ce735ba9a0040ae93bb3bf54f5284d2b1f Mon Sep 17 00:00:00 2001 From: sthag Date: Sun, 8 Mar 2026 20:50:25 +0100 Subject: [PATCH] feat: Add location change to intro --- source/code/hippie/app.js | 5 +++ source/code/intro.js | 32 ++++++++++++------- .../screens/demo/examples/game/intro.liquid | 1 + 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/source/code/hippie/app.js b/source/code/hippie/app.js index d5f077f..f0028a5 100644 --- a/source/code/hippie/app.js +++ b/source/code/hippie/app.js @@ -539,6 +539,11 @@ function mapRange(value, inMin, inMax, outMin, outMax, reverse = false, clamp = return mapped; } +// Source - https://stackoverflow.com/a/47480429 +// Posted by Etienne Martin, modified by community. See post 'Timeline' for change history +// Retrieved 2026-03-08, License - CC BY-SA 4.0 +const delay = ms => new Promise(res => setTimeout(res, ms)); + // CONCEPTS // NOTE: Benutzt private Zuweisungen diff --git a/source/code/intro.js b/source/code/intro.js index 26be826..68dcda0 100644 --- a/source/code/intro.js +++ b/source/code/intro.js @@ -119,7 +119,7 @@ function init() { // Set all steps to not receive pointer events document.querySelectorAll('.step').forEach(element => { console.log(element); - + element.style.pointerEvents = 'none'; }); @@ -158,7 +158,7 @@ function showIntro() { reject('No intro available.'); } - }) + }); } function showAgreement() { @@ -197,7 +197,7 @@ function showAgreement() { resolve(steps.agreement.msgOut); }); } - }) + }); } function showIdle() { @@ -212,16 +212,24 @@ function showIdle() { el.classList.replace('op_hide', 'op_show'); el.style.pointerEvents = ''; - el.addEventListener('click', idleStart, false); - - resolve('Idle.'); + el.addEventListener('contextmenu', (event) => { + event.preventDefault(); + }); + el.addEventListener('click', (event) => { + if (checkButtonAndTarget(event, event.target)) { + console.log('OK go', event.target); + resolve('Idle fin.'); + } else { + event.preventDefault(); + } + }, false); } else { document.removeEventListener('mouseleave', idleStart); document.removeEventListener('mouseenter', idleStop); reject(); } - }) + }); } function loadCore() { @@ -289,9 +297,9 @@ function idleStop() { /** * Blendet einen Schritt aus. - * - * @param {*} e - * @returns + * + * @param {*} e + * @returns */ function stepHandler(e) { const el = e.target; @@ -303,8 +311,8 @@ function stepHandler(e) { console.info(msg); el.removeEventListener('transitionend', endListener); - + resolve(msg); }); - }) + }); } \ No newline at end of file diff --git a/source/screens/demo/examples/game/intro.liquid b/source/screens/demo/examples/game/intro.liquid index c223413..3c4710c 100644 --- a/source/screens/demo/examples/game/intro.liquid +++ b/source/screens/demo/examples/game/intro.liquid @@ -132,6 +132,7 @@ tags: .finally(() => { console.debug('Init end.', isAgree); // location = 'demo/examples/ui/new.html'; + window.location.href = './menu.html'; }); {% endblock %} \ No newline at end of file