fix: scope the export hook to Node, refresh the stale ring comment
The module.exports guard fired on any page whose own scripts define a UMD module shim — under @grant none the userscript shares page globals, so that clobbered the page's exports. A typeof window check keeps it to Node. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -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/<page>) 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 };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user