mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 15:31:52 +00:00
fix(a11y): prevent disableImages FOUC
This commit is contained in:
+4
-1
@@ -144,7 +144,10 @@ window.A11yPanel = (() => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (getSettings().disableImages) {
|
if (getSettings().disableImages) {
|
||||||
FEATURES.disableImages.apply(true);
|
new MutationObserver(() => {
|
||||||
|
const img = document.getElementById("background-image");
|
||||||
|
if (img) img.style.display = "none";
|
||||||
|
}).observe(document, { childList: true, subtree: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document.readyState === "loading") {
|
if (document.readyState === "loading") {
|
||||||
|
|||||||
@@ -37,16 +37,3 @@ document.querySelectorAll("script[data-target-id]").forEach((script) => {
|
|||||||
const disableBlur = settings.disableBlur || false;
|
const disableBlur = settings.disableBlur || false;
|
||||||
setBackgroundBlur(targetId, scrollDivisor, disableBlur, isMenuBlur);
|
setBackgroundBlur(targetId, scrollDivisor, disableBlur, isMenuBlur);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Prevent disableImages FOUC
|
|
||||||
// Note: I tried putting this in a11y.js but it did not work, and placing it here prevents FOUC
|
|
||||||
(() => {
|
|
||||||
const settings = JSON.parse(localStorage.getItem("a11ySettings") || "{}");
|
|
||||||
if (settings.disableImages) {
|
|
||||||
document.querySelectorAll("script[data-image-id]").forEach((script) => {
|
|
||||||
const imageId = script.getAttribute("data-image-id");
|
|
||||||
const image = imageId && document.getElementById(imageId);
|
|
||||||
if (image) image.style.display = "none";
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|||||||
Reference in New Issue
Block a user