diff options
author | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2025-05-30 03:30:12 -0400 |
---|---|---|
committer | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2025-05-30 03:30:12 -0400 |
commit | 29e5bbe68e02fe1d86e960a634d0580c37612254 (patch) | |
tree | e88585946a58feb988e3a3bb45dd2a9a09fea4c3 /src/ClientUtils.ts | |
parent | f92a02ec5d676359cb268a35d30e5bf9886199c1 (diff) | |
parent | 49fb76f1c54fb8fc4e76bdcf675719d41bfc36aa (diff) |
Merge branch 'master' into Template-Changes
Diffstat (limited to 'src/ClientUtils.ts')
-rw-r--r-- | src/ClientUtils.ts | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ClientUtils.ts b/src/ClientUtils.ts index e1f490c1a..8eb1a39ec 100644 --- a/src/ClientUtils.ts +++ b/src/ClientUtils.ts @@ -194,7 +194,7 @@ export namespace ClientUtils { } export function CorsProxy(url: string): string { - return prepend('/corsProxy/') + encodeURIComponent(url); + return prepend('/corsproxy/') + encodeURIComponent(url); } export function CopyText(text: string) { @@ -476,7 +476,10 @@ export function smoothScrollHorizontal(duration: number, element: HTMLElement | export function addStyleSheet() { const style = document.createElement('style'); const sheets = document.head.appendChild(style); - return sheets.sheet; + return sheets; +} +export function removeStyleSheet(sheet?: HTMLStyleElement) { + sheet && document.head.removeChild(sheet); } export function addStyleSheetRule(sheet: CSSStyleSheet | null, selector: string, css: string | { [key: string]: string }, selectorPrefix = '.') { const propText = @@ -667,7 +670,8 @@ export function setupMoveUpEvents( } export function DivHeight(ele: HTMLElement | null): number { - return ele ? Number(getComputedStyle(ele).height.replace('px', '')) : 0; + const hgt = ele ? Number(getComputedStyle(ele).height.replace('px', '')) : 0; + return Number.isNaN(hgt) ? 0 : hgt; } export function DivWidth(ele: HTMLElement | null): number { return ele ? Number(getComputedStyle(ele).width.replace('px', '')) : 0; |