Skip to content

Commit 13bf9f5

Browse files
committed
update the css selector to embed the video into the solutions tab, take that leetcode devs
1 parent ef69d3c commit 13bf9f5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/content-script/update-solutions.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,8 @@ function createVideoContainer(videoUrl: string, channelName: string) {
9090
* Injects the embedded YouTube solution into the solutions tab of the LeetCode problem.
9191
*/
9292
function addVideo(title: string) {
93-
const SOLUTIONS_TAB_INDEX = 1;
94-
95-
const solutionsTab = document.querySelectorAll('div.w-full.flex-col.overflow-auto')[SOLUTIONS_TAB_INDEX];
93+
const SOLUTIONS_TAB_INDEX = 0;
94+
const solutionsTab = document.querySelectorAll('div.relative.flex.h-full.w-full')[SOLUTIONS_TAB_INDEX];
9695
if (!solutionsTab) return;
9796

9897
const existingContainer = solutionsTab.parentElement?.querySelector('div.video-container');
@@ -106,7 +105,8 @@ function addVideo(title: string) {
106105
problem.videos[currentVideoIndex].embedded_url,
107106
problem.videos[currentVideoIndex].channel,
108107
);
109-
solutionsTab.parentElement?.insertBefore(container, solutionsTab);
108+
const firstChild = solutionsTab.firstChild; // Get the first child of solutionsTab
109+
solutionsTab.insertBefore(container, firstChild); // Insert the container before the first child
110110

111111
prevButton?.addEventListener('click', () => {
112112
currentVideoIndex = (currentVideoIndex - 1 + problem.videos.length) % problem.videos.length;

0 commit comments

Comments
 (0)