darkreader 4.9.81 → 4.9.82
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 +58 -28
- package/package.json +1 -1
package/darkreader.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Dark Reader v4.9.
|
|
2
|
+
* Dark Reader v4.9.82
|
|
3
3
|
* https://darkreader.org/
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -1005,26 +1005,33 @@
|
|
|
1005
1005
|
cssText.includes("background-color: ;") &&
|
|
1006
1006
|
!style.getPropertyValue("background")
|
|
1007
1007
|
) {
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1008
|
+
handleEmptyShorthand("background", style, iterate);
|
|
1009
|
+
}
|
|
1010
|
+
if (
|
|
1011
|
+
cssText.includes("border-") &&
|
|
1012
|
+
cssText.includes("-color: ;") &&
|
|
1013
|
+
!style.getPropertyValue("border")
|
|
1014
|
+
) {
|
|
1015
|
+
handleEmptyShorthand("border", style, iterate);
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
function handleEmptyShorthand(shorthand, style, iterate) {
|
|
1019
|
+
const parentRule = style.parentRule;
|
|
1020
|
+
if (isStyleRule(parentRule)) {
|
|
1021
|
+
const sourceCSSText =
|
|
1022
|
+
parentRule.parentStyleSheet?.ownerNode?.textContent;
|
|
1023
|
+
if (sourceCSSText) {
|
|
1024
|
+
let escapedSelector = escapeRegExpSpecialChars(
|
|
1025
|
+
parentRule.selectorText
|
|
1026
|
+
);
|
|
1027
|
+
escapedSelector = escapedSelector.replaceAll(/\s+/g, "\\s*");
|
|
1028
|
+
escapedSelector = escapedSelector.replaceAll(/::/g, "::?");
|
|
1029
|
+
const regexp = new RegExp(
|
|
1030
|
+
`${escapedSelector}\\s*{[^}]*?${shorthand}:\\s*([^;}]+)`
|
|
1031
|
+
);
|
|
1032
|
+
const match = sourceCSSText.match(regexp);
|
|
1033
|
+
if (match) {
|
|
1034
|
+
iterate(shorthand, match[1]);
|
|
1028
1035
|
}
|
|
1029
1036
|
}
|
|
1030
1037
|
}
|
|
@@ -1120,7 +1127,7 @@
|
|
|
1120
1127
|
if (supportsRules.has(rule)) {
|
|
1121
1128
|
return true;
|
|
1122
1129
|
}
|
|
1123
|
-
if (rule
|
|
1130
|
+
if (rule instanceof CSSSupportsRule) {
|
|
1124
1131
|
supportsRules.add(rule);
|
|
1125
1132
|
return true;
|
|
1126
1133
|
}
|
|
@@ -1136,7 +1143,7 @@
|
|
|
1136
1143
|
if (layerRules.has(rule)) {
|
|
1137
1144
|
return true;
|
|
1138
1145
|
}
|
|
1139
|
-
if (rule
|
|
1146
|
+
if (rule instanceof CSSLayerBlockRule) {
|
|
1140
1147
|
layerRules.add(rule);
|
|
1141
1148
|
return true;
|
|
1142
1149
|
}
|
|
@@ -2628,7 +2635,29 @@
|
|
|
2628
2635
|
property === "stroke" ||
|
|
2629
2636
|
property === "stop-color"
|
|
2630
2637
|
) {
|
|
2631
|
-
|
|
2638
|
+
if (
|
|
2639
|
+
property.startsWith("border") &&
|
|
2640
|
+
property !== "border-color" &&
|
|
2641
|
+
value === "initial"
|
|
2642
|
+
) {
|
|
2643
|
+
const borderSideProp = property.substring(
|
|
2644
|
+
0,
|
|
2645
|
+
property.length - 6
|
|
2646
|
+
);
|
|
2647
|
+
const borderSideVal =
|
|
2648
|
+
rule.style.getPropertyValue(borderSideProp);
|
|
2649
|
+
if (
|
|
2650
|
+
borderSideVal.startsWith("0px") ||
|
|
2651
|
+
borderSideVal === "none"
|
|
2652
|
+
) {
|
|
2653
|
+
property = borderSideProp;
|
|
2654
|
+
modifier = borderSideVal;
|
|
2655
|
+
} else {
|
|
2656
|
+
modifier = value;
|
|
2657
|
+
}
|
|
2658
|
+
} else {
|
|
2659
|
+
modifier = getColorModifier(property, value, rule);
|
|
2660
|
+
}
|
|
2632
2661
|
} else if (
|
|
2633
2662
|
property === "background-image" ||
|
|
2634
2663
|
property === "list-style-image"
|
|
@@ -2664,11 +2693,12 @@
|
|
|
2664
2693
|
);
|
|
2665
2694
|
lines.push("}");
|
|
2666
2695
|
}
|
|
2667
|
-
if (isCSSColorSchemePropSupported) {
|
|
2696
|
+
if (isCSSColorSchemePropSupported && !isIFrame && theme.mode === 1) {
|
|
2668
2697
|
lines.push("html {");
|
|
2669
|
-
lines.push(
|
|
2670
|
-
|
|
2671
|
-
);
|
|
2698
|
+
lines.push(` color-scheme: dark !important;`);
|
|
2699
|
+
lines.push("}");
|
|
2700
|
+
lines.push("iframe {");
|
|
2701
|
+
lines.push(` color-scheme: initial;`);
|
|
2672
2702
|
lines.push("}");
|
|
2673
2703
|
}
|
|
2674
2704
|
const bgSelectors = joinSelectors(
|