feat: add comments and cleanup unused imports across codebase

This commit is contained in:
2026-05-10 20:00:04 +02:00
parent b152e246ff
commit e48d95cb4e
68 changed files with 560 additions and 88 deletions

View File

@@ -1,5 +1,3 @@
export {};
type QuickSearchResult = {
id?: number;
image?: string;
@@ -7,6 +5,7 @@ type QuickSearchResult = {
type?: string;
};
// singleton flag to prevent double init (e.g. htmx swaps)
const searchInitializedKey = Symbol('searchInitialized');
const globalWindow = window as Window & { [searchInitializedKey]?: boolean };
@@ -23,6 +22,7 @@ const isSafeImageUrl = (rawUrl?: string): boolean => {
try {
const parsed = new URL(rawUrl, window.location.origin);
// block data: URIs and other potentially dangerous protocols
return parsed.protocol === 'https:' || parsed.protocol === 'http:';
} catch {
return false;
@@ -139,6 +139,7 @@ const onSearchInput = (event: Event): void => {
};
const onSearchBlur = (): void => {
// delay to allow clicking on results before clearing
window.setTimeout(() => {
clearSearchResults();
}, 200);