zubyj/leetcode-explained

Video is not being injected when problem is navigated to. Only injected when refreshing the page.

Closed this issue · 1 comments

zubyj commented
Video is not being injected when problem is navigated to. Only injected when refreshing the page.
zubyj commented

Fixed with commit 24c461a

Updating the manifest with the new pattern "https://leetcode.com/problems/*" made the content script inject-solution-video.js run on all problem pages, including the problem statement and the solutions tab.

Previously, the content script was only running on the specific URL pattern "https://leetcode.com/problems/*/solutions/*", which meant that the script only executed when the URL matched that exact pattern. When navigating between the problem statement and solutions tab, the URL didn't change to match the pattern, so the content script wasn't running.

By changing the URL pattern to "https://leetcode.com/problems/*", the content script is now running on all problem pages. This means that when navigating between the problem statement and solutions tab, the content script is already running, and it can observe the DOM changes and inject the video when the solutions tab becomes visible.

This change resolved the issue because the content script is now active on the problem pages and can detect when the solutions tab is visible without relying on the URL change.