asdsad
This commit is contained in:
@@ -1,4 +1,13 @@
|
||||
(() => {
|
||||
// Disable any beforeunload prompts on this page
|
||||
window.onbeforeunload = null;
|
||||
window.addEventListener(
|
||||
'beforeunload',
|
||||
(e) => {
|
||||
e.stopImmediatePropagation();
|
||||
},
|
||||
{ capture: true }
|
||||
);
|
||||
const tabBar = document.querySelector('[data-console-tab-bar]');
|
||||
const tabPanels = document.querySelector('[data-console-tab-panels]');
|
||||
if (!tabBar || !tabPanels) return;
|
||||
@@ -98,15 +107,33 @@
|
||||
|
||||
iframe.addEventListener('load', () => {
|
||||
try {
|
||||
const clearUnload = () => {
|
||||
if (!iframe.contentWindow) return;
|
||||
iframe.contentWindow.onbeforeunload = null;
|
||||
if (iframe.contentWindow.document) {
|
||||
iframe.contentWindow.document.onbeforeunload = null;
|
||||
const disableBeforeUnload = (win) => {
|
||||
if (!win) return;
|
||||
try {
|
||||
win.onbeforeunload = null;
|
||||
win.addEventListener(
|
||||
'beforeunload',
|
||||
(e) => {
|
||||
e.stopImmediatePropagation();
|
||||
},
|
||||
{ capture: true }
|
||||
);
|
||||
if (win.document) {
|
||||
win.document.onbeforeunload = null;
|
||||
win.document.addEventListener(
|
||||
'beforeunload',
|
||||
(e) => {
|
||||
e.stopImmediatePropagation();
|
||||
},
|
||||
{ capture: true }
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
// ignore
|
||||
}
|
||||
};
|
||||
clearUnload();
|
||||
setInterval(clearUnload, 2000);
|
||||
disableBeforeUnload(iframe.contentWindow);
|
||||
setInterval(() => disableBeforeUnload(iframe.contentWindow), 2000);
|
||||
const doc = iframe.contentWindow.document;
|
||||
['keydown', 'mousedown', 'wheel', 'touchstart'].forEach((evt) => {
|
||||
doc.addEventListener(evt, markActive, { passive: true });
|
||||
|
||||
Reference in New Issue
Block a user