Skip to content

Commit

Permalink
Fix title bar being awaiting forever when it gets hidding while origi…
Browse files Browse the repository at this point in the history
…nal and custom and swapping out
  • Loading branch information
ajayyy committed Sep 13, 2024
1 parent abf4c76 commit e099155
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/utils/titleBar.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getYouTubeTitleNodeSelector } from "../../maze-utils/src/elements";
import { getOriginalTitleElement } from "../titles/titleRenderer";
import { BrandingLocation, replaceCurrentVideoBranding } from "../videoBranding/videoBranding";
import { waitForElement } from "../../maze-utils/src/dom";
import { isVisible, waitForElement } from "../../maze-utils/src/dom";
import { onMobile } from "../../maze-utils/src/pageInfo";
import { logError } from "./logger";
import { waitFor } from "../../maze-utils/src";
Expand All @@ -24,6 +24,10 @@ let titleButtonContainer: HTMLElement | null = null;
let lastReferenceNode: HTMLElement | null = null;

export async function getOrCreateTitleButtonContainer(forceTitleNode?: HTMLElement): Promise<HTMLElement | null> {
if (titleButtonContainer && isVisible(titleButtonContainer)) {
return titleButtonContainer;
}

const titleNode = forceTitleNode ?? await waitForElement(getYouTubeTitleNodeSelector(), true) as HTMLElement;

// Experimental YouTube layout with description on right
Expand Down

0 comments on commit e099155

Please sign in to comment.