darkreader 4.9.95 → 4.9.96
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 +43 -5
- 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.96
|
|
3
3
|
* https://darkreader.org/
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -170,9 +170,11 @@
|
|
|
170
170
|
})();
|
|
171
171
|
|
|
172
172
|
async function getOKResponse(url, mimeType, origin) {
|
|
173
|
+
const credentials =
|
|
174
|
+
origin && url.startsWith(`${origin}/`) ? undefined : "omit";
|
|
173
175
|
const response = await fetch(url, {
|
|
174
176
|
cache: "force-cache",
|
|
175
|
-
credentials
|
|
177
|
+
credentials,
|
|
176
178
|
referrer: origin
|
|
177
179
|
});
|
|
178
180
|
if (
|
|
@@ -2136,8 +2138,10 @@
|
|
|
2136
2138
|
".fat",
|
|
2137
2139
|
".icofont",
|
|
2138
2140
|
'[style*="font-"]',
|
|
2139
|
-
'[class*="icon"
|
|
2140
|
-
'[class*="
|
|
2141
|
+
'[class*="icon"]',
|
|
2142
|
+
'[class*="Icon"]',
|
|
2143
|
+
'[class*="symbol"]',
|
|
2144
|
+
'[class*="Symbol"]',
|
|
2141
2145
|
".glyphicon",
|
|
2142
2146
|
'[class*="material-symbol"]',
|
|
2143
2147
|
'[class*="material-icon"]',
|
|
@@ -5751,6 +5755,20 @@
|
|
|
5751
5755
|
},
|
|
5752
5756
|
{once: true, passive: true}
|
|
5753
5757
|
);
|
|
5758
|
+
const unhandledShadowHosts = new Set();
|
|
5759
|
+
document.addEventListener("__darkreader__shadowDomAttaching", (e) => {
|
|
5760
|
+
const host = e.target;
|
|
5761
|
+
if (unhandledShadowHosts.size === 0) {
|
|
5762
|
+
queueMicrotask(() => {
|
|
5763
|
+
const hosts = [...unhandledShadowHosts].filter(
|
|
5764
|
+
(el) => el.shadowRoot
|
|
5765
|
+
);
|
|
5766
|
+
elementsDefinitionCallback?.(hosts);
|
|
5767
|
+
unhandledShadowHosts.clear();
|
|
5768
|
+
});
|
|
5769
|
+
}
|
|
5770
|
+
unhandledShadowHosts.add(host);
|
|
5771
|
+
});
|
|
5754
5772
|
const resolvers = new Map();
|
|
5755
5773
|
function handleIsDefined(e) {
|
|
5756
5774
|
canOptimizeUsingProxy = true;
|
|
@@ -5814,6 +5832,7 @@
|
|
|
5814
5832
|
|
|
5815
5833
|
const observers = [];
|
|
5816
5834
|
let observedRoots;
|
|
5835
|
+
let handledShadowHosts;
|
|
5817
5836
|
function watchForStylePositions(
|
|
5818
5837
|
currentStyles,
|
|
5819
5838
|
update,
|
|
@@ -5997,6 +6016,7 @@
|
|
|
5997
6016
|
observe(document);
|
|
5998
6017
|
deepObserve(document.documentElement);
|
|
5999
6018
|
watchWhenCustomElementsDefined((hosts) => {
|
|
6019
|
+
hosts = hosts.filter((node) => !handledShadowHosts.has(node));
|
|
6000
6020
|
const newStyles = [];
|
|
6001
6021
|
hosts.forEach((host) =>
|
|
6002
6022
|
push(newStyles, getManageableStyles(host.shadowRoot))
|
|
@@ -6011,6 +6031,7 @@
|
|
|
6011
6031
|
deepObserve(shadowRoot);
|
|
6012
6032
|
collectUndefinedElements(shadowRoot);
|
|
6013
6033
|
});
|
|
6034
|
+
hosts.forEach((node) => handledShadowHosts.add(node));
|
|
6014
6035
|
});
|
|
6015
6036
|
document.addEventListener("__darkreader__isDefined", handleIsDefined);
|
|
6016
6037
|
collectUndefinedElements(document);
|
|
@@ -6019,6 +6040,7 @@
|
|
|
6019
6040
|
observers.forEach((o) => o.disconnect());
|
|
6020
6041
|
observers.splice(0, observers.length);
|
|
6021
6042
|
observedRoots = new WeakSet();
|
|
6043
|
+
handledShadowHosts = new WeakSet();
|
|
6022
6044
|
}
|
|
6023
6045
|
function stopWatchingForStylePositions() {
|
|
6024
6046
|
resetObservers();
|
|
@@ -6329,7 +6351,10 @@
|
|
|
6329
6351
|
function overrideProperty(cls, prop, overrides) {
|
|
6330
6352
|
const proto = cls.prototype;
|
|
6331
6353
|
const oldDescriptor = Object.getOwnPropertyDescriptor(proto, prop);
|
|
6332
|
-
|
|
6354
|
+
if (!oldDescriptor) {
|
|
6355
|
+
return;
|
|
6356
|
+
}
|
|
6357
|
+
const newDescriptor = {...oldDescriptor};
|
|
6333
6358
|
Object.keys(overrides).forEach((key) => {
|
|
6334
6359
|
const factory = overrides[key];
|
|
6335
6360
|
newDescriptor[key] = factory(oldDescriptor[key]);
|
|
@@ -6352,6 +6377,10 @@
|
|
|
6352
6377
|
const adoptedSheetChangeEvent = new CustomEvent(
|
|
6353
6378
|
"__darkreader__adoptedStyleSheetChange"
|
|
6354
6379
|
);
|
|
6380
|
+
const shadowDomAttachingEvent = new CustomEvent(
|
|
6381
|
+
"__darkreader__shadowDomAttaching",
|
|
6382
|
+
{bubbles: true}
|
|
6383
|
+
);
|
|
6355
6384
|
const adoptedSheetOwners = new WeakMap();
|
|
6356
6385
|
const adoptedDeclarationSheets = new WeakMap();
|
|
6357
6386
|
function onAdoptedSheetChange(sheet) {
|
|
@@ -6445,6 +6474,15 @@
|
|
|
6445
6474
|
reportSheetChange(this);
|
|
6446
6475
|
}
|
|
6447
6476
|
);
|
|
6477
|
+
override(
|
|
6478
|
+
Element,
|
|
6479
|
+
"attachShadow",
|
|
6480
|
+
(native) =>
|
|
6481
|
+
function (options) {
|
|
6482
|
+
this.dispatchEvent(shadowDomAttachingEvent);
|
|
6483
|
+
return native.call(this, options);
|
|
6484
|
+
}
|
|
6485
|
+
);
|
|
6448
6486
|
const shouldWrapHTMLElement =
|
|
6449
6487
|
location.hostname === "baidu.com" ||
|
|
6450
6488
|
location.hostname.endsWith(".baidu.com");
|