From b5c7384f9dd4a147d18628731445ee1a86b084b3 Mon Sep 17 00:00:00 2001 From: Ajay Date: Wed, 20 Dec 2023 19:07:42 -0500 Subject: [PATCH] Add null check for show original on hover feature and add it to live reload list --- src/titles/titleRenderer.ts | 8 ++++++-- src/videoBranding/videoBranding.ts | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/titles/titleRenderer.ts b/src/titles/titleRenderer.ts index 97d19d1..1bb3f48 100644 --- a/src/titles/titleRenderer.ts +++ b/src/titles/titleRenderer.ts @@ -154,7 +154,9 @@ function showOriginalTitle(element: HTMLElement, brandingLocation: BrandingLocat if (Config.config!.showOriginalOnHover) { findShowOriginalButton(originalTitleElement, brandingLocation).then((buttonElement) => { - buttonElement.title = originalTitleElement.textContent ?? ""; + if (buttonElement) { + buttonElement.title = originalTitleElement.textContent ?? ""; + } }).catch(logError); } @@ -195,7 +197,9 @@ function showCustomTitle(element: HTMLElement, brandingLocation: BrandingLocatio if (Config.config!.showOriginalOnHover) { findShowOriginalButton(originalTitleElement, brandingLocation).then((buttonElement) => { - buttonElement.title = titleElement.textContent ?? ""; + if (buttonElement) { + buttonElement.title = titleElement.textContent ?? ""; + } }).catch(logError); } diff --git a/src/videoBranding/videoBranding.ts b/src/videoBranding/videoBranding.ts index a0083cf..2580679 100644 --- a/src/videoBranding/videoBranding.ts +++ b/src/videoBranding/videoBranding.ts @@ -417,7 +417,8 @@ export function setupOptionChangeListener(): void { "alwaysShowShowOriginalButton", "channelOverrides", "showIconForFormattedTitles", - "ignoreAbThumbnails" + "ignoreAbThumbnails", + "showOriginalOnHover" ]; if (settingsToReload.some((name) => (changes[name] && changes[name].newValue !== changes[name].oldValue))) {