accessify-widget 0.3.2 → 0.3.3

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.
@@ -1,4 +1,4 @@
1
- import { d, i } from "./index-C9-1BpqV.js";
1
+ import { d, i } from "./index-B8sAE1Po.js";
2
2
  export {
3
3
  d as destroy,
4
4
  i as init
@@ -6433,14 +6433,14 @@ function FeatureGrid($$anchor, $$props) {
6433
6433
  const FEATURE_LOADERS = {
6434
6434
  contrast: () => import("./contrast-CqsICAkU.js"),
6435
6435
  "text-size": () => import("./text-size-C6OFhCGi.js"),
6436
- "keyboard-nav": () => import("./keyboard-nav-DF9rgWAV.js"),
6436
+ "keyboard-nav": () => import("./keyboard-nav-SGx_nXud.js"),
6437
6437
  "link-highlight": () => import("./link-highlight-DBGm067Y.js"),
6438
6438
  "reading-guide": () => import("./reading-guide-VT8NciIL.js"),
6439
6439
  "reading-mask": () => import("./reading-mask-BABChuCz.js"),
6440
6440
  "animation-stop": () => import("./animation-stop-C0MwseK0.js"),
6441
6441
  "hide-images": () => import("./hide-images-B_LeCBcd.js"),
6442
6442
  "big-cursor": () => import("./big-cursor-B2UKu9dQ.js"),
6443
- "page-structure": () => import("./page-structure-BcyV93JT.js"),
6443
+ "page-structure": () => import("./page-structure-BfD6Mw28.js"),
6444
6444
  tts: () => import("./tts-CjszLRnb.js"),
6445
6445
  "text-simplify": () => import("./text-simplify-Cvhpio7g.js"),
6446
6446
  "alt-text": () => Promise.resolve().then(() => altText)
@@ -7953,16 +7953,16 @@ async function autoApplyCachedAltTexts(widgetConfig) {
7953
7953
  if (cache.size === 0) return 0;
7954
7954
  function applyToImg(img) {
7955
7955
  if (img.closest("#accessify-root") || img.closest("accessify-widget")) return false;
7956
- const alt = img.getAttribute("alt");
7957
- if (alt !== null && alt.trim() !== "") return false;
7958
7956
  const src = getImageSrc(img);
7959
7957
  const cached = cache.get(src) || cache.get(normalizeImageUrl(src)) || cache.get(img.src);
7960
- if (cached) {
7958
+ if (!cached) return false;
7959
+ const alt = img.getAttribute("alt");
7960
+ if (alt === null || alt.trim() === "") {
7961
7961
  img.setAttribute("alt", cached);
7962
7962
  img.setAttribute("data-accessify-alt", "auto");
7963
- return true;
7964
7963
  }
7965
- return false;
7964
+ img.setAttribute("title", cached);
7965
+ return true;
7966
7966
  }
7967
7967
  let applied = 0;
7968
7968
  document.querySelectorAll("img").forEach((img) => {
@@ -8149,6 +8149,7 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
8149
8149
  const altText2 = await aiService.generateAltText(src, ctx, lang());
8150
8150
  if (altText2) {
8151
8151
  img.setAttribute("alt", altText2);
8152
+ img.setAttribute("title", altText2);
8152
8153
  setCachedAltText(src, altText2, lang()).catch(() => {
8153
8154
  });
8154
8155
  if (siteKey) persistAltTextToServer(siteKey, proxyUrl, src, altText2, lang());
@@ -8293,6 +8294,7 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
8293
8294
  }
8294
8295
  function applyAltText(img, altText2) {
8295
8296
  img.setAttribute("alt", altText2);
8297
+ img.setAttribute("title", altText2);
8296
8298
  processedImages.set(img, { generatedAlt: altText2 });
8297
8299
  }
8298
8300
  async function generateAll() {
@@ -8393,6 +8395,14 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
8393
8395
  }
8394
8396
  }
8395
8397
  generateAll();
8398
+ document.querySelectorAll("img").forEach((img) => {
8399
+ if (img.closest("#accessify-root") || img.closest("accessify-widget")) return;
8400
+ const alt = img.getAttribute("alt");
8401
+ if (alt && alt.trim() && !img.getAttribute("title")) {
8402
+ img.setAttribute("title", alt);
8403
+ img.setAttribute("data-accessify-title", "auto");
8404
+ }
8405
+ });
8396
8406
  enableClickToDescribe();
8397
8407
  document.querySelectorAll("img").forEach((img) => {
8398
8408
  if (!img.complete) tryRegisterImage(img);
@@ -8425,6 +8435,10 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
8425
8435
  domObserver?.disconnect();
8426
8436
  domObserver = null;
8427
8437
  disableClickToDescribe();
8438
+ document.querySelectorAll('img[data-accessify-title="auto"]').forEach((img) => {
8439
+ img.removeAttribute("title");
8440
+ img.removeAttribute("data-accessify-title");
8441
+ });
8428
8442
  missingAltImages = [];
8429
8443
  removeStyles();
8430
8444
  }
@@ -8639,4 +8653,4 @@ export {
8639
8653
  init as i,
8640
8654
  t
8641
8655
  };
8642
- //# sourceMappingURL=index-C9-1BpqV.js.map
8656
+ //# sourceMappingURL=index-B8sAE1Po.js.map