Something went wrong. Try again.
Browser extension: detect and subscribe to standard.site publications on ATProto
Something went wrong. Try again.
2.0 kB · 28 lines
TypeScript
1234567891011121314151617181920212223242526272829// The few things every part of the popup needs: element lookup, the tone// glyphs, and the memory of which remote images have already failed.
/** Elements are declared in popup.html; a missing id is a packaging bug. */export const $ = <T extends HTMLElement>(id: string) => document.getElementById(id) as T
/** * Blob URLs that already failed to load, so a redraw does not retry them and * flash a broken image on every render. Shared: a publication icon and an * avatar can be the same kind of miss on the same PDS. */export const failedIconUrls = new Set<string>()
/** * Shape-coded tone icons (triangle = warn, diamond = alert, circle = error) so * a pill's severity survives without color vision — alert and error are both * red, which is exactly where the shapes have to carry it. Three shapes that * stay apart at 14px: an octagon reads as a circle that small. Static markup, * no user data. Moderation labels use the same two loud shapes: an alert label * gets the diamond, anything milder the triangle. */export const TONE_ICONS = { warn: '<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 1.5 15 14H1L8 1.5z" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/><path d="M8 6v3.6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/><circle cx="8" cy="11.9" r="0.9" fill="currentColor"/></svg>', alert: '<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 1.2 14.8 8 8 14.8 1.2 8 8 1.2z" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/><path d="M8 4.9v4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/><circle cx="8" cy="11.4" r="0.9" fill="currentColor"/></svg>', error: '<svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="6.5" fill="none" stroke="currentColor" stroke-width="1.5"/><path d="M8 4.5v4.3" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/><circle cx="8" cy="11.3" r="0.9" fill="currentColor"/></svg>',} as const