diff --git a/Firefox.zip b/Firefox.zip index c4020ce..3c45f1f 100644 Binary files a/Firefox.zip and b/Firefox.zip differ diff --git a/tampermonkey/backtohome.js b/tampermonkey/backtohome.js index a7a0935..5dbb51e 100644 --- a/tampermonkey/backtohome.js +++ b/tampermonkey/backtohome.js @@ -9,31 +9,22 @@ // @grant GM_addStyle // ==/UserScript== -const target = "https://kiosk.39c3.by.vincent.mahn.ke/"; (function() { 'use strict'; - // if the user is on target already or subdomain, do nothing - if (window.location.href === target || window.location.href.startsWith(target + '/')) { - return; - } - const btn = document.createElement('button'); btn.textContent = 'Home'; btn.style.cssText = ' all: unset; box-sizing: border-box; border: 2px solid #141414; background: #faf5f5; text-align: center; color: #141414; position: fixed; right: 10px; bottom: 10px; width: 60px; height: 60px; z-index: 2147483647; padding-top: 6px; border-radius: 60px;'; btn.innerHTML = ''; btn.addEventListener('click', () => { - window.location.href = target; + window.location.href = 'http://127.0.0.1:8080'; }); (document.body || document.documentElement).appendChild(btn); - const IDLE_LIMIT_MS = 60_000; + const IDLE_LIMIT_MS = 30_000; // 30 seconds let idleTimer = null; let promptVisible = false; - const PROMPT_LIMIT_MS = 30_000; - let promptInterval = null; - let promptTimeout = null; const modal = document.createElement('div'); modal.id = 'idle-modal'; @@ -55,7 +46,6 @@ const target = "https://kiosk.39c3.by.vincent.mahn.ke/";
Do you want to stay on this page or go back to the home page?
-Auto return in 30s
`; document.body.appendChild(modal); @@ -86,57 +76,21 @@ const target = "https://kiosk.39c3.by.vincent.mahn.ke/"; promptVisible = true; modal.hidden = false; backdrop.hidden = false; - - // Clear any previous prompt timers - if (promptInterval) { clearInterval(promptInterval); promptInterval = null; } - if (promptTimeout) { clearTimeout(promptTimeout); promptTimeout = null; } - - // Wire button actions (once to avoid duplicates) - const stayBtn = document.querySelector("#idle-stay"); - const goBtn = document.querySelector("#idle-go"); - - if (stayBtn) { - stayBtn.addEventListener("click", () => { + debugger; + // Move focus to the primary action for accessibility + document.querySelector("#idle-stay").addEventListener("click", () => { hidePrompt(); resetIdleTimer(); - }, { once: true }); - } - - if (goBtn) { - goBtn.addEventListener("click", () => { - window.location.href = target; - }, { once: true }); - } - - // 30s countdown visible to the user - let remaining = PROMPT_LIMIT_MS / 1000; // seconds - const countdownEl = document.querySelector("#idle-countdown"); - if (countdownEl) countdownEl.textContent = String(remaining); - - promptInterval = setInterval(() => { - remaining -= 1; - if (remaining >= 0 && countdownEl) { - countdownEl.textContent = String(remaining); - } - }, 1000); - - // Auto-go when expired - promptTimeout = setTimeout(() => { - const go = document.querySelector("#idle-go"); - if (go) { - go.click(); - } else { - window.location.href = target; - } - }, PROMPT_LIMIT_MS); + }); + document.querySelector("#idle-go").addEventListener("click", () => { + window.location.href = 'https://www.google.com'; + }); } function hidePrompt() { promptVisible = false; modal.hidden = true; backdrop.hidden = true; - if (promptInterval) { clearInterval(promptInterval); promptInterval = null; } - if (promptTimeout) { clearTimeout(promptTimeout); promptTimeout = null; } } function onIdle() {