darkreader 4.9.39 → 4.9.40
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 +188 -36
- package/package.json +30 -29
package/darkreader.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Dark Reader v4.9.
|
|
2
|
+
* Dark Reader v4.9.40
|
|
3
3
|
* https://darkreader.org/
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
8
8
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
9
9
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.DarkReader = {}));
|
|
10
|
-
}(this, (function (exports) { 'use strict';
|
|
10
|
+
})(this, (function (exports) { 'use strict';
|
|
11
11
|
|
|
12
12
|
/*! *****************************************************************************
|
|
13
13
|
Copyright (c) Microsoft Corporation.
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
ar[i] = from[i];
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
return to.concat(ar || from);
|
|
112
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
var MessageType = {
|
|
@@ -337,7 +337,7 @@
|
|
|
337
337
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
338
338
|
args[_i] = arguments[_i];
|
|
339
339
|
}
|
|
340
|
-
sendMessage.apply(void 0, __spreadArray([], __read(args)));
|
|
340
|
+
sendMessage.apply(void 0, __spreadArray([], __read(args), false));
|
|
341
341
|
nativeSendMessage_1.apply(chrome.runtime, args);
|
|
342
342
|
};
|
|
343
343
|
}
|
|
@@ -354,12 +354,18 @@
|
|
|
354
354
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
355
355
|
args[_i] = arguments[_i];
|
|
356
356
|
}
|
|
357
|
-
addMessageListener
|
|
357
|
+
addMessageListener(args[0]);
|
|
358
358
|
nativeAddListener_1.apply(chrome.runtime.onMessage, args);
|
|
359
359
|
};
|
|
360
360
|
}
|
|
361
361
|
else {
|
|
362
|
-
chrome.runtime.onMessage.addListener =
|
|
362
|
+
chrome.runtime.onMessage.addListener = function () {
|
|
363
|
+
var args = [];
|
|
364
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
365
|
+
args[_i] = arguments[_i];
|
|
366
|
+
}
|
|
367
|
+
return addMessageListener(args[0]);
|
|
368
|
+
};
|
|
363
369
|
}
|
|
364
370
|
|
|
365
371
|
var ThemeEngines = {
|
|
@@ -397,6 +403,8 @@
|
|
|
397
403
|
scrollbarColor: isMacOS ? '' : 'auto',
|
|
398
404
|
selectionColor: 'auto',
|
|
399
405
|
styleSystemControls: true,
|
|
406
|
+
lightColorScheme: 'Default',
|
|
407
|
+
darkColorScheme: 'Default',
|
|
400
408
|
};
|
|
401
409
|
|
|
402
410
|
function isArrayLike(items) {
|
|
@@ -463,11 +471,11 @@
|
|
|
463
471
|
pending = true;
|
|
464
472
|
}
|
|
465
473
|
else {
|
|
466
|
-
callback.apply(void 0, __spreadArray([], __read(lastArgs)));
|
|
474
|
+
callback.apply(void 0, __spreadArray([], __read(lastArgs), false));
|
|
467
475
|
frameId = requestAnimationFrame(function () {
|
|
468
476
|
frameId = null;
|
|
469
477
|
if (pending) {
|
|
470
|
-
callback.apply(void 0, __spreadArray([], __read(lastArgs)));
|
|
478
|
+
callback.apply(void 0, __spreadArray([], __read(lastArgs), false));
|
|
471
479
|
pending = false;
|
|
472
480
|
}
|
|
473
481
|
});
|
|
@@ -687,6 +695,7 @@
|
|
|
687
695
|
if (n instanceof Element) {
|
|
688
696
|
if (n.isConnected) {
|
|
689
697
|
moves.add(n);
|
|
698
|
+
additions.delete(n);
|
|
690
699
|
}
|
|
691
700
|
else {
|
|
692
701
|
deletions.add(n);
|
|
@@ -694,7 +703,6 @@
|
|
|
694
703
|
}
|
|
695
704
|
});
|
|
696
705
|
});
|
|
697
|
-
moves.forEach(function (n) { return additions.delete(n); });
|
|
698
706
|
var duplicateAdditions = [];
|
|
699
707
|
var duplicateDeletions = [];
|
|
700
708
|
additions.forEach(function (node) {
|
|
@@ -805,6 +813,25 @@
|
|
|
805
813
|
var b = parseURL($base);
|
|
806
814
|
var a = parseURL($relative, b.href);
|
|
807
815
|
return a.href;
|
|
816
|
+
}
|
|
817
|
+
function isRelativeHrefOnAbsolutePath(href) {
|
|
818
|
+
if (href.startsWith('data:')) {
|
|
819
|
+
return true;
|
|
820
|
+
}
|
|
821
|
+
var url = parseURL(href);
|
|
822
|
+
var base = parseURL(location.href);
|
|
823
|
+
if (url.protocol !== base.protocol) {
|
|
824
|
+
return false;
|
|
825
|
+
}
|
|
826
|
+
if (url.hostname !== base.hostname) {
|
|
827
|
+
return false;
|
|
828
|
+
}
|
|
829
|
+
if (url.port !== base.port) {
|
|
830
|
+
return false;
|
|
831
|
+
}
|
|
832
|
+
var path = /.*\//.exec(url.pathname)[0];
|
|
833
|
+
var basePath = /.*\//.exec(base.pathname)[0];
|
|
834
|
+
return path === basePath;
|
|
808
835
|
}
|
|
809
836
|
|
|
810
837
|
function iterateCSSRules(rules, iterate, onMediaRuleError) {
|
|
@@ -1104,6 +1131,72 @@
|
|
|
1104
1131
|
a: 1
|
|
1105
1132
|
};
|
|
1106
1133
|
}
|
|
1134
|
+
var isCharDigit = function (char) { return char >= '0' && char <= '9'; };
|
|
1135
|
+
var getAmountOfDigits = function (number) { return Math.floor(Math.log10(number)) + 1; };
|
|
1136
|
+
function lowerCalcExpression(color) {
|
|
1137
|
+
var searchIndex = 0;
|
|
1138
|
+
var replaceBetweenIndices = function (start, end, replacement) {
|
|
1139
|
+
color = color.substring(0, start) + replacement + color.substring(end);
|
|
1140
|
+
};
|
|
1141
|
+
var getNumber = function () {
|
|
1142
|
+
var resultNumber = 0;
|
|
1143
|
+
for (var i = 1; i < 4; i++) {
|
|
1144
|
+
var char = color[searchIndex + i];
|
|
1145
|
+
if (char === ' ') {
|
|
1146
|
+
break;
|
|
1147
|
+
}
|
|
1148
|
+
if (isCharDigit(char)) {
|
|
1149
|
+
resultNumber *= 10;
|
|
1150
|
+
resultNumber += Number(char);
|
|
1151
|
+
}
|
|
1152
|
+
else {
|
|
1153
|
+
break;
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
var lenDigits = getAmountOfDigits(resultNumber);
|
|
1157
|
+
searchIndex += lenDigits;
|
|
1158
|
+
var possibleType = color[searchIndex + 1];
|
|
1159
|
+
if (possibleType !== '%') {
|
|
1160
|
+
return;
|
|
1161
|
+
}
|
|
1162
|
+
searchIndex++;
|
|
1163
|
+
return resultNumber;
|
|
1164
|
+
};
|
|
1165
|
+
while ((searchIndex = color.indexOf('calc(')) !== 0) {
|
|
1166
|
+
var startIndex = searchIndex;
|
|
1167
|
+
searchIndex += 4;
|
|
1168
|
+
var firstNumber = getNumber();
|
|
1169
|
+
if (!firstNumber) {
|
|
1170
|
+
break;
|
|
1171
|
+
}
|
|
1172
|
+
if (color[searchIndex + 1] !== ' ') {
|
|
1173
|
+
break;
|
|
1174
|
+
}
|
|
1175
|
+
searchIndex++;
|
|
1176
|
+
var operation = color[searchIndex + 1];
|
|
1177
|
+
if (operation !== '+' && operation !== '-') {
|
|
1178
|
+
break;
|
|
1179
|
+
}
|
|
1180
|
+
searchIndex++;
|
|
1181
|
+
if (color[searchIndex + 1] !== ' ') {
|
|
1182
|
+
break;
|
|
1183
|
+
}
|
|
1184
|
+
searchIndex++;
|
|
1185
|
+
var secondNumber = getNumber();
|
|
1186
|
+
if (!secondNumber) {
|
|
1187
|
+
break;
|
|
1188
|
+
}
|
|
1189
|
+
var replacement = void 0;
|
|
1190
|
+
if (operation === '+') {
|
|
1191
|
+
replacement = firstNumber + secondNumber + "%";
|
|
1192
|
+
}
|
|
1193
|
+
else {
|
|
1194
|
+
replacement = firstNumber - secondNumber + "%";
|
|
1195
|
+
}
|
|
1196
|
+
replaceBetweenIndices(startIndex, searchIndex + 2, replacement);
|
|
1197
|
+
}
|
|
1198
|
+
return color;
|
|
1199
|
+
}
|
|
1107
1200
|
var knownColors = new Map(Object.entries({
|
|
1108
1201
|
aliceblue: 0xf0f8ff,
|
|
1109
1202
|
antiquewhite: 0xfaebd7,
|
|
@@ -1840,7 +1933,7 @@
|
|
|
1840
1933
|
case 3:
|
|
1841
1934
|
error_1 = _a.sent();
|
|
1842
1935
|
reject(error_1);
|
|
1843
|
-
return [
|
|
1936
|
+
return [2];
|
|
1844
1937
|
case 4:
|
|
1845
1938
|
_a.trys.push([4, 6, , 7]);
|
|
1846
1939
|
return [4, urlToImage(dataURL)];
|
|
@@ -2161,7 +2254,7 @@
|
|
|
2161
2254
|
function getModifiedFallbackStyle(filter, _a) {
|
|
2162
2255
|
var strict = _a.strict;
|
|
2163
2256
|
var lines = [];
|
|
2164
|
-
lines.push("html, body, " + (strict ? 'body :not(iframe)' : 'body > :not(iframe)') + " {");
|
|
2257
|
+
lines.push("html, body, " + (strict ? 'body :not(iframe):not(div[style^="position:absolute;top:0;left:-"]' : 'body > :not(iframe)') + " {");
|
|
2165
2258
|
lines.push(" background-color: " + modifyBackgroundColor({ r: 255, g: 255, b: 255 }, filter) + " !important;");
|
|
2166
2259
|
lines.push(" border-color: " + modifyBorderColor({ r: 64, g: 64, b: 64 }, filter) + " !important;");
|
|
2167
2260
|
lines.push(" color: " + modifyForegroundColor({ r: 0, g: 0, b: 0 }, filter) + " !important;");
|
|
@@ -2182,6 +2275,9 @@
|
|
|
2182
2275
|
if (colorParseCache.has($color)) {
|
|
2183
2276
|
return colorParseCache.get($color);
|
|
2184
2277
|
}
|
|
2278
|
+
if ($color.includes('calc(')) {
|
|
2279
|
+
$color = lowerCalcExpression($color);
|
|
2280
|
+
}
|
|
2185
2281
|
var color = parse($color);
|
|
2186
2282
|
colorParseCache.set($color, color);
|
|
2187
2283
|
return color;
|
|
@@ -2406,10 +2502,11 @@
|
|
|
2406
2502
|
return null;
|
|
2407
2503
|
}
|
|
2408
2504
|
}
|
|
2409
|
-
function
|
|
2505
|
+
function getShadowModifierWithInfo(value) {
|
|
2410
2506
|
try {
|
|
2411
2507
|
var index_2 = 0;
|
|
2412
2508
|
var colorMatches_1 = getMatches(/(^|\s)(?!calc)([a-z]+\(.+?\)|#[0-9a-f]+|[a-z]+)(.*?(inset|outset)?($|,))/ig, value, 2);
|
|
2509
|
+
var notParsed_1 = 0;
|
|
2413
2510
|
var modifiers_2 = colorMatches_1.map(function (match, i) {
|
|
2414
2511
|
var prefixIndex = index_2;
|
|
2415
2512
|
var matchIndex = value.indexOf(match, index_2);
|
|
@@ -2417,17 +2514,32 @@
|
|
|
2417
2514
|
index_2 = matchEnd;
|
|
2418
2515
|
var rgb = tryParseColor(match);
|
|
2419
2516
|
if (!rgb) {
|
|
2517
|
+
notParsed_1++;
|
|
2420
2518
|
return function () { return value.substring(prefixIndex, matchEnd); };
|
|
2421
2519
|
}
|
|
2422
2520
|
return function (filter) { return "" + value.substring(prefixIndex, matchIndex) + modifyShadowColor(rgb, filter) + (i === colorMatches_1.length - 1 ? value.substring(matchEnd) : ''); };
|
|
2423
2521
|
});
|
|
2424
|
-
return function (filter) {
|
|
2522
|
+
return function (filter) {
|
|
2523
|
+
var modified = modifiers_2.map(function (modify) { return modify(filter); }).join('');
|
|
2524
|
+
return {
|
|
2525
|
+
matchesLength: colorMatches_1.length,
|
|
2526
|
+
unparseableMatchesLength: notParsed_1,
|
|
2527
|
+
result: modified,
|
|
2528
|
+
};
|
|
2529
|
+
};
|
|
2425
2530
|
}
|
|
2426
2531
|
catch (err) {
|
|
2427
2532
|
logWarn("Unable to parse shadow " + value, err);
|
|
2428
2533
|
return null;
|
|
2429
2534
|
}
|
|
2430
2535
|
}
|
|
2536
|
+
function getShadowModifier(value) {
|
|
2537
|
+
var shadowModifier = getShadowModifierWithInfo(value);
|
|
2538
|
+
if (!shadowModifier) {
|
|
2539
|
+
return null;
|
|
2540
|
+
}
|
|
2541
|
+
return function (theme) { return shadowModifier(theme).result; };
|
|
2542
|
+
}
|
|
2431
2543
|
function getVariableModifier(variablesStore, prop, value, rule, ignoredImgSelectors, isCancelled) {
|
|
2432
2544
|
return variablesStore.getModifierForVariable({
|
|
2433
2545
|
varName: prop,
|
|
@@ -2651,8 +2763,11 @@
|
|
|
2651
2763
|
return v;
|
|
2652
2764
|
}, function (fallback) { return tryModifyBgColor(fallback, theme); });
|
|
2653
2765
|
if (property === 'box-shadow') {
|
|
2654
|
-
var shadowModifier =
|
|
2655
|
-
|
|
2766
|
+
var shadowModifier = getShadowModifierWithInfo(variableReplaced);
|
|
2767
|
+
var modifiedShadow = shadowModifier(theme);
|
|
2768
|
+
if (modifiedShadow.unparseableMatchesLength !== modifiedShadow.matchesLength) {
|
|
2769
|
+
return modifiedShadow.result;
|
|
2770
|
+
}
|
|
2656
2771
|
}
|
|
2657
2772
|
return variableReplaced;
|
|
2658
2773
|
};
|
|
@@ -3201,7 +3316,7 @@
|
|
|
3201
3316
|
});
|
|
3202
3317
|
var attrObserver = new MutationObserver(function (mutations) {
|
|
3203
3318
|
if (timeoutId) {
|
|
3204
|
-
cache.push.apply(cache, __spreadArray([], __read(mutations)));
|
|
3319
|
+
cache.push.apply(cache, __spreadArray([], __read(mutations), false));
|
|
3205
3320
|
return;
|
|
3206
3321
|
}
|
|
3207
3322
|
attemptCount++;
|
|
@@ -3219,7 +3334,7 @@
|
|
|
3219
3334
|
cache = [];
|
|
3220
3335
|
handleAttributeMutations(attributeCache);
|
|
3221
3336
|
}, RETRY_TIMEOUT);
|
|
3222
|
-
cache.push.apply(cache, __spreadArray([], __read(mutations)));
|
|
3337
|
+
cache.push.apply(cache, __spreadArray([], __read(mutations), false));
|
|
3223
3338
|
return;
|
|
3224
3339
|
}
|
|
3225
3340
|
start = now;
|
|
@@ -3344,7 +3459,11 @@
|
|
|
3344
3459
|
}
|
|
3345
3460
|
else {
|
|
3346
3461
|
var overridenProp = normalizedPropList[property];
|
|
3347
|
-
if (overridenProp &&
|
|
3462
|
+
if (overridenProp &&
|
|
3463
|
+
(!element.style.getPropertyValue(overridenProp) && !element.hasAttribute(overridenProp))) {
|
|
3464
|
+
if (overridenProp === 'background-color' && element.hasAttribute('bgcolor')) {
|
|
3465
|
+
return;
|
|
3466
|
+
}
|
|
3348
3467
|
element.style.setProperty(property, '');
|
|
3349
3468
|
}
|
|
3350
3469
|
}
|
|
@@ -3573,7 +3692,7 @@
|
|
|
3573
3692
|
return { property: mod.property, value: mod.value, important: important, sourceValue: sourceValue, varKey: varKey };
|
|
3574
3693
|
});
|
|
3575
3694
|
var index = readyDeclarations.indexOf(oldDecs[0], initialIndex);
|
|
3576
|
-
readyDeclarations.splice.apply(readyDeclarations, __spreadArray([index, oldDecs.length], __read(readyVarDecs)));
|
|
3695
|
+
readyDeclarations.splice.apply(readyDeclarations, __spreadArray([index, oldDecs.length], __read(readyVarDecs), false));
|
|
3577
3696
|
oldDecs = readyVarDecs;
|
|
3578
3697
|
rebuildVarRule(varKey);
|
|
3579
3698
|
});
|
|
@@ -3709,14 +3828,20 @@
|
|
|
3709
3828
|
function containsCSSImport() {
|
|
3710
3829
|
return element instanceof HTMLStyleElement && element.textContent.trim().match(cssImportRegex);
|
|
3711
3830
|
}
|
|
3712
|
-
function
|
|
3831
|
+
function hasImports(cssRules, checkCrossOrigin) {
|
|
3713
3832
|
var result = false;
|
|
3714
3833
|
if (cssRules) {
|
|
3715
3834
|
var rule = void 0;
|
|
3716
3835
|
cssRulesLoop: for (var i = 0, len = cssRules.length; i < len; i++) {
|
|
3717
3836
|
rule = cssRules[i];
|
|
3718
3837
|
if (rule.href) {
|
|
3719
|
-
if (
|
|
3838
|
+
if (checkCrossOrigin) {
|
|
3839
|
+
if (rule.href.startsWith('http') && !rule.href.startsWith(location.origin)) {
|
|
3840
|
+
result = true;
|
|
3841
|
+
break cssRulesLoop;
|
|
3842
|
+
}
|
|
3843
|
+
}
|
|
3844
|
+
else {
|
|
3720
3845
|
result = true;
|
|
3721
3846
|
break cssRulesLoop;
|
|
3722
3847
|
}
|
|
@@ -3727,15 +3852,26 @@
|
|
|
3727
3852
|
}
|
|
3728
3853
|
function getRulesSync() {
|
|
3729
3854
|
if (corsCopy) {
|
|
3855
|
+
logInfo('[getRulesSync] Using cors-copy.');
|
|
3730
3856
|
return corsCopy.sheet.cssRules;
|
|
3731
3857
|
}
|
|
3732
3858
|
if (containsCSSImport()) {
|
|
3859
|
+
logInfo('[getRulesSync] CSSImport detected.');
|
|
3733
3860
|
return null;
|
|
3734
3861
|
}
|
|
3735
3862
|
var cssRules = safeGetSheetRules();
|
|
3736
|
-
if (
|
|
3863
|
+
if (element instanceof HTMLLinkElement &&
|
|
3864
|
+
!isRelativeHrefOnAbsolutePath(element.href) &&
|
|
3865
|
+
hasImports(cssRules, false)) {
|
|
3866
|
+
logInfo('[getRulesSync] CSSImportRule detected on non-local href.');
|
|
3737
3867
|
return null;
|
|
3738
3868
|
}
|
|
3869
|
+
if (hasImports(cssRules, true)) {
|
|
3870
|
+
logInfo('[getRulesSync] Cross-Origin CSSImportRule detected.');
|
|
3871
|
+
return null;
|
|
3872
|
+
}
|
|
3873
|
+
logInfo('[getRulesSync] Using cssRules.');
|
|
3874
|
+
!cssRules && logWarn('[getRulesSync] cssRules is null, trying again.');
|
|
3739
3875
|
return cssRules;
|
|
3740
3876
|
}
|
|
3741
3877
|
function insertStyle() {
|
|
@@ -3768,7 +3904,7 @@
|
|
|
3768
3904
|
var loadingLinkId = ++loadingLinkCounter;
|
|
3769
3905
|
function getRulesAsync() {
|
|
3770
3906
|
return __awaiter(this, void 0, void 0, function () {
|
|
3771
|
-
var cssText, cssBasePath, _a, cssRules, accessError, err_1,
|
|
3907
|
+
var cssText, cssBasePath, _a, cssRules, accessError, err_1, fullCSSText, err_2;
|
|
3772
3908
|
var _b;
|
|
3773
3909
|
return __generator(this, function (_c) {
|
|
3774
3910
|
switch (_c.label) {
|
|
@@ -3804,9 +3940,13 @@
|
|
|
3804
3940
|
}
|
|
3805
3941
|
_c.label = 5;
|
|
3806
3942
|
case 5:
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3943
|
+
if (cssRules) {
|
|
3944
|
+
if (isRelativeHrefOnAbsolutePath(element.href)) {
|
|
3945
|
+
return [2, cssRules];
|
|
3946
|
+
}
|
|
3947
|
+
else if (!hasImports(cssRules, false)) {
|
|
3948
|
+
return [2, cssRules];
|
|
3949
|
+
}
|
|
3810
3950
|
}
|
|
3811
3951
|
return [4, loadText(element.href)];
|
|
3812
3952
|
case 6:
|
|
@@ -3880,6 +4020,20 @@
|
|
|
3880
4020
|
return;
|
|
3881
4021
|
}
|
|
3882
4022
|
cancelAsyncOperations = false;
|
|
4023
|
+
function removeCSSRulesFromSheet(sheet) {
|
|
4024
|
+
try {
|
|
4025
|
+
if (sheet.replaceSync) {
|
|
4026
|
+
sheet.replaceSync('');
|
|
4027
|
+
return;
|
|
4028
|
+
}
|
|
4029
|
+
}
|
|
4030
|
+
catch (err) {
|
|
4031
|
+
logWarn('Could not use fastpath for removing rules from stylesheet', err);
|
|
4032
|
+
}
|
|
4033
|
+
for (var i = sheet.cssRules.length - 1; i >= 0; i--) {
|
|
4034
|
+
sheet.deleteRule(i);
|
|
4035
|
+
}
|
|
4036
|
+
}
|
|
3883
4037
|
function prepareOverridesSheet() {
|
|
3884
4038
|
if (!syncStyle) {
|
|
3885
4039
|
createSyncStyle();
|
|
@@ -3890,9 +4044,7 @@
|
|
|
3890
4044
|
syncStyle.textContent = '';
|
|
3891
4045
|
}
|
|
3892
4046
|
var sheet = syncStyle.sheet;
|
|
3893
|
-
|
|
3894
|
-
sheet.deleteRule(i);
|
|
3895
|
-
}
|
|
4047
|
+
removeCSSRulesFromSheet(sheet);
|
|
3896
4048
|
if (syncStylePositionWatcher) {
|
|
3897
4049
|
syncStylePositionWatcher.run();
|
|
3898
4050
|
}
|
|
@@ -4241,7 +4393,7 @@
|
|
|
4241
4393
|
return __generator(this, function (_a) {
|
|
4242
4394
|
return [2, new Promise(function (resolve) {
|
|
4243
4395
|
if (window.customElements && typeof customElements.whenDefined === 'function') {
|
|
4244
|
-
customElements.whenDefined(tag).then(resolve);
|
|
4396
|
+
customElements.whenDefined(tag).then(function () { return resolve(); });
|
|
4245
4397
|
}
|
|
4246
4398
|
else if (canOptimizeUsingProxy) {
|
|
4247
4399
|
resolvers.set(tag, resolve);
|
|
@@ -4431,7 +4583,7 @@
|
|
|
4431
4583
|
function createAdoptedStyleSheetOverride(node) {
|
|
4432
4584
|
var cancelAsyncOperations = false;
|
|
4433
4585
|
function injectSheet(sheet, override) {
|
|
4434
|
-
var newSheets = __spreadArray([], __read(node.adoptedStyleSheets));
|
|
4586
|
+
var newSheets = __spreadArray([], __read(node.adoptedStyleSheets), false);
|
|
4435
4587
|
var sheetIndex = newSheets.indexOf(sheet);
|
|
4436
4588
|
var existingIndex = newSheets.indexOf(override);
|
|
4437
4589
|
if (sheetIndex === existingIndex - 1) {
|
|
@@ -4445,7 +4597,7 @@
|
|
|
4445
4597
|
}
|
|
4446
4598
|
function destroy() {
|
|
4447
4599
|
cancelAsyncOperations = true;
|
|
4448
|
-
var newSheets = __spreadArray([], __read(node.adoptedStyleSheets));
|
|
4600
|
+
var newSheets = __spreadArray([], __read(node.adoptedStyleSheets), false);
|
|
4449
4601
|
node.adoptedStyleSheets.forEach(function (adoptedStyleSheet) {
|
|
4450
4602
|
if (overrideList.has(adoptedStyleSheet)) {
|
|
4451
4603
|
var existingIndex = newSheets.indexOf(adoptedStyleSheet);
|
|
@@ -4549,7 +4701,7 @@
|
|
|
4549
4701
|
}
|
|
4550
4702
|
function proxyDocumentStyleSheets() {
|
|
4551
4703
|
var docSheets = documentStyleSheetsDescriptor.get.call(this);
|
|
4552
|
-
var filtered = __spreadArray([], __read(docSheets)).filter(function (styleSheet) {
|
|
4704
|
+
var filtered = __spreadArray([], __read(docSheets), false).filter(function (styleSheet) {
|
|
4553
4705
|
return !styleSheet.ownerNode.classList.contains('darkreader');
|
|
4554
4706
|
});
|
|
4555
4707
|
return Object.setPrototypeOf(filtered, StyleSheetList.prototype);
|
|
@@ -4559,7 +4711,7 @@
|
|
|
4559
4711
|
var getCurrentElementValue = function () {
|
|
4560
4712
|
var elements = getElementsByTagNameDescriptor.value.call(_this, tagName);
|
|
4561
4713
|
if (tagName === 'style') {
|
|
4562
|
-
elements = Object.setPrototypeOf(__spreadArray([], __read(elements)).filter(function (element) {
|
|
4714
|
+
elements = Object.setPrototypeOf(__spreadArray([], __read(elements), false).filter(function (element) {
|
|
4563
4715
|
return !element.classList.contains('darkreader');
|
|
4564
4716
|
}), NodeList.prototype);
|
|
4565
4717
|
}
|
|
@@ -4568,7 +4720,7 @@
|
|
|
4568
4720
|
var elements = getCurrentElementValue();
|
|
4569
4721
|
var NodeListBehavior = {
|
|
4570
4722
|
get: function (_, property) {
|
|
4571
|
-
return getCurrentElementValue()[property];
|
|
4723
|
+
return getCurrentElementValue()[Number(property)];
|
|
4572
4724
|
}
|
|
4573
4725
|
};
|
|
4574
4726
|
elements = new Proxy(elements, NodeListBehavior);
|
|
@@ -5158,4 +5310,4 @@
|
|
|
5158
5310
|
|
|
5159
5311
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5160
5312
|
|
|
5161
|
-
}))
|
|
5313
|
+
}));
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "darkreader",
|
|
3
|
-
"version": "4.9.
|
|
3
|
+
"version": "4.9.40",
|
|
4
4
|
"description": "Dark mode for every website",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"api": "node tasks/build.js --api",
|
|
7
7
|
"benchmark-server": "node tests/benchmark-server/index.js",
|
|
8
8
|
"build": "node tasks/build.js --release",
|
|
9
|
-
"code-style": "eslint --cache --fix \"src/**/*.ts\" \"src/**/*.tsx\" \"tasks/**/*.js\" \"tests
|
|
9
|
+
"code-style": "eslint --ignore-pattern \"!.eslintplugin.js\" --cache --fix \"src/**/*.ts\" \"src/**/*.tsx\" \"tasks/**/*.js\" \"tests/[!coverage]**/*.js\" \"tests/**/*.ts\" \".eslintrc.js\" \"index.d.ts\" \".eslintplugin.js\"",
|
|
10
10
|
"debug": "node tasks/build.js --debug",
|
|
11
11
|
"debug:watch": "node tasks/build.js --debug --watch",
|
|
12
|
-
"lint": "eslint \"src/**/*.ts\" \"src/**/*.tsx\" \"tasks/**/*.js\" \"tests/**/*.ts\" \"tests
|
|
12
|
+
"lint": "eslint --ignore-pattern \"!.eslintplugin.js\" \"src/**/*.ts\" \"src/**/*.tsx\" \"tasks/**/*.js\" \"tests/**/*.ts\" \"tests/[!coverage]**/*.js\" \"index.d.ts\" \".eslintplugin.js\"",
|
|
13
13
|
"prepublishOnly": "npm test && npm run api",
|
|
14
14
|
"release": "npm test && npm run lint && node tasks/build.js --release",
|
|
15
15
|
"test": "jest --config=tests/jest.config.js",
|
|
@@ -64,45 +64,46 @@
|
|
|
64
64
|
"url": "https://opencollective.com/darkreader"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@rollup/plugin-node-resolve": "13.0.
|
|
68
|
-
"@rollup/plugin-replace": "
|
|
69
|
-
"@rollup/pluginutils": "4.1.
|
|
70
|
-
"@types/chrome": "0.0.
|
|
71
|
-
"@types/jasmine": "3.
|
|
72
|
-
"@types/jest": "
|
|
67
|
+
"@rollup/plugin-node-resolve": "13.0.6",
|
|
68
|
+
"@rollup/plugin-replace": "3.0.0",
|
|
69
|
+
"@rollup/pluginutils": "4.1.1",
|
|
70
|
+
"@types/chrome": "0.0.162",
|
|
71
|
+
"@types/jasmine": "3.10.1",
|
|
72
|
+
"@types/jest": "27.0.2",
|
|
73
73
|
"@types/karma": "6.3.1",
|
|
74
|
-
"@types/
|
|
75
|
-
"@
|
|
76
|
-
"@typescript-eslint/
|
|
74
|
+
"@types/offscreencanvas": "2019.6.4",
|
|
75
|
+
"@types/node": "16.11.6",
|
|
76
|
+
"@typescript-eslint/eslint-plugin": "5.3.0",
|
|
77
|
+
"@typescript-eslint/parser": "5.3.0",
|
|
77
78
|
"chokidar": "3.5.2",
|
|
78
|
-
"eslint": "
|
|
79
|
-
"eslint-plugin-import": "2.
|
|
79
|
+
"eslint": "8.1.0",
|
|
80
|
+
"eslint-plugin-import": "2.25.2",
|
|
80
81
|
"eslint-plugin-local": "1.0.0",
|
|
81
82
|
"fs-extra": "10.0.0",
|
|
82
83
|
"globby": "11.0.4",
|
|
83
|
-
"jasmine-core": "3.
|
|
84
|
-
"jest": "27.
|
|
85
|
-
"karma": "6.3.
|
|
84
|
+
"jasmine-core": "3.10.1",
|
|
85
|
+
"jest": "27.3.1",
|
|
86
|
+
"karma": "6.3.7",
|
|
86
87
|
"karma-chrome-launcher": "3.1.0",
|
|
87
88
|
"karma-coverage": "2.0.3",
|
|
88
|
-
"karma-firefox-launcher": "2.1.
|
|
89
|
+
"karma-firefox-launcher": "2.1.2",
|
|
89
90
|
"karma-jasmine": "4.0.1",
|
|
90
91
|
"karma-rollup-preprocessor": "7.0.7",
|
|
91
92
|
"karma-safari-launcher": "1.0.0",
|
|
92
|
-
"less": "4.1.
|
|
93
|
+
"less": "4.1.2",
|
|
93
94
|
"malevic": "0.18.6",
|
|
94
|
-
"prettier": "2.
|
|
95
|
-
"puppeteer-core": "10.
|
|
96
|
-
"rollup": "2.
|
|
95
|
+
"prettier": "2.4.1",
|
|
96
|
+
"puppeteer-core": "10.4.0",
|
|
97
|
+
"rollup": "2.59.0",
|
|
97
98
|
"rollup-plugin-istanbul2": "2.0.2",
|
|
98
99
|
"rollup-plugin-typescript2": "0.30.0",
|
|
99
|
-
"ts-jest": "27.0.
|
|
100
|
-
"ts-node": "10.
|
|
101
|
-
"tsconfig-paths": "3.
|
|
102
|
-
"tslib": "2.3.
|
|
103
|
-
"typescript": "4.
|
|
104
|
-
"web-ext": "6.
|
|
105
|
-
"ws": "
|
|
100
|
+
"ts-jest": "27.0.7",
|
|
101
|
+
"ts-node": "10.4.0",
|
|
102
|
+
"tsconfig-paths": "3.11.0",
|
|
103
|
+
"tslib": "2.3.1",
|
|
104
|
+
"typescript": "4.4.4",
|
|
105
|
+
"web-ext": "6.5.0",
|
|
106
|
+
"ws": "8.2.3",
|
|
106
107
|
"yazl": "2.5.1"
|
|
107
108
|
}
|
|
108
109
|
}
|