Ver código fonte

fix: beforeunload not using GM storage data

Sven 1 ano atrás
pai
commit
cd96940edb
2 arquivos alterados com 4 adições e 5 exclusões
  1. 0 4
      src/features/input.ts
  2. 4 1
      src/index.ts

+ 0 - 4
src/features/input.ts

@@ -1,7 +1,6 @@
 import { getUnsafeWindow } from "@sv443-network/userutils";
 import { error, getVideoTime, info, log, warn } from "../utils";
 import type { Domain } from "../types";
-import { getFeatures } from "../config";
 
 //#MARKER arrow key skip
 
@@ -173,7 +172,4 @@ export function initBeforeUnloadHook() {
     };
     // @ts-ignore
   })(window.__proto__.addEventListener);
-
-  if(getFeatures().disableBeforeUnloadPopup)
-    disableBeforeUnload();
 }

+ 4 - 1
src/index.ts

@@ -13,7 +13,7 @@ import {
   // input
   initArrowKeySkip, initSiteSwitch, addAnchorImprovements,
   // menu
-  initMenu, addMenu, initBeforeUnloadHook, addConfigMenuOption,
+  initMenu, addMenu, initBeforeUnloadHook, addConfigMenuOption, disableBeforeUnload,
 } from "./features/index";
 
 {
@@ -59,6 +59,9 @@ async function init() {
   }
   try {
     preInitLayout(await initConfig());
+
+    if(getFeatures().disableBeforeUnloadPopup)
+      disableBeforeUnload();
   }
   catch(err) {
     error("Error while initializing ConfigManager:", err);