-
-
Notifications
You must be signed in to change notification settings - Fork 70
Add option to display time in UI #299
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
base: main
Are you sure you want to change the base?
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 the PR. There's a few changes I would like you to make.
Finally implement the visibility based on ytlr-watch-default hybridnavfocusable attribute, more effective and simpler. |
}); | ||
} | ||
|
||
destroy() { |
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.
Use explicit resource management instead of a destroy
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.
But as I can see, this executes Dispose, when the class has a certain life cycle, if events are running inside you have to finish it manually anyway
src/watch.js
Outdated
for (const mutation of mutations) { | ||
const value = mutation.target.getAttribute('hybridnavfocusable'); | ||
// Hide watch when player is focused | ||
this.#watch.style.display = value === 'true' ? 'none' : 'block'; |
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.
This can most likely be done in pure CSS using a sibling combinator. Have you investigated that?
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.
But it is not a child or sibling element, and it cannot be if we want to use it before the video element appears
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.
Since we can't use :has
due to performance issues with the polyfill, you're correct. But fyi, in modern browsers, you can do this:
.webOs-watch {
display: block;
}
:has(.ytlr-watch-default[hybridnavfocusable="true"]) ~ .webOs-watch {
display: none;
}
src/watch.js
Outdated
startClock() { | ||
const nextSeg = (60 - new Date().getSeconds()) * 1000; | ||
|
||
const formater = new Intl.DateTimeFormat(navigator.language, { |
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.
formatter
, not formater
.
It displays the time in the top right corner of the screen, disappears when playback starts, and returns when the video is paused.