diff options
author | Ajay <[email protected]> | 2023-02-13 02:31:25 -0500 |
---|---|---|
committer | Ajay <[email protected]> | 2023-02-13 02:31:25 -0500 |
commit | 5859c33ce89ef142e44b1acebfacb964919073ff (patch) | |
tree | 1713c1c1af7b3781d106daa5eda380045848196b /src/utils | |
parent | f4d80d88438ff31bc067ff480fd94112d972718d (diff) | |
download | SponsorBlock-5859c33ce89ef142e44b1acebfacb964919073ff.tar.gz SponsorBlock-5859c33ce89ef142e44b1acebfacb964919073ff.zip |
Move video handing and config to shared library
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/pageUtils.ts | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/src/utils/pageUtils.ts b/src/utils/pageUtils.ts index 5281bf1f..c6b5b92d 100644 --- a/src/utils/pageUtils.ts +++ b/src/utils/pageUtils.ts @@ -28,25 +28,6 @@ export function isVisible(element: HTMLElement): boolean { return element && element.offsetWidth > 0 && element.offsetHeight > 0; } -export function findValidElementFromSelector(selectors: string[]): HTMLElement { - return findValidElementFromGenerator(selectors, (selector) => document.querySelector(selector)); -} - -export function findValidElement(elements: HTMLElement[] | NodeListOf<HTMLElement>): HTMLElement { - return findValidElementFromGenerator(elements); -} - -function findValidElementFromGenerator<T>(objects: T[] | NodeListOf<HTMLElement>, generator?: (obj: T) => HTMLElement): HTMLElement { - for (const obj of objects) { - const element = generator ? generator(obj as T) : obj as HTMLElement; - if (element && isVisible(element)) { - return element; - } - } - - return null; -} - export function getHashParams(): Record<string, unknown> { const windowHash = window.location.hash.slice(1); if (windowHash) { |