This commit is contained in:
2026-03-07 23:20:39 +01:00
parent ae766d4f4a
commit d48aaa978e

View File

@@ -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 tabBar = document.querySelector('[data-console-tab-bar]');
const tabPanels = document.querySelector('[data-console-tab-panels]'); const tabPanels = document.querySelector('[data-console-tab-panels]');
if (!tabBar || !tabPanels) return; if (!tabBar || !tabPanels) return;
@@ -107,9 +98,15 @@
iframe.addEventListener('load', () => { iframe.addEventListener('load', () => {
try { try {
if (iframe.contentWindow) { const clearUnload = () => {
if (!iframe.contentWindow) return;
iframe.contentWindow.onbeforeunload = null; iframe.contentWindow.onbeforeunload = null;
if (iframe.contentWindow.document) {
iframe.contentWindow.document.onbeforeunload = null;
} }
};
clearUnload();
setInterval(clearUnload, 2000);
const doc = iframe.contentWindow.document; const doc = iframe.contentWindow.document;
['keydown', 'mousedown', 'wheel', 'touchstart'].forEach((evt) => { ['keydown', 'mousedown', 'wheel', 'touchstart'].forEach((evt) => {
doc.addEventListener(evt, markActive, { passive: true }); doc.addEventListener(evt, markActive, { passive: true });