fix: Small codebase refactor to fix shortcuts for DOM buttons #976
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sorry for the latency, I'm really slow because its extremely hot.
I can see that codebase doesn't use JSDoc but I have added some types to simplify refactoring and ensure that it won't break anything. Trust me, typed codebases are awesome!
Also, I have introduced a helper
printError
that shows display errors in that form:Hope you like that! It is more useful than silence.
The main purpose of this PR is to fix (and dynamically find only visible DOM buttons) and click them (usually they're
<a>
):As @Michael82548 pointed out YouTube just changed the page layout. Sometimes, Google can introduce A/B experiments or just leave old page parts right in the DOM! In this case upper DOM is hidden for the user, but actually accessible via JS (selectors). This is how it looks like without
hidden
attribute:Also, that's why YouTube is so slow, because the DOM is extremely heavy and inefficient. One of the forward steps could be to completely rewrite YouTube frontend, this also will allow usage of custom themes, like arwes.
closes #971