accessify-widget 0.2.19 → 0.2.20
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/dist/accessify.min.js +1 -1
- package/dist/accessify.min.js.map +1 -1
- package/dist/accessify.mjs +1 -1
- package/dist/{index-B2FUEI0d.js → index-DwxnT3JK.js} +85 -17
- package/dist/{index-B2FUEI0d.js.map → index-DwxnT3JK.js.map} +1 -1
- package/dist/{keyboard-nav-B49dNgy3.js → keyboard-nav-BtZsDcZQ.js} +2 -2
- package/dist/{keyboard-nav-B49dNgy3.js.map → keyboard-nav-BtZsDcZQ.js.map} +1 -1
- package/dist/{page-structure-C9pDJKyf.js → page-structure-DTKpsB5y.js} +2 -2
- package/dist/{page-structure-C9pDJKyf.js.map → page-structure-DTKpsB5y.js.map} +1 -1
- package/dist/widget.js +1 -1
- package/dist/widget.js.map +1 -1
- package/package.json +1 -1
package/dist/accessify.mjs
CHANGED
|
@@ -6310,14 +6310,14 @@ function FeatureGrid($$anchor, $$props) {
|
|
|
6310
6310
|
const FEATURE_LOADERS = {
|
|
6311
6311
|
contrast: () => import("./contrast-CqsICAkU.js"),
|
|
6312
6312
|
"text-size": () => import("./text-size-C6OFhCGi.js"),
|
|
6313
|
-
"keyboard-nav": () => import("./keyboard-nav-
|
|
6313
|
+
"keyboard-nav": () => import("./keyboard-nav-BtZsDcZQ.js"),
|
|
6314
6314
|
"link-highlight": () => import("./link-highlight-DBGm067Y.js"),
|
|
6315
6315
|
"reading-guide": () => import("./reading-guide-VT8NciIL.js"),
|
|
6316
6316
|
"reading-mask": () => import("./reading-mask-BABChuCz.js"),
|
|
6317
6317
|
"animation-stop": () => import("./animation-stop-C0MwseK0.js"),
|
|
6318
6318
|
"hide-images": () => import("./hide-images-B_LeCBcd.js"),
|
|
6319
6319
|
"big-cursor": () => import("./big-cursor-B2UKu9dQ.js"),
|
|
6320
|
-
"page-structure": () => import("./page-structure-
|
|
6320
|
+
"page-structure": () => import("./page-structure-DTKpsB5y.js"),
|
|
6321
6321
|
tts: () => import("./tts-CjszLRnb.js"),
|
|
6322
6322
|
"text-simplify": () => import("./text-simplify-Cvhpio7g.js"),
|
|
6323
6323
|
"alt-text": () => Promise.resolve().then(() => altText)
|
|
@@ -7821,6 +7821,7 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
7821
7821
|
let styleEl = null;
|
|
7822
7822
|
let badgeEl = null;
|
|
7823
7823
|
let missingAltImages = [];
|
|
7824
|
+
let existingAltImages = [];
|
|
7824
7825
|
const processedImages = /* @__PURE__ */ new Map();
|
|
7825
7826
|
let autoGenerating = false;
|
|
7826
7827
|
let tooltipEl = null;
|
|
@@ -7834,6 +7835,7 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
7834
7835
|
}
|
|
7835
7836
|
const STYLE_ID = "accessify-alt-text-styles";
|
|
7836
7837
|
const HIGHLIGHT_CLASS = "accessify-alt-missing";
|
|
7838
|
+
const HAS_ALT_CLASS = "accessify-alt-existing";
|
|
7837
7839
|
const BADGE_CLASS = "accessify-alt-badge";
|
|
7838
7840
|
function getStyles() {
|
|
7839
7841
|
return `
|
|
@@ -7867,6 +7869,12 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
7867
7869
|
content: none;
|
|
7868
7870
|
}
|
|
7869
7871
|
|
|
7872
|
+
.${HAS_ALT_CLASS} {
|
|
7873
|
+
outline: 3px solid #2a9d8f !important;
|
|
7874
|
+
outline-offset: 3px !important;
|
|
7875
|
+
position: relative !important;
|
|
7876
|
+
}
|
|
7877
|
+
|
|
7870
7878
|
.accessify-alt-tooltip {
|
|
7871
7879
|
position: fixed;
|
|
7872
7880
|
z-index: 2147483647;
|
|
@@ -8105,7 +8113,13 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
8105
8113
|
if (img.closest("#accessify-root") || img.closest("accessify-widget")) return;
|
|
8106
8114
|
if (img.complete && img.naturalWidth > 0 && (img.naturalWidth < 20 || img.naturalHeight < 20)) return;
|
|
8107
8115
|
const alt = img.getAttribute("alt");
|
|
8108
|
-
if (alt === "")
|
|
8116
|
+
if (alt === "") {
|
|
8117
|
+
const role = img.getAttribute("role");
|
|
8118
|
+
if (role === "presentation" || role === "none") return;
|
|
8119
|
+
if (img.complete && img.naturalWidth > 0 && (img.naturalWidth < 50 || img.naturalHeight < 50)) return;
|
|
8120
|
+
missing.push(img);
|
|
8121
|
+
return;
|
|
8122
|
+
}
|
|
8109
8123
|
if (alt === null || isGenericAlt(alt)) missing.push(img);
|
|
8110
8124
|
});
|
|
8111
8125
|
document.querySelectorAll("picture").forEach((picture) => {
|
|
@@ -8132,6 +8146,20 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
8132
8146
|
});
|
|
8133
8147
|
return missing;
|
|
8134
8148
|
}
|
|
8149
|
+
function scanWithExistingAlt(excludeMissing) {
|
|
8150
|
+
const existing = [];
|
|
8151
|
+
const missingSet = new Set(excludeMissing);
|
|
8152
|
+
document.querySelectorAll("img").forEach((img) => {
|
|
8153
|
+
if (img.closest("#accessify-root") || img.closest("accessify-widget")) return;
|
|
8154
|
+
if (missingSet.has(img)) return;
|
|
8155
|
+
if (img.complete && img.naturalWidth > 0 && (img.naturalWidth < 20 || img.naturalHeight < 20)) return;
|
|
8156
|
+
const alt = img.getAttribute("alt");
|
|
8157
|
+
if (alt && alt.trim() && !isGenericAlt(alt)) {
|
|
8158
|
+
existing.push(img);
|
|
8159
|
+
}
|
|
8160
|
+
});
|
|
8161
|
+
return existing;
|
|
8162
|
+
}
|
|
8135
8163
|
function scanAutoApplied() {
|
|
8136
8164
|
const images = document.querySelectorAll('img[data-accessify-alt="auto"]');
|
|
8137
8165
|
const applied = [];
|
|
@@ -8226,16 +8254,28 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
8226
8254
|
removeBadge();
|
|
8227
8255
|
const remaining = missingAltImages.filter((img) => !processedImages.has(img)).length;
|
|
8228
8256
|
const generating = missingAltImages.filter((img) => img.classList.contains("accessify-alt-generating")).length;
|
|
8229
|
-
|
|
8230
|
-
|
|
8231
|
-
|
|
8232
|
-
return;
|
|
8233
|
-
}
|
|
8234
|
-
if (remaining === 0) return;
|
|
8257
|
+
const generated = processedImages.size;
|
|
8258
|
+
const withExisting = existingAltImages.length;
|
|
8259
|
+
const totalImages = missingAltImages.length + withExisting;
|
|
8235
8260
|
if (generating > 0) {
|
|
8236
8261
|
showBadge(isDE() ? `${generating} Bilder werden analysiert…` : `Analyzing ${generating} images…`, "#f77f00", generating);
|
|
8237
|
-
|
|
8238
|
-
|
|
8262
|
+
return;
|
|
8263
|
+
}
|
|
8264
|
+
if (remaining === 0 && totalImages > 0) {
|
|
8265
|
+
const parts = [];
|
|
8266
|
+
if (withExisting > 0) parts.push(isDE() ? `${withExisting} ✓` : `${withExisting} ✓`);
|
|
8267
|
+
if (generated > 0) parts.push(isDE() ? `${generated} erzeugt` : `${generated} generated`);
|
|
8268
|
+
const summary = `${totalImages} ${isDE() ? "Bilder" : "images"}: ${parts.join(", ")}`;
|
|
8269
|
+
showBadge(summary, "#2a9d8f", 0);
|
|
8270
|
+
setTimeout(() => removeBadge(), 8e3);
|
|
8271
|
+
return;
|
|
8272
|
+
}
|
|
8273
|
+
if (remaining > 0) {
|
|
8274
|
+
const statusParts = [];
|
|
8275
|
+
if (withExisting > 0) statusParts.push(`${withExisting} ✓`);
|
|
8276
|
+
statusParts.push(isDE() ? `${remaining} ohne Alt-Text` : `${remaining} missing`);
|
|
8277
|
+
const text = `${totalImages} ${isDE() ? "Bilder" : "images"}: ${statusParts.join(", ")}`;
|
|
8278
|
+
showBadge(text, "#e63946", remaining);
|
|
8239
8279
|
}
|
|
8240
8280
|
}
|
|
8241
8281
|
function showBadge(text, color, count) {
|
|
@@ -8289,21 +8329,36 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
8289
8329
|
function tryRegisterImage(img) {
|
|
8290
8330
|
if (!enabled) return;
|
|
8291
8331
|
if (img.closest("#accessify-root")) return;
|
|
8292
|
-
if (missingAltImages.includes(img)) return;
|
|
8293
|
-
const alt = img.getAttribute("alt");
|
|
8294
|
-
if (alt !== null && alt.trim() !== "") return;
|
|
8332
|
+
if (missingAltImages.includes(img) || existingAltImages.includes(img)) return;
|
|
8295
8333
|
function addIfValid() {
|
|
8296
|
-
if (!enabled || missingAltImages.includes(img)) return;
|
|
8297
|
-
if (img.naturalWidth
|
|
8334
|
+
if (!enabled || missingAltImages.includes(img) || existingAltImages.includes(img)) return;
|
|
8335
|
+
if (img.naturalWidth < 20 || img.naturalHeight < 20) return;
|
|
8336
|
+
const alt = img.getAttribute("alt");
|
|
8337
|
+
const isMissing = alt === null || isGenericAlt(alt) || alt === "" && !isDecorativeImage(img);
|
|
8338
|
+
if (isMissing) {
|
|
8298
8339
|
img.classList.add(HIGHLIGHT_CLASS);
|
|
8299
8340
|
missingAltImages.push(img);
|
|
8300
8341
|
updateBadge();
|
|
8301
8342
|
generateSingle(img);
|
|
8343
|
+
} else if (alt && alt.trim()) {
|
|
8344
|
+
existingAltImages.push(img);
|
|
8345
|
+
img.classList.add(HAS_ALT_CLASS);
|
|
8346
|
+
img.removeEventListener("mouseenter", onMouseEnter);
|
|
8347
|
+
img.removeEventListener("mouseleave", onMouseLeave);
|
|
8348
|
+
img.addEventListener("mouseenter", onMouseEnter);
|
|
8349
|
+
img.addEventListener("mouseleave", onMouseLeave);
|
|
8350
|
+
updateBadge();
|
|
8302
8351
|
}
|
|
8303
8352
|
}
|
|
8304
8353
|
if (img.complete && img.naturalWidth > 0) addIfValid();
|
|
8305
8354
|
else img.addEventListener("load", addIfValid, { once: true });
|
|
8306
8355
|
}
|
|
8356
|
+
function isDecorativeImage(img) {
|
|
8357
|
+
const role = img.getAttribute("role");
|
|
8358
|
+
if (role === "presentation" || role === "none") return true;
|
|
8359
|
+
if (img.complete && img.naturalWidth > 0 && (img.naturalWidth < 50 || img.naturalHeight < 50)) return true;
|
|
8360
|
+
return false;
|
|
8361
|
+
}
|
|
8307
8362
|
function activate() {
|
|
8308
8363
|
if (enabled) return;
|
|
8309
8364
|
enabled = true;
|
|
@@ -8325,6 +8380,15 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
8325
8380
|
missingAltImages.push(img);
|
|
8326
8381
|
img.classList.add(HIGHLIGHT_CLASS);
|
|
8327
8382
|
}
|
|
8383
|
+
const withAlt = scanWithExistingAlt(missingAltImages);
|
|
8384
|
+
for (const img of withAlt) {
|
|
8385
|
+
existingAltImages.push(img);
|
|
8386
|
+
img.classList.add(HAS_ALT_CLASS);
|
|
8387
|
+
img.removeEventListener("mouseenter", onMouseEnter);
|
|
8388
|
+
img.removeEventListener("mouseleave", onMouseLeave);
|
|
8389
|
+
img.addEventListener("mouseenter", onMouseEnter);
|
|
8390
|
+
img.addEventListener("mouseleave", onMouseLeave);
|
|
8391
|
+
}
|
|
8328
8392
|
updateBadge();
|
|
8329
8393
|
generateAll();
|
|
8330
8394
|
document.querySelectorAll("img").forEach((img) => {
|
|
@@ -8356,6 +8420,10 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
8356
8420
|
img.classList.remove(HIGHLIGHT_CLASS, "accessify-alt-done", "accessify-alt-generating");
|
|
8357
8421
|
});
|
|
8358
8422
|
missingAltImages = [];
|
|
8423
|
+
existingAltImages.forEach((img) => {
|
|
8424
|
+
img.classList.remove(HAS_ALT_CLASS);
|
|
8425
|
+
});
|
|
8426
|
+
existingAltImages = [];
|
|
8359
8427
|
removeStyles();
|
|
8360
8428
|
}
|
|
8361
8429
|
autoApplyCachedAltTexts({ siteKey, proxyUrl, lang: initialLang }).catch(() => {
|
|
@@ -8569,4 +8637,4 @@ export {
|
|
|
8569
8637
|
init as i,
|
|
8570
8638
|
t
|
|
8571
8639
|
};
|
|
8572
|
-
//# sourceMappingURL=index-
|
|
8640
|
+
//# sourceMappingURL=index-DwxnT3JK.js.map
|