-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve performance #10
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing, but I'm sorry, I don't think this is an improvement.
I don't like the formatting changes, and if anything, I'd be configuring eslint to prefer my style.
In future, please include more explanation and use smaller commits.
@@ -11,122 +11,108 @@ | |||
// @grant none | |||
// ==/UserScript== | |||
|
|||
(function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd thought enclosing the whole thing in a function was important to stop the scope leaking out, but I could be wrong there. Tampermonkey includes it in the template for a new script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tampermonkey uses a very old template. In any browser used today, there is no need to use IEEE functions.
|
||
const playerIsFullscreen = () => { | ||
const player = document.querySelector('ytd-player') | ||
debugPlayerSize(player) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without any explanation as to how performance is improved, I assume you mean it's by not having to log the player size debugging? I never noticed an impact. And it'd be helpful information to supply when reporting an issue, so I'd like to leave it in. If you're concerned about it, a more useful change would be to make it toggleable via config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log
is useful when you are actively debugging the code. I don't think it is useful to print information and fill the dev console from these messages.
|
||
const isWatchVideoPage = () => window.location.pathname == "/watch" | ||
const isWatchVideoPage = () => window.location.pathname === "/watch" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the necessity for all the triple equals?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=== means that the type of the left-hand side is the same as the type of the right-hand side.
Fixes #9