Wait for hover preview using mutation observer

This commit is contained in:
Ajay
2022-01-19 11:27:19 -05:00
parent bf735f47b0
commit 002f22c040
4 changed files with 42 additions and 9 deletions

View File

@@ -92,8 +92,8 @@ const playerButtons: Record<string, {button: HTMLButtonElement, image: HTMLImage
// Direct Links after the config is loaded
utils.wait(() => Config.config !== null, 1000, 1).then(() => videoIDChange(getYouTubeVideoID(document)));
// wait infinitely for hover preview
utils.wait(() => getHoverPreview(), 0, 500).then(() => refreshVideoAttachments())
// wait for hover preview to appear, and refresh attachments if ever found
window.addEventListener("DOMContentLoaded", () => utils.waitForElement(".ytp-inline-preview-ui").then(() => refreshVideoAttachments()));
addPageListeners();
addHotkeyListener();