()
| 4330 | childList: true, |
| 4331 | subtree: true, |
| 4332 | attributes: true, |
| 4333 | attributeFilter: ["style", "src", "class"] |
| 4334 | }); |
| 4335 | return true; |
| 4336 | } |
| 4337 | (function hookHistory() { |
| 4338 | const wrap = (fn) => { |
| 4339 | const orig = history[fn]; |
| 4340 | history[fn] = function(...args) { |
| 4341 | const res = orig.apply(this, args); |
| 4342 | setTimeout(() => { |
| 4343 | if (isArtistPage()) applySavedModeIfArtist(); |
| 4344 | }, 80); |
| 4345 | return res; |
| 4346 | }; |
| 4347 | }; |
| 4348 | try { |
| 4349 | wrap("pushState"); |
| 4350 | wrap("replaceState"); |
| 4351 | } catch { |
| 4352 | } |
| 4353 | window.addEventListener("popstate", () => setTimeout(() => isArtistPage() && applySavedModeIfArtist(), 80)); |
| 4354 | })(); |
| 4355 | (function installBgChangeHandler() { |
| 4356 | const RETRY_COUNT = 4; |
| 4357 | const RETRY_DELAY = 80; |
| 4358 | let debounceTimer = null; |
| 4359 | async function doApplyCustomWithRetries() { |
| 4360 | if (getSavedMode() !== "custom") return; |
| 4361 | if (!isArtistPage()) return; |
| 4362 | for (let i2 = 0; i2 < RETRY_COUNT; i2++) { |
| 4363 | try { |
| 4364 | applyMode("custom"); |
| 4365 | } catch (e) { |
| 4366 | console.warn("applyMode(custom) failed", i2, e); |
| 4367 | } |
| 4368 | await sleep(RETRY_DELAY); |
| 4369 | } |
| 4370 | } |
| 4371 | const anyWin = window; |
| 4372 | window.removeEventListener("glowifyBackgroundChange", anyWin._glowifyArtistBgHandler || (() => { |
| 4373 | })); |
| 4374 | anyWin._glowifyArtistBgHandler = () => { |
| 4375 | if (debounceTimer) clearTimeout(debounceTimer); |
| 4376 | debounceTimer = setTimeout(() => { |
| 4377 | doApplyCustomWithRetries().catch(console.warn); |
| 4378 | debounceTimer = null; |
| 4379 | }, 60); |
| 4380 | }; |
| 4381 | window.addEventListener("glowifyBackgroundChange", anyWin._glowifyArtistBgHandler); |
| 4382 | })(); |
| 4383 | (function tryInit() { |
| 4384 | if (!startObservers()) { |
| 4385 | setTimeout(tryInit, 200); |
| 4386 | return; |
| 4387 | } |
| 4388 | if (isArtistPage()) applySavedModeIfArtist(); |
| 4389 | })(); |
no outgoing calls
no test coverage detected