From d48aaa978e622adbe3effad2d0c4f4d7a0ad62a8 Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Sat, 7 Mar 2026 23:20:39 +0100 Subject: [PATCH] asdasd --- modules/pi_control/assets/console.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/modules/pi_control/assets/console.js b/modules/pi_control/assets/console.js index fbd5953..0a13946 100644 --- a/modules/pi_control/assets/console.js +++ b/modules/pi_control/assets/console.js @@ -1,13 +1,4 @@ (() => { - window.addEventListener( - 'beforeunload', - (e) => { - e.stopImmediatePropagation(); - e.preventDefault(); - e.returnValue = undefined; - }, - { capture: true } - ); const tabBar = document.querySelector('[data-console-tab-bar]'); const tabPanels = document.querySelector('[data-console-tab-panels]'); if (!tabBar || !tabPanels) return; @@ -107,9 +98,15 @@ iframe.addEventListener('load', () => { try { - if (iframe.contentWindow) { + const clearUnload = () => { + if (!iframe.contentWindow) return; iframe.contentWindow.onbeforeunload = null; - } + if (iframe.contentWindow.document) { + iframe.contentWindow.document.onbeforeunload = null; + } + }; + clearUnload(); + setInterval(clearUnload, 2000); const doc = iframe.contentWindow.document; ['keydown', 'mousedown', 'wheel', 'touchstart'].forEach((evt) => { doc.addEventListener(evt, markActive, { passive: true });