darkreader 4.9.85 → 4.9.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/darkreader.js +53 -25
- package/package.json +7 -7
package/darkreader.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Dark Reader v4.9.
|
|
2
|
+
* Dark Reader v4.9.86
|
|
3
3
|
* https://darkreader.org/
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -2217,6 +2217,9 @@
|
|
|
2217
2217
|
const resolvers$1 = new Map();
|
|
2218
2218
|
const rejectors = new Map();
|
|
2219
2219
|
async function bgFetch(request) {
|
|
2220
|
+
if (window.DarkReader?.Plugins?.fetch) {
|
|
2221
|
+
return window.DarkReader.Plugins.fetch(request);
|
|
2222
|
+
}
|
|
2220
2223
|
return new Promise((resolve, reject) => {
|
|
2221
2224
|
const id = generateUID();
|
|
2222
2225
|
resolvers$1.set(id, resolve);
|
|
@@ -3325,7 +3328,7 @@
|
|
|
3325
3328
|
class VariablesStore {
|
|
3326
3329
|
constructor() {
|
|
3327
3330
|
this.varTypes = new Map();
|
|
3328
|
-
this.rulesQueue =
|
|
3331
|
+
this.rulesQueue = new Set();
|
|
3329
3332
|
this.inlineStyleQueue = [];
|
|
3330
3333
|
this.definedVars = new Set();
|
|
3331
3334
|
this.varRefs = new Map();
|
|
@@ -3339,7 +3342,7 @@
|
|
|
3339
3342
|
}
|
|
3340
3343
|
clear() {
|
|
3341
3344
|
this.varTypes.clear();
|
|
3342
|
-
this.rulesQueue.
|
|
3345
|
+
this.rulesQueue.clear();
|
|
3343
3346
|
this.inlineStyleQueue.splice(0);
|
|
3344
3347
|
this.definedVars.clear();
|
|
3345
3348
|
this.varRefs.clear();
|
|
@@ -3358,14 +3361,14 @@
|
|
|
3358
3361
|
);
|
|
3359
3362
|
}
|
|
3360
3363
|
addRulesForMatching(rules) {
|
|
3361
|
-
this.rulesQueue.
|
|
3364
|
+
this.rulesQueue.add(rules);
|
|
3362
3365
|
}
|
|
3363
3366
|
addInlineStyleForMatching(style) {
|
|
3364
3367
|
this.inlineStyleQueue.push(style);
|
|
3365
3368
|
}
|
|
3366
3369
|
matchVariablesAndDependents() {
|
|
3367
3370
|
if (
|
|
3368
|
-
this.rulesQueue.
|
|
3371
|
+
this.rulesQueue.size === 0 &&
|
|
3369
3372
|
this.inlineStyleQueue.length === 0
|
|
3370
3373
|
) {
|
|
3371
3374
|
return;
|
|
@@ -3707,7 +3710,7 @@
|
|
|
3707
3710
|
this.inlineStyleQueue.forEach((style) => {
|
|
3708
3711
|
this.collectVarsFromCSSDeclarations(style);
|
|
3709
3712
|
});
|
|
3710
|
-
this.rulesQueue.
|
|
3713
|
+
this.rulesQueue.clear();
|
|
3711
3714
|
this.inlineStyleQueue.splice(0);
|
|
3712
3715
|
}
|
|
3713
3716
|
collectVarsFromCSSDeclarations(style) {
|
|
@@ -3722,7 +3725,7 @@
|
|
|
3722
3725
|
}
|
|
3723
3726
|
shouldProcessRootVariables() {
|
|
3724
3727
|
return (
|
|
3725
|
-
this.rulesQueue.
|
|
3728
|
+
this.rulesQueue.size > 0 &&
|
|
3726
3729
|
document.documentElement.getAttribute("style")?.includes("--")
|
|
3727
3730
|
);
|
|
3728
3731
|
}
|
|
@@ -6099,7 +6102,6 @@
|
|
|
6099
6102
|
const sheet = newSheets[i];
|
|
6100
6103
|
if (overrides.has(sheet)) {
|
|
6101
6104
|
newSheets.splice(i, 1);
|
|
6102
|
-
overrides.delete(sheet);
|
|
6103
6105
|
}
|
|
6104
6106
|
}
|
|
6105
6107
|
if (node.adoptedStyleSheets.length !== newSheets.length) {
|
|
@@ -7339,6 +7341,24 @@
|
|
|
7339
7341
|
addMetaListener();
|
|
7340
7342
|
return false;
|
|
7341
7343
|
}
|
|
7344
|
+
let interceptorAttempts = 2;
|
|
7345
|
+
function interceptOldScript({success, failure}) {
|
|
7346
|
+
if (--interceptorAttempts <= 0) {
|
|
7347
|
+
failure();
|
|
7348
|
+
return;
|
|
7349
|
+
}
|
|
7350
|
+
const oldMeta = document.head.querySelector('meta[name="darkreader"]');
|
|
7351
|
+
if (!oldMeta || oldMeta.content === INSTANCE_ID) {
|
|
7352
|
+
return;
|
|
7353
|
+
}
|
|
7354
|
+
const lock = document.createElement("meta");
|
|
7355
|
+
lock.name = "darkreader-lock";
|
|
7356
|
+
document.head.append(lock);
|
|
7357
|
+
queueMicrotask(() => {
|
|
7358
|
+
lock.remove();
|
|
7359
|
+
success();
|
|
7360
|
+
});
|
|
7361
|
+
}
|
|
7342
7362
|
function createOrUpdateDynamicThemeInternal(
|
|
7343
7363
|
themeConfig,
|
|
7344
7364
|
dynamicThemeFixes,
|
|
@@ -7365,20 +7385,32 @@
|
|
|
7365
7385
|
});
|
|
7366
7386
|
}
|
|
7367
7387
|
isIFrame$1 = iframe;
|
|
7368
|
-
|
|
7369
|
-
|
|
7388
|
+
const ready = () => {
|
|
7389
|
+
const success = () => {
|
|
7390
|
+
document.documentElement.setAttribute(
|
|
7391
|
+
"data-darkreader-mode",
|
|
7392
|
+
"dynamic"
|
|
7393
|
+
);
|
|
7394
|
+
document.documentElement.setAttribute(
|
|
7395
|
+
"data-darkreader-scheme",
|
|
7396
|
+
theme.mode ? "dark" : "dimmed"
|
|
7397
|
+
);
|
|
7398
|
+
createThemeAndWatchForUpdates();
|
|
7399
|
+
};
|
|
7400
|
+
const failure = () => {
|
|
7370
7401
|
removeDynamicTheme();
|
|
7371
|
-
|
|
7402
|
+
};
|
|
7403
|
+
if (isAnotherDarkReaderInstanceActive()) {
|
|
7404
|
+
interceptOldScript({
|
|
7405
|
+
success,
|
|
7406
|
+
failure
|
|
7407
|
+
});
|
|
7408
|
+
} else {
|
|
7409
|
+
success();
|
|
7372
7410
|
}
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
);
|
|
7377
|
-
document.documentElement.setAttribute(
|
|
7378
|
-
"data-darkreader-scheme",
|
|
7379
|
-
theme.mode ? "dark" : "dimmed"
|
|
7380
|
-
);
|
|
7381
|
-
createThemeAndWatchForUpdates();
|
|
7411
|
+
};
|
|
7412
|
+
if (document.head) {
|
|
7413
|
+
ready();
|
|
7382
7414
|
} else {
|
|
7383
7415
|
if (!isFirefox) {
|
|
7384
7416
|
const fallbackStyle = createOrUpdateStyle(
|
|
@@ -7392,11 +7424,7 @@
|
|
|
7392
7424
|
const headObserver = new MutationObserver(() => {
|
|
7393
7425
|
if (document.head) {
|
|
7394
7426
|
headObserver.disconnect();
|
|
7395
|
-
|
|
7396
|
-
removeDynamicTheme();
|
|
7397
|
-
return;
|
|
7398
|
-
}
|
|
7399
|
-
createThemeAndWatchForUpdates();
|
|
7427
|
+
ready();
|
|
7400
7428
|
}
|
|
7401
7429
|
});
|
|
7402
7430
|
headObserver.observe(document, {childList: true, subtree: true});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "darkreader",
|
|
3
|
-
"version": "4.9.
|
|
3
|
+
"version": "4.9.86",
|
|
4
4
|
"description": "Dark mode for every website",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"api": "node --max-old-space-size=3072 tasks/cli.js build --api",
|
|
@@ -59,16 +59,16 @@
|
|
|
59
59
|
"@rollup/plugin-node-resolve": "15.2.3",
|
|
60
60
|
"@rollup/plugin-replace": "5.0.5",
|
|
61
61
|
"@rollup/plugin-typescript": "11.1.6",
|
|
62
|
-
"@types/chrome": "0.0.
|
|
62
|
+
"@types/chrome": "0.0.268",
|
|
63
63
|
"@types/eslint": "8.56.10",
|
|
64
64
|
"@types/jasmine": "5.1.4",
|
|
65
65
|
"@types/jest": "29.5.12",
|
|
66
66
|
"@types/karma": "6.3.8",
|
|
67
67
|
"@types/karma-coverage": "2.0.3",
|
|
68
|
-
"@types/node": "20.12.
|
|
68
|
+
"@types/node": "20.12.12",
|
|
69
69
|
"@types/ws": "8.5.10",
|
|
70
|
-
"@typescript-eslint/eslint-plugin": "7.
|
|
71
|
-
"@typescript-eslint/parser": "7.
|
|
70
|
+
"@typescript-eslint/eslint-plugin": "7.9.0",
|
|
71
|
+
"@typescript-eslint/parser": "7.9.0",
|
|
72
72
|
"chokidar": "3.6.0",
|
|
73
73
|
"eslint": "8.57.0",
|
|
74
74
|
"eslint-plugin-compat": "4.2.0",
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
"less": "4.2.0",
|
|
90
90
|
"malevic": "0.20.1",
|
|
91
91
|
"prettier": "3.2.5",
|
|
92
|
-
"puppeteer-core": "22.
|
|
93
|
-
"rollup": "4.17.
|
|
92
|
+
"puppeteer-core": "22.8.2",
|
|
93
|
+
"rollup": "4.17.2",
|
|
94
94
|
"rollup-plugin-istanbul": "5.0.0",
|
|
95
95
|
"ts-jest": "29.1.2",
|
|
96
96
|
"tslib": "2.6.2",
|