Skip to content

Commit

Permalink
Fix titles on mobile sometimes not changing
Browse files Browse the repository at this point in the history
  • Loading branch information
ajayyy committed Jun 21, 2024
1 parent f9e62c1 commit b3bef40
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/titles/titleRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,20 @@ export async function replaceTitle(element: HTMLElement, videoID: VideoID, showC
if (brandingLocation === BrandingLocation.Watch) {
const currentWatchPageType = document.URL.includes("watch") ? WatchPageType.Video : WatchPageType.Miniplayer;

console.log("replacing", videoID, lastWatchVideoID, originalTitleElement.textContent, lastWatchTitle, currentWatchPageType, lastUrlWatchPageType, element)

if (lastWatchVideoID && originalTitleElement?.textContent
&& videoID !== lastWatchVideoID && originalTitleElement.textContent === lastWatchTitle
&& lastUrlWatchPageType === currentWatchPageType) {
// Don't reset it if it hasn't changed videos yet, will be handled by title change listener
return false;
}

lastWatchTitle = originalTitleElement?.textContent ?? "";
lastWatchVideoID = videoID;
lastUrlWatchPageType = currentWatchPageType;
if (lastWatchVideoID !== videoID) {
lastWatchTitle = originalTitleElement?.textContent ?? "";
lastWatchVideoID = videoID;
lastUrlWatchPageType = currentWatchPageType;
}
}

if (Config.config!.hideDetailsWhileFetching) {
Expand Down

0 comments on commit b3bef40

Please sign in to comment.