Skip to content

Commit

Permalink
Add null check for show original on hover feature and add it to live …
Browse files Browse the repository at this point in the history
…reload list
  • Loading branch information
ajayyy committed Dec 21, 2023
1 parent 80f1d31 commit b5c7384
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/titles/titleRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down
3 changes: 2 additions & 1 deletion src/videoBranding/videoBranding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))) {
Expand Down

0 comments on commit b5c7384

Please sign in to comment.