darkreader 4.9.108 → 4.9.112
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/README.md +1 -1
- package/darkreader.js +90 -64
- package/darkreader.mjs +85 -64
- package/package.json +24 -23
package/README.md
CHANGED
|
@@ -181,7 +181,7 @@ For Dark Reader, the option "Run on sites with restrictions" is not shown becaus
|
|
|
181
181
|
|
|
182
182
|
The fact that it is a Recommended extension means that it meets the "highest standards of security, functionality, and user experience". The quarantined domains are only related to extension security. Because Dark Reader is considered secure by Mozilla, that option is not shown, meaning **it will always run even on quarantined domains** (but will still obey the "restricted domains" list if it is not empty).
|
|
183
183
|
|
|
184
|
-
Regarding quarantined domains specifically, there is this [comment from Firefox's source code
|
|
184
|
+
Regarding quarantined domains specifically, there is this [comment from Firefox's source code](https://searchfox.org/mozilla-central/rev/1838f847aa3bf909c3d34a94a8f0cd7e37fca086/toolkit/components/extensions/Extension.sys.mjs#3470-3471):
|
|
185
185
|
|
|
186
186
|
```
|
|
187
187
|
// Privileged extensions and any extensions with a recommendation state are
|
package/darkreader.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Dark Reader v4.9.
|
|
2
|
+
* Dark Reader v4.9.112
|
|
3
3
|
* https://darkreader.org/
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -366,7 +366,6 @@
|
|
|
366
366
|
darkColorScheme: "Default",
|
|
367
367
|
immediateModify: false
|
|
368
368
|
};
|
|
369
|
-
if (__PLUS__);
|
|
370
369
|
const filterModeSites = [
|
|
371
370
|
"*.officeapps.live.com",
|
|
372
371
|
"*.sharepoint.com",
|
|
@@ -2110,22 +2109,6 @@
|
|
|
2110
2109
|
return null;
|
|
2111
2110
|
}
|
|
2112
2111
|
|
|
2113
|
-
function getBackgroundPoles(_theme) {
|
|
2114
|
-
return ["", ""];
|
|
2115
|
-
}
|
|
2116
|
-
function getTextPoles(_theme) {
|
|
2117
|
-
return ["", ""];
|
|
2118
|
-
}
|
|
2119
|
-
function modifyBgColorExtended({h, s, l, a}, _pole1, _pole2) {
|
|
2120
|
-
return {h, s, l, a};
|
|
2121
|
-
}
|
|
2122
|
-
function modifyFgColorExtended({h, s, l, a}, _pole1, _pole2) {
|
|
2123
|
-
return {h, s, l, a};
|
|
2124
|
-
}
|
|
2125
|
-
function modifyLightSchemeColorExtended({h, s, l, a}, _pole1, _pole2) {
|
|
2126
|
-
return {h, s, l, a};
|
|
2127
|
-
}
|
|
2128
|
-
|
|
2129
2112
|
let variablesSheet;
|
|
2130
2113
|
const registeredColors = new Map();
|
|
2131
2114
|
function registerVariablesSheet(sheet) {
|
|
@@ -2350,28 +2333,8 @@
|
|
|
2350
2333
|
}
|
|
2351
2334
|
function _modifyBackgroundColor(rgb, theme) {
|
|
2352
2335
|
if (theme.mode === 0) {
|
|
2353
|
-
if (__PLUS__) {
|
|
2354
|
-
const poles = getBackgroundPoles();
|
|
2355
|
-
return modifyColorWithCache(
|
|
2356
|
-
rgb,
|
|
2357
|
-
theme,
|
|
2358
|
-
modifyLightSchemeColorExtended,
|
|
2359
|
-
poles[0],
|
|
2360
|
-
poles[1]
|
|
2361
|
-
);
|
|
2362
|
-
}
|
|
2363
2336
|
return modifyLightSchemeColor(rgb, theme);
|
|
2364
2337
|
}
|
|
2365
|
-
if (__PLUS__) {
|
|
2366
|
-
const poles = getBackgroundPoles();
|
|
2367
|
-
return modifyColorWithCache(
|
|
2368
|
-
rgb,
|
|
2369
|
-
theme,
|
|
2370
|
-
modifyBgColorExtended,
|
|
2371
|
-
poles[0],
|
|
2372
|
-
poles[1]
|
|
2373
|
-
);
|
|
2374
|
-
}
|
|
2375
2338
|
const pole = getBgPole(theme);
|
|
2376
2339
|
return modifyColorWithCache(rgb, theme, modifyBgHSL, pole);
|
|
2377
2340
|
}
|
|
@@ -2429,28 +2392,8 @@
|
|
|
2429
2392
|
}
|
|
2430
2393
|
function _modifyForegroundColor(rgb, theme) {
|
|
2431
2394
|
if (theme.mode === 0) {
|
|
2432
|
-
if (__PLUS__) {
|
|
2433
|
-
const poles = getTextPoles();
|
|
2434
|
-
return modifyColorWithCache(
|
|
2435
|
-
rgb,
|
|
2436
|
-
theme,
|
|
2437
|
-
modifyLightSchemeColorExtended,
|
|
2438
|
-
poles[0],
|
|
2439
|
-
poles[1]
|
|
2440
|
-
);
|
|
2441
|
-
}
|
|
2442
2395
|
return modifyLightSchemeColor(rgb, theme);
|
|
2443
2396
|
}
|
|
2444
|
-
if (__PLUS__) {
|
|
2445
|
-
const poles = getTextPoles();
|
|
2446
|
-
return modifyColorWithCache(
|
|
2447
|
-
rgb,
|
|
2448
|
-
theme,
|
|
2449
|
-
modifyFgColorExtended,
|
|
2450
|
-
poles[0],
|
|
2451
|
-
poles[1]
|
|
2452
|
-
);
|
|
2453
|
-
}
|
|
2454
2397
|
const pole = getFgPole(theme);
|
|
2455
2398
|
return modifyColorWithCache(rgb, theme, modifyFgHSL, pole);
|
|
2456
2399
|
}
|
|
@@ -4083,10 +4026,7 @@
|
|
|
4083
4026
|
};
|
|
4084
4027
|
const modified = modify();
|
|
4085
4028
|
if (unknownVars.size > 0) {
|
|
4086
|
-
|
|
4087
|
-
/^var\(.*?, ((var\(--darkreader-bg--.*\))|(#[0-9A-Fa-f]+)|([a-z]+)|(rgba?\(.+\))|(hsla?\(.+\)))\)$/
|
|
4088
|
-
);
|
|
4089
|
-
if (isFallbackResolved) {
|
|
4029
|
+
if (isFallbackResolved(modified)) {
|
|
4090
4030
|
return modified;
|
|
4091
4031
|
}
|
|
4092
4032
|
return new Promise((resolve) => {
|
|
@@ -4485,6 +4425,43 @@
|
|
|
4485
4425
|
value.match(/^(((\d{1,3})|(var\([\-_A-Za-z0-9]+\))),?\s*?){3}$/)
|
|
4486
4426
|
);
|
|
4487
4427
|
}
|
|
4428
|
+
function isFallbackResolved(modified) {
|
|
4429
|
+
if (modified.startsWith("var(") && modified.endsWith(")")) {
|
|
4430
|
+
const hasNestedBrackets = modified.endsWith("))");
|
|
4431
|
+
const hasDoubleNestedBrackets = modified.endsWith(")))");
|
|
4432
|
+
const lastOpenBracketIndex = hasNestedBrackets
|
|
4433
|
+
? modified.lastIndexOf("(")
|
|
4434
|
+
: -1;
|
|
4435
|
+
const firstOpenBracketIndex = hasDoubleNestedBrackets
|
|
4436
|
+
? modified.lastIndexOf("(", lastOpenBracketIndex - 1)
|
|
4437
|
+
: lastOpenBracketIndex;
|
|
4438
|
+
const commaIndex = modified.lastIndexOf(
|
|
4439
|
+
",",
|
|
4440
|
+
hasNestedBrackets ? firstOpenBracketIndex : modified.length
|
|
4441
|
+
);
|
|
4442
|
+
if (commaIndex < 0 || modified[commaIndex + 1] !== " ") {
|
|
4443
|
+
return false;
|
|
4444
|
+
}
|
|
4445
|
+
const fallback = modified.slice(
|
|
4446
|
+
commaIndex + 2,
|
|
4447
|
+
modified.length - 1
|
|
4448
|
+
);
|
|
4449
|
+
if (hasNestedBrackets) {
|
|
4450
|
+
return (
|
|
4451
|
+
fallback.startsWith("rgb(") ||
|
|
4452
|
+
fallback.startsWith("rgba(") ||
|
|
4453
|
+
fallback.startsWith("hsl(") ||
|
|
4454
|
+
fallback.startsWith("hsla(") ||
|
|
4455
|
+
fallback.startsWith("var(--darkreader-bg--") ||
|
|
4456
|
+
fallback.match(
|
|
4457
|
+
/^var\(--darkreader-background-[0-9a-z]+, #[0-9a-z]+\)$/
|
|
4458
|
+
)
|
|
4459
|
+
);
|
|
4460
|
+
}
|
|
4461
|
+
return fallback.match(/^(#[0-9a-f]+)|([a-z]+)$/i);
|
|
4462
|
+
}
|
|
4463
|
+
return false;
|
|
4464
|
+
}
|
|
4488
4465
|
const textColorProps = [
|
|
4489
4466
|
"color",
|
|
4490
4467
|
"caret-color",
|
|
@@ -5188,14 +5165,38 @@
|
|
|
5188
5165
|
return {render, destroy, commands};
|
|
5189
5166
|
}
|
|
5190
5167
|
|
|
5191
|
-
const hostsBreakingOnStylePosition = [
|
|
5168
|
+
const hostsBreakingOnStylePosition = [
|
|
5169
|
+
"www.berlingske.dk",
|
|
5170
|
+
"www.bloomberg.com",
|
|
5171
|
+
"www.diffusioneshop.com",
|
|
5172
|
+
"www.weekendavisen.dk",
|
|
5173
|
+
"zhale.me"
|
|
5174
|
+
];
|
|
5192
5175
|
const mode = hostsBreakingOnStylePosition.includes(location.hostname)
|
|
5193
5176
|
? "away"
|
|
5194
5177
|
: "next";
|
|
5195
5178
|
function getStyleInjectionMode() {
|
|
5196
5179
|
return mode;
|
|
5197
5180
|
}
|
|
5181
|
+
const stylesWaitingForBody = new Set();
|
|
5182
|
+
let bodyObserver;
|
|
5198
5183
|
function injectStyleAway(styleElement) {
|
|
5184
|
+
if (!document.body) {
|
|
5185
|
+
stylesWaitingForBody.add(styleElement);
|
|
5186
|
+
if (!bodyObserver) {
|
|
5187
|
+
bodyObserver = new MutationObserver(() => {
|
|
5188
|
+
if (document.body) {
|
|
5189
|
+
bodyObserver.disconnect();
|
|
5190
|
+
bodyObserver = null;
|
|
5191
|
+
stylesWaitingForBody.forEach((el) =>
|
|
5192
|
+
injectStyleAway(el)
|
|
5193
|
+
);
|
|
5194
|
+
stylesWaitingForBody.clear();
|
|
5195
|
+
}
|
|
5196
|
+
});
|
|
5197
|
+
}
|
|
5198
|
+
return;
|
|
5199
|
+
}
|
|
5199
5200
|
let container = document.body.querySelector(
|
|
5200
5201
|
".darkreader-style-container"
|
|
5201
5202
|
);
|
|
@@ -5205,9 +5206,32 @@
|
|
|
5205
5206
|
container.classList.add("darkreader-style-container");
|
|
5206
5207
|
container.style.display = "none";
|
|
5207
5208
|
document.body.append(container);
|
|
5209
|
+
containerObserver = new MutationObserver(() => {
|
|
5210
|
+
if (container?.nextElementSibling != null) {
|
|
5211
|
+
container
|
|
5212
|
+
.querySelectorAll(".darkreader--sync")
|
|
5213
|
+
.forEach((el) => {
|
|
5214
|
+
if (el.sheet.cssRules.length > 0) {
|
|
5215
|
+
let cssText = "";
|
|
5216
|
+
for (const rule of el.sheet.cssRules) {
|
|
5217
|
+
cssText += rule.cssText;
|
|
5218
|
+
}
|
|
5219
|
+
el.textContent = cssText;
|
|
5220
|
+
}
|
|
5221
|
+
});
|
|
5222
|
+
document.body.append(container);
|
|
5223
|
+
}
|
|
5224
|
+
});
|
|
5225
|
+
containerObserver.observe(document.body, {childList: true});
|
|
5208
5226
|
}
|
|
5209
5227
|
container.append(styleElement);
|
|
5210
5228
|
}
|
|
5229
|
+
let containerObserver;
|
|
5230
|
+
function removeStyleContainer() {
|
|
5231
|
+
bodyObserver?.disconnect();
|
|
5232
|
+
containerObserver?.disconnect();
|
|
5233
|
+
document.querySelector(".darkreader-style-container")?.remove();
|
|
5234
|
+
}
|
|
5211
5235
|
|
|
5212
5236
|
const overrides = {
|
|
5213
5237
|
"background-color": {
|
|
@@ -6349,7 +6373,8 @@
|
|
|
6349
6373
|
force,
|
|
6350
6374
|
isAsyncCancelled
|
|
6351
6375
|
});
|
|
6352
|
-
isOverrideEmpty =
|
|
6376
|
+
isOverrideEmpty =
|
|
6377
|
+
!syncStyle.sheet || syncStyle.sheet.cssRules.length === 0;
|
|
6353
6378
|
if (sheetModifier.shouldRebuildStyle()) {
|
|
6354
6379
|
addReadyStateCompleteListener(() => update());
|
|
6355
6380
|
}
|
|
@@ -8141,6 +8166,7 @@
|
|
|
8141
8166
|
loadingStyles.clear();
|
|
8142
8167
|
cleanLoadingLinks();
|
|
8143
8168
|
forEach(document.querySelectorAll(".darkreader"), removeNode);
|
|
8169
|
+
removeStyleContainer();
|
|
8144
8170
|
adoptedStyleManagers.forEach((manager) => manager.destroy());
|
|
8145
8171
|
adoptedStyleManagers.splice(0);
|
|
8146
8172
|
adoptedStyleFallbacks.forEach((fallback) => fallback.destroy());
|
package/darkreader.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Dark Reader v4.9.
|
|
2
|
+
* Dark Reader v4.9.112
|
|
3
3
|
* https://darkreader.org/
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -349,7 +349,6 @@ const DEFAULT_THEME = {
|
|
|
349
349
|
darkColorScheme: "Default",
|
|
350
350
|
immediateModify: false
|
|
351
351
|
};
|
|
352
|
-
if (__PLUS__);
|
|
353
352
|
const filterModeSites = [
|
|
354
353
|
"*.officeapps.live.com",
|
|
355
354
|
"*.sharepoint.com",
|
|
@@ -2068,22 +2067,6 @@ function getSheetScope(sheet) {
|
|
|
2068
2067
|
return null;
|
|
2069
2068
|
}
|
|
2070
2069
|
|
|
2071
|
-
function getBackgroundPoles(_theme) {
|
|
2072
|
-
return ["", ""];
|
|
2073
|
-
}
|
|
2074
|
-
function getTextPoles(_theme) {
|
|
2075
|
-
return ["", ""];
|
|
2076
|
-
}
|
|
2077
|
-
function modifyBgColorExtended({h, s, l, a}, _pole1, _pole2) {
|
|
2078
|
-
return {h, s, l, a};
|
|
2079
|
-
}
|
|
2080
|
-
function modifyFgColorExtended({h, s, l, a}, _pole1, _pole2) {
|
|
2081
|
-
return {h, s, l, a};
|
|
2082
|
-
}
|
|
2083
|
-
function modifyLightSchemeColorExtended({h, s, l, a}, _pole1, _pole2) {
|
|
2084
|
-
return {h, s, l, a};
|
|
2085
|
-
}
|
|
2086
|
-
|
|
2087
2070
|
let variablesSheet;
|
|
2088
2071
|
const registeredColors = new Map();
|
|
2089
2072
|
function registerVariablesSheet(sheet) {
|
|
@@ -2295,28 +2278,8 @@ function modifyBgHSL({h, s, l, a}, pole) {
|
|
|
2295
2278
|
}
|
|
2296
2279
|
function _modifyBackgroundColor(rgb, theme) {
|
|
2297
2280
|
if (theme.mode === 0) {
|
|
2298
|
-
if (__PLUS__) {
|
|
2299
|
-
const poles = getBackgroundPoles();
|
|
2300
|
-
return modifyColorWithCache(
|
|
2301
|
-
rgb,
|
|
2302
|
-
theme,
|
|
2303
|
-
modifyLightSchemeColorExtended,
|
|
2304
|
-
poles[0],
|
|
2305
|
-
poles[1]
|
|
2306
|
-
);
|
|
2307
|
-
}
|
|
2308
2281
|
return modifyLightSchemeColor(rgb, theme);
|
|
2309
2282
|
}
|
|
2310
|
-
if (__PLUS__) {
|
|
2311
|
-
const poles = getBackgroundPoles();
|
|
2312
|
-
return modifyColorWithCache(
|
|
2313
|
-
rgb,
|
|
2314
|
-
theme,
|
|
2315
|
-
modifyBgColorExtended,
|
|
2316
|
-
poles[0],
|
|
2317
|
-
poles[1]
|
|
2318
|
-
);
|
|
2319
|
-
}
|
|
2320
2283
|
const pole = getBgPole(theme);
|
|
2321
2284
|
return modifyColorWithCache(rgb, theme, modifyBgHSL, pole);
|
|
2322
2285
|
}
|
|
@@ -2370,28 +2333,8 @@ function modifyFgHSL({h, s, l, a}, pole) {
|
|
|
2370
2333
|
}
|
|
2371
2334
|
function _modifyForegroundColor(rgb, theme) {
|
|
2372
2335
|
if (theme.mode === 0) {
|
|
2373
|
-
if (__PLUS__) {
|
|
2374
|
-
const poles = getTextPoles();
|
|
2375
|
-
return modifyColorWithCache(
|
|
2376
|
-
rgb,
|
|
2377
|
-
theme,
|
|
2378
|
-
modifyLightSchemeColorExtended,
|
|
2379
|
-
poles[0],
|
|
2380
|
-
poles[1]
|
|
2381
|
-
);
|
|
2382
|
-
}
|
|
2383
2336
|
return modifyLightSchemeColor(rgb, theme);
|
|
2384
2337
|
}
|
|
2385
|
-
if (__PLUS__) {
|
|
2386
|
-
const poles = getTextPoles();
|
|
2387
|
-
return modifyColorWithCache(
|
|
2388
|
-
rgb,
|
|
2389
|
-
theme,
|
|
2390
|
-
modifyFgColorExtended,
|
|
2391
|
-
poles[0],
|
|
2392
|
-
poles[1]
|
|
2393
|
-
);
|
|
2394
|
-
}
|
|
2395
2338
|
const pole = getFgPole(theme);
|
|
2396
2339
|
return modifyColorWithCache(rgb, theme, modifyFgHSL, pole);
|
|
2397
2340
|
}
|
|
@@ -3953,10 +3896,7 @@ class VariablesStore {
|
|
|
3953
3896
|
};
|
|
3954
3897
|
const modified = modify();
|
|
3955
3898
|
if (unknownVars.size > 0) {
|
|
3956
|
-
|
|
3957
|
-
/^var\(.*?, ((var\(--darkreader-bg--.*\))|(#[0-9A-Fa-f]+)|([a-z]+)|(rgba?\(.+\))|(hsla?\(.+\)))\)$/
|
|
3958
|
-
);
|
|
3959
|
-
if (isFallbackResolved) {
|
|
3899
|
+
if (isFallbackResolved(modified)) {
|
|
3960
3900
|
return modified;
|
|
3961
3901
|
}
|
|
3962
3902
|
return new Promise((resolve) => {
|
|
@@ -4347,6 +4287,40 @@ function isConstructedColorVar(value) {
|
|
|
4347
4287
|
value.match(/^(((\d{1,3})|(var\([\-_A-Za-z0-9]+\))),?\s*?){3}$/)
|
|
4348
4288
|
);
|
|
4349
4289
|
}
|
|
4290
|
+
function isFallbackResolved(modified) {
|
|
4291
|
+
if (modified.startsWith("var(") && modified.endsWith(")")) {
|
|
4292
|
+
const hasNestedBrackets = modified.endsWith("))");
|
|
4293
|
+
const hasDoubleNestedBrackets = modified.endsWith(")))");
|
|
4294
|
+
const lastOpenBracketIndex = hasNestedBrackets
|
|
4295
|
+
? modified.lastIndexOf("(")
|
|
4296
|
+
: -1;
|
|
4297
|
+
const firstOpenBracketIndex = hasDoubleNestedBrackets
|
|
4298
|
+
? modified.lastIndexOf("(", lastOpenBracketIndex - 1)
|
|
4299
|
+
: lastOpenBracketIndex;
|
|
4300
|
+
const commaIndex = modified.lastIndexOf(
|
|
4301
|
+
",",
|
|
4302
|
+
hasNestedBrackets ? firstOpenBracketIndex : modified.length
|
|
4303
|
+
);
|
|
4304
|
+
if (commaIndex < 0 || modified[commaIndex + 1] !== " ") {
|
|
4305
|
+
return false;
|
|
4306
|
+
}
|
|
4307
|
+
const fallback = modified.slice(commaIndex + 2, modified.length - 1);
|
|
4308
|
+
if (hasNestedBrackets) {
|
|
4309
|
+
return (
|
|
4310
|
+
fallback.startsWith("rgb(") ||
|
|
4311
|
+
fallback.startsWith("rgba(") ||
|
|
4312
|
+
fallback.startsWith("hsl(") ||
|
|
4313
|
+
fallback.startsWith("hsla(") ||
|
|
4314
|
+
fallback.startsWith("var(--darkreader-bg--") ||
|
|
4315
|
+
fallback.match(
|
|
4316
|
+
/^var\(--darkreader-background-[0-9a-z]+, #[0-9a-z]+\)$/
|
|
4317
|
+
)
|
|
4318
|
+
);
|
|
4319
|
+
}
|
|
4320
|
+
return fallback.match(/^(#[0-9a-f]+)|([a-z]+)$/i);
|
|
4321
|
+
}
|
|
4322
|
+
return false;
|
|
4323
|
+
}
|
|
4350
4324
|
const textColorProps = [
|
|
4351
4325
|
"color",
|
|
4352
4326
|
"caret-color",
|
|
@@ -5040,14 +5014,36 @@ function createAdoptedStyleSheetFallback() {
|
|
|
5040
5014
|
return {render, destroy, commands};
|
|
5041
5015
|
}
|
|
5042
5016
|
|
|
5043
|
-
const hostsBreakingOnStylePosition = [
|
|
5017
|
+
const hostsBreakingOnStylePosition = [
|
|
5018
|
+
"www.berlingske.dk",
|
|
5019
|
+
"www.bloomberg.com",
|
|
5020
|
+
"www.diffusioneshop.com",
|
|
5021
|
+
"www.weekendavisen.dk",
|
|
5022
|
+
"zhale.me"
|
|
5023
|
+
];
|
|
5044
5024
|
const mode = hostsBreakingOnStylePosition.includes(location.hostname)
|
|
5045
5025
|
? "away"
|
|
5046
5026
|
: "next";
|
|
5047
5027
|
function getStyleInjectionMode() {
|
|
5048
5028
|
return mode;
|
|
5049
5029
|
}
|
|
5030
|
+
const stylesWaitingForBody = new Set();
|
|
5031
|
+
let bodyObserver;
|
|
5050
5032
|
function injectStyleAway(styleElement) {
|
|
5033
|
+
if (!document.body) {
|
|
5034
|
+
stylesWaitingForBody.add(styleElement);
|
|
5035
|
+
if (!bodyObserver) {
|
|
5036
|
+
bodyObserver = new MutationObserver(() => {
|
|
5037
|
+
if (document.body) {
|
|
5038
|
+
bodyObserver.disconnect();
|
|
5039
|
+
bodyObserver = null;
|
|
5040
|
+
stylesWaitingForBody.forEach((el) => injectStyleAway(el));
|
|
5041
|
+
stylesWaitingForBody.clear();
|
|
5042
|
+
}
|
|
5043
|
+
});
|
|
5044
|
+
}
|
|
5045
|
+
return;
|
|
5046
|
+
}
|
|
5051
5047
|
let container = document.body.querySelector(".darkreader-style-container");
|
|
5052
5048
|
if (!container) {
|
|
5053
5049
|
container = document.createElement("div");
|
|
@@ -5055,9 +5051,32 @@ function injectStyleAway(styleElement) {
|
|
|
5055
5051
|
container.classList.add("darkreader-style-container");
|
|
5056
5052
|
container.style.display = "none";
|
|
5057
5053
|
document.body.append(container);
|
|
5054
|
+
containerObserver = new MutationObserver(() => {
|
|
5055
|
+
if (container?.nextElementSibling != null) {
|
|
5056
|
+
container
|
|
5057
|
+
.querySelectorAll(".darkreader--sync")
|
|
5058
|
+
.forEach((el) => {
|
|
5059
|
+
if (el.sheet.cssRules.length > 0) {
|
|
5060
|
+
let cssText = "";
|
|
5061
|
+
for (const rule of el.sheet.cssRules) {
|
|
5062
|
+
cssText += rule.cssText;
|
|
5063
|
+
}
|
|
5064
|
+
el.textContent = cssText;
|
|
5065
|
+
}
|
|
5066
|
+
});
|
|
5067
|
+
document.body.append(container);
|
|
5068
|
+
}
|
|
5069
|
+
});
|
|
5070
|
+
containerObserver.observe(document.body, {childList: true});
|
|
5058
5071
|
}
|
|
5059
5072
|
container.append(styleElement);
|
|
5060
5073
|
}
|
|
5074
|
+
let containerObserver;
|
|
5075
|
+
function removeStyleContainer() {
|
|
5076
|
+
bodyObserver?.disconnect();
|
|
5077
|
+
containerObserver?.disconnect();
|
|
5078
|
+
document.querySelector(".darkreader-style-container")?.remove();
|
|
5079
|
+
}
|
|
5061
5080
|
|
|
5062
5081
|
const overrides = {
|
|
5063
5082
|
"background-color": {
|
|
@@ -6153,7 +6172,8 @@ function manageStyle(element, {update, loadingStart, loadingEnd}) {
|
|
|
6153
6172
|
force,
|
|
6154
6173
|
isAsyncCancelled
|
|
6155
6174
|
});
|
|
6156
|
-
isOverrideEmpty =
|
|
6175
|
+
isOverrideEmpty =
|
|
6176
|
+
!syncStyle.sheet || syncStyle.sheet.cssRules.length === 0;
|
|
6157
6177
|
if (sheetModifier.shouldRebuildStyle()) {
|
|
6158
6178
|
addReadyStateCompleteListener(() => update());
|
|
6159
6179
|
}
|
|
@@ -7887,6 +7907,7 @@ function removeDynamicTheme() {
|
|
|
7887
7907
|
loadingStyles.clear();
|
|
7888
7908
|
cleanLoadingLinks();
|
|
7889
7909
|
forEach(document.querySelectorAll(".darkreader"), removeNode);
|
|
7910
|
+
removeStyleContainer();
|
|
7890
7911
|
adoptedStyleManagers.forEach((manager) => manager.destroy());
|
|
7891
7912
|
adoptedStyleManagers.splice(0);
|
|
7892
7913
|
adoptedStyleFallbacks.forEach((fallback) => fallback.destroy());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "darkreader",
|
|
3
|
-
"version": "4.9.
|
|
3
|
+
"version": "4.9.112",
|
|
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",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"test:chrome-mv3": "node tasks/cli.js build --debug --test --chrome-mv3 && jest --config=tests/browser/jest.config.chrome-mv3.mjs --runInBand",
|
|
27
27
|
"test:ci": "npm run test:unit",
|
|
28
28
|
"test:coverage": "jest --config=tests/unit/jest.config.mjs --coverage",
|
|
29
|
+
"test:edge": "node tasks/cli.js build --debug --test --plus && jest --config=tests/browser/jest.config.mjs --runInBand",
|
|
29
30
|
"test:firefox": "node tasks/cli.js build --debug --test --firefox-mv2 && jest --config=tests/browser/jest.config.firefox.mjs --runInBand",
|
|
30
31
|
"test:inject": "node --max-old-space-size=3072 node_modules/.bin/karma start ./tests/inject/karma.conf.cjs",
|
|
31
32
|
"test:inject:debug": "node --max-old-space-size=3072 node_modules/.bin/karma start ./tests/inject/karma.conf.cjs --debug",
|
|
@@ -65,28 +66,28 @@
|
|
|
65
66
|
"malevic": "0.20.2"
|
|
66
67
|
},
|
|
67
68
|
"devDependencies": {
|
|
68
|
-
"@eslint/compat": "1.
|
|
69
|
+
"@eslint/compat": "1.4.0",
|
|
69
70
|
"@eslint/eslintrc": "3.3.1",
|
|
70
|
-
"@eslint/js": "9.
|
|
71
|
-
"@rollup/plugin-node-resolve": "16.0.
|
|
71
|
+
"@eslint/js": "9.37.0",
|
|
72
|
+
"@rollup/plugin-node-resolve": "16.0.3",
|
|
72
73
|
"@rollup/plugin-replace": "6.0.2",
|
|
73
|
-
"@rollup/plugin-typescript": "12.1.
|
|
74
|
-
"@stylistic/eslint-plugin": "5.
|
|
75
|
-
"@types/chrome": "0.
|
|
74
|
+
"@rollup/plugin-typescript": "12.1.4",
|
|
75
|
+
"@stylistic/eslint-plugin": "5.4.0",
|
|
76
|
+
"@types/chrome": "0.1.24",
|
|
76
77
|
"@types/eslint": "9.6.1",
|
|
77
|
-
"@types/jasmine": "5.1.
|
|
78
|
+
"@types/jasmine": "5.1.10",
|
|
78
79
|
"@types/jest": "30.0.0",
|
|
79
80
|
"@types/karma": "6.3.9",
|
|
80
81
|
"@types/karma-coverage": "2.0.3",
|
|
81
|
-
"@types/node": "24.
|
|
82
|
+
"@types/node": "24.7.2",
|
|
82
83
|
"@types/ws": "8.18.1",
|
|
83
84
|
"chokidar": "4.0.3",
|
|
84
85
|
"eslint-plugin-compat": "6.0.2",
|
|
85
86
|
"eslint-plugin-import": "2.32.0",
|
|
86
|
-
"globals": "16.
|
|
87
|
-
"globby": "
|
|
88
|
-
"jasmine-core": "5.
|
|
89
|
-
"jest": "30.0
|
|
87
|
+
"globals": "16.4.0",
|
|
88
|
+
"globby": "15.0.0",
|
|
89
|
+
"jasmine-core": "5.12.0",
|
|
90
|
+
"jest": "30.2.0",
|
|
90
91
|
"jest-extended": "6.0.0",
|
|
91
92
|
"karma": "6.4.4",
|
|
92
93
|
"karma-chrome-launcher": "3.2.0",
|
|
@@ -96,20 +97,20 @@
|
|
|
96
97
|
"karma-rollup-preprocessor": "7.0.8",
|
|
97
98
|
"karma-safari-launcher": "1.0.0",
|
|
98
99
|
"karma-spec-reporter": "0.0.36",
|
|
99
|
-
"less": "4.
|
|
100
|
-
"prettier": "3.6.
|
|
101
|
-
"puppeteer-core": "24.
|
|
102
|
-
"rollup": "4.
|
|
100
|
+
"less": "4.4.2",
|
|
101
|
+
"prettier": "3.6.2",
|
|
102
|
+
"puppeteer-core": "24.24.1",
|
|
103
|
+
"rollup": "4.52.4",
|
|
103
104
|
"rollup-plugin-istanbul": "5.0.0",
|
|
104
|
-
"ts-jest": "29.4.
|
|
105
|
+
"ts-jest": "29.4.5",
|
|
105
106
|
"tslib": "2.8.1",
|
|
106
|
-
"typescript": "5.
|
|
107
|
-
"typescript-eslint": "8.
|
|
108
|
-
"ws": "8.18.
|
|
107
|
+
"typescript": "5.9.3",
|
|
108
|
+
"typescript-eslint": "8.46.1",
|
|
109
|
+
"ws": "8.18.3",
|
|
109
110
|
"yazl": "3.3.1"
|
|
110
111
|
},
|
|
111
112
|
"optionalDependencies": {
|
|
112
|
-
"@rollup/rollup-linux-x64-gnu": "4.
|
|
113
|
-
"@rollup/rollup-win32-x64-msvc": "4.
|
|
113
|
+
"@rollup/rollup-linux-x64-gnu": "4.52.4",
|
|
114
|
+
"@rollup/rollup-win32-x64-msvc": "4.52.4"
|
|
114
115
|
}
|
|
115
116
|
}
|