Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1086f58

Browse files
committed
fix: when switching yt video, nav buttons readded into page
1 parent a2ee98e commit 1086f58

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

‎src/content-script/update-solutions-tab.ts‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const VIDEO_ASPECT_RATIO = 56.25; // 16:9 aspect ratio
44
function createStyledButton(text: string, isActive: boolean = false): HTMLButtonElement {
55
const button = document.createElement('button');
66
button.textContent = text;
7-
7+
88
chrome.storage.local.get(['isDarkTheme'], (result) => {
99
const isDark = result.isDarkTheme;
1010
button.style.backgroundColor = isDark ? '#373737' : '#f3f4f5';
@@ -543,16 +543,13 @@ chrome.runtime.onMessage.addListener((request) => {
543543
return;
544544
}
545545

546-
// Check if the nav container already exists before adding
546+
// Only create nav container if it doesn't exist or if this is not a video update
547547
let existingNavContainer = document.querySelector('.nav-container');
548-
if (existingNavContainer) {
549-
existingNavContainer.remove();
548+
if (!existingNavContainer) {
549+
const newNavContainer = createNavContainer(problem);
550+
searchBar?.insertBefore(newNavContainer, searchBar.firstChild);
550551
}
551552

552-
// Create a new nav container (ensure that the 'createNavContainer' function is defined correctly and accessible)
553-
const newNavContainer = createNavContainer(problem);
554-
searchBar?.insertBefore(newNavContainer, searchBar.firstChild)
555-
556553
// Check if the video container already exists before adding
557554
if (!document.querySelector('.video-container') && problem.videos.length > 0) {
558555
let videoContainer = createVideoContainer(problem);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /