diff --git a/userscript/manga-bookmark.user.js b/userscript/manga-bookmark.user.js index 5be6f6c..d598fcb 100644 --- a/userscript/manga-bookmark.user.js +++ b/userscript/manga-bookmark.user.js @@ -795,8 +795,8 @@ } // Dwell timer: don't advance progress the instant a newer chapter opens (guards - // against a misclick on "latest chapter"). Arm a 25s timer instead; the countdown - // ring around the FAB shows it running. The manual "Update to X" button still fires + // against a misclick on "latest chapter"). Arm a 25s timer instead; the tab fills + // bottom-up to show it counting down. The manual "Update to X" button still fires // immediately. Timer is keyed to the chapter, not the URL, so turning pages within // the same chapter (Demonic /chapter/N/) keeps it counting rather than resetting. const DWELL_MS = 25000; @@ -1419,12 +1419,12 @@ // ============================================================ // Test hook // - // Node's require() defines `module`; Bromite's native engine, Tampermonkey, - // and Violentmonkey do not, so this is inert everywhere the script actually - // ships. Exposes pure logic only — see userscript/test/logic.test.js, which - // loads this file with document.body undefined so the UI never boots. + // Fires only in Node, where window is undefined. The typeof window check keeps it + // inert on pages whose own scripts define a UMD module shim — under @grant none + // the userscript shares page globals, so we must not clobber the page's exports. + // Exposes pure logic only — see userscript/test/logic.test.js. // ============================================================ - if (typeof module === "object" && module.exports) { + if (typeof window === "undefined" && typeof module === "object" && module.exports) { module.exports = { stripBuildHash, asura, demonic, anchorsFromHTML, statusOf }; }