import settings from '$stores/settings'; import { get } from 'svelte/store'; export const nbsp = (str: string) => str.replace(/ /g, ' '); export const limitListHeight = () => { if (get(settings).displayLimitListHeight) { document.querySelectorAll('.list').forEach((list) => { const listContainerBottom = document.querySelector('#list-container')?.getBoundingClientRect().bottom || 0; const headerBottom = (document.querySelector('#header')?.getBoundingClientRect().bottom || 0) * 1.5; const offset = 1.25; const offsetInPixels = offset * parseFloat(getComputedStyle(document.documentElement).fontSize); ( list as HTMLElement ).style.maxHeight = `calc(100vh - ${listContainerBottom}px + ${headerBottom}px - ${ offsetInPixels * 2 }px)`; }); } };