don't make CORS mad when I don't have to
This commit is contained in:
parent
9a9ee173ca
commit
0182f1b28c
1 changed files with 6 additions and 1 deletions
|
@ -596,7 +596,9 @@ export function createImg(
|
||||||
localStorage.getItem("gifSetting") || ("hover" as "hover") || "always" || "never";
|
localStorage.getItem("gifSetting") || ("hover" as "hover") || "always" || "never";
|
||||||
const img = document.createElement("img");
|
const img = document.createElement("img");
|
||||||
elm ||= img;
|
elm ||= img;
|
||||||
img.crossOrigin = "anonymous";
|
if (src && isAnimated(src)) {
|
||||||
|
img.crossOrigin = "anonymous";
|
||||||
|
}
|
||||||
img.onload = async () => {
|
img.onload = async () => {
|
||||||
if (settings === "always") return;
|
if (settings === "always") return;
|
||||||
if (!src) return;
|
if (!src) return;
|
||||||
|
@ -637,6 +639,9 @@ export function createImg(
|
||||||
setSrcs: (nsrc: string, nstaticsrc: string | void) => {
|
setSrcs: (nsrc: string, nstaticsrc: string | void) => {
|
||||||
src = nsrc;
|
src = nsrc;
|
||||||
staticsrc = nstaticsrc;
|
staticsrc = nstaticsrc;
|
||||||
|
if (src && isAnimated(src)) {
|
||||||
|
img.crossOrigin = "anonymous";
|
||||||
|
}
|
||||||
img.src = settings !== "always" ? staticsrc || src || "" : src || "";
|
img.src = settings !== "always" ? staticsrc || src || "" : src || "";
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue