~ knotless Search/
↑↓ move↵ open⇧↵ all results

zat.dev/zds

atproto pds · mirror of https://tangled.org/zat.dev/zds

0
0
14 lines · 654 B Raw History
// `drawings` is a server-generated map of known slots to local asset URLs.
for (const original of document.querySelectorAll('[data-icon-slot]')) {
  const source = drawings[original.getAttribute('data-icon-slot')];
  if (!source) continue;
  const image = new Image();
  image.alt = '';
  image.setAttribute('aria-hidden', 'true');
  image.className = original.getAttribute('class') || '';
  image.classList.add('drawing-icon');
  image.dataset.iconSlot = original.getAttribute('data-icon-slot');
  image.onload = () => original.replaceWith(image);
  // Leave the usable default in place if an image cannot be decoded or loaded.
  image.src = source;
}