@@ -4,7 +4,7 @@ const VIDEO_ASPECT_RATIO = 56.25; // 16:9 aspect ratio
44function 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