Skip to content
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

Update themes.js ytd-masthead is handled by CSS now #2247

Merged
merged 1 commit into from
May 7, 2024
Merged

Update themes.js ytd-masthead is handled by CSS now #2247

merged 1 commit into from
May 7, 2024

Conversation

raszpl
Copy link
Contributor

@raszpl raszpl commented May 6, 2024

No description provided.

@ImprovedTube ImprovedTube merged commit ef0e48c into code-charity:master May 7, 2024
@ImprovedTube
Copy link
Member

ImprovedTube commented May 7, 2024

hi @raszpl, btw, would like to make an update to the stores, but our slider values are not stores (speed or volume or shortcuts). and core.js will say Uncaught TypeError: Failed to set the 'playbackRate' property on 'HTMLMediaElement': The provided double value is non-finite.

  • and maybe? :

just because (at mine) search currently stayed visible now in the categories, unlike before.

... Ill fix that later.

(after that, will have to test manifest3 and convert some stuff because it will be enforced June 1.)

@raszpl raszpl deleted the patch-1 branch May 7, 2024 01:06
@raszpl
Copy link
Contributor Author

raszpl commented May 7, 2024

hi @raszpl, btw, would like to make an update to the stores, but our slider values are not stored. (Uncaught TypeError: Failed to set the 'playbackRate' property on 'HTMLMediaElement': The provided double value is non-finite. ) `

Just downloaded master.zip, copied over and it doesnt crash for me loading video and playing at faster speed, so ill need more info. Can you paste whole error message with line numbers?
If its anything in playerPlaybackSpeed Im not touching that function, its a nightmare fuel :)

@ImprovedTube
Copy link
Member

ImprovedTube commented May 7, 2024

volume slider also isn't remembering the value, same for the sliders in shortcuts @raszpl

@ImprovedTube
Copy link
Member

* search field: almost fixed. except for chrome://extensions/?options=......

thank you!

@raszpl
Copy link
Contributor Author

raszpl commented May 7, 2024

and --ytd-searchbox-text-color needs defining for all styles, defaults to black or white depending on cookie, probably should be same color as normal text in all themes

@raszpl
Copy link
Contributor Author

raszpl commented May 7, 2024

  • search field: almost fixed. except for chrome://extensions/?options=......

CSS looks screwed on my end, like its not fitting into the window and has forced scroll bars?

@ImprovedTube
Copy link
Member

ImprovedTube commented May 7, 2024

slider values aren't stored since 220d429


chrome://extensions/?options=......

( more relevant than one might think https://www.youtube.com/watch?v=SLfff7Kw_Xc&t=170s )


scroll bars

yes, another thing. (i got to reduce index.html height again, or target that mode somehow.
(can also open it it's own tab in future and add embedded player preview & playlist / history)

@raszpl
Copy link
Contributor Author

raszpl commented May 7, 2024

slider values broke in one of your commits to satus.js

#2249

chrome://extensions/?options=......

( more relevant than one might think https://www.youtube.com/watch?v=SLfff7Kw_Xc&t=170s )

?

scroll bars

yes, another thing. (i got to reduce index.html height again, or target that mode somehow. (can also open it it's own tab in future and add embedded player preview & playlist / history)

so is not "* search field: almost fixed. except for chrome://extensions/?options=....." ? search works fine in chrome://extensions/?options=lodjfjlkodalimdjgncejhkadjhacgki
that window on options is 400x500. I also dont know how to make it happy :)
edit: I just went back to 4.805 and it was already screwed in that version

--ytd-searchbox-text-color

the color is fine in all themes

its hardcoded black on light/device theme YT cookie, and hardcoded white on dark YT theme cookie. We need to override it to normal text color on all themes since we wont be touching YT cookie.

@ImprovedTube
Copy link
Member

ImprovedTube commented May 7, 2024

(yes, sorry, forget chrome://extensions/?options, can fix it with height 572 instead of 600)
i just was mistaken thinking #2248
would restore the original behavior, where search doesn't cover the back button / category headers

--ytd-searchbox-text-color

oh, right that!
(aand youtube's dark theme & shortcut for the same need cookie to stick. not sure how many people are used to exactly that)

@raszpl
Copy link
Contributor Author

raszpl commented May 7, 2024

--ytd-searchbox-text-color

oh, right that!

even just using our Black theme screws searchbox doing black text on black :)

(aand youtube's dark theme & shortcut for the same need cookie to stick. (not sure how many people use it)

Instead of manipulating cookies It would be safest to manually add [dark] in same two spots YT adds it, ~same effect as YT cookie minus YT hardcodes we should have more or less all overriden by now

Finally figured out why this weird piece of code doubling up listeners making Search be called twice
6505298
it was needed for blur listener, fixed #2250 search automagically closes again when empty and we click below

@ImprovedTube
Copy link
Member

thank you! @raszpl

cookie

to stick beyond reload. this doesnt: ac807b8

could for the first time correctly set any of the 6 values for f6= (80000 80001 400 401 1 none), only based on user input not on page load

youtube's dark & none/default (=let youtube re-inherit system setting?)
( youtube's light button/shortcut not yet existing)` )

@raszpl
Copy link
Contributor Author

raszpl commented May 8, 2024

thank you! @raszpl

cookie

to stick beyond reload. this doesnt: ac807b8

Currently our [YouTube's dark] theme doesnt work. Maybe ideally after fixing it shortcutDarkTheme should be switching between [default] and [YouTube's dark] theme?

[YouTube's dark] should either copy all of YT CSS (bad), or

document.documentElement.setAttribute('dark', '');
document.querySelector('ytd-masthead').setAttribute('dark', '');

except we cant do the second one in ImprovedTube.setTheme() because ytd-masthead doesnt exist that early :( Maybe additional check at

} else if (name === 'YTD-MASTHEAD') {


afaik those are not necessary anymore:
https://github.com/code-charity/youtube/blob/da7935a8576d1bde54852b3876897ce45e786678/js%26css/web-accessible/www.youtube.com/shortcuts.js#L630C3-L630C72
https://github.com/code-charity/youtube/blob/da7935a8576d1bde54852b3876897ce45e786678/js%26css/web-accessible/www.youtube.com/shortcuts.js#L640C2-L640C84

you dont check for existence of ytd-masthead. YT creates ytd-masthead while loading rather late so it has potential of crashing if someone clicks while page loads

document.documentElement.setAttribute('dark', '');

should also set [dark] on ytd-masthead

https://github.com/code-charity/youtube/blob/da7935a8576d1bde54852b3876897ce45e786678/js%26css/web-accessible/www.youtube.com/shortcuts.js#L635C45-L635C58

what is this.elements.dawn ?

https://github.com/code-charity/youtube/blob/da7935a8576d1bde54852b3876897ce45e786678/js%26css/web-accessible/www.youtube.com/shortcuts.js#L636C8-L639

it-themes? afaik should be it-theme. .hasAttribute returns boolean so there is no need for further comparisons, simple
if (document.documentElement.hasAttribute('it-theme')) { document.documentElement.removeAttribute('it-theme'); }
will suffice

finally

ImprovedTube.myColors(); ImprovedTube.setTheme();

will not restore theme after previous code removing it-theme, you need to manually create it-theme

if (this.storage.theme) {
document.documentElement.setAttribute('it-theme', this.storage.theme);
}

@raszpl
Copy link
Contributor Author

raszpl commented May 8, 2024

something like this #2253
now I need to figure out why shortcuts down work in my build :)
EDIT: oh, shortcuts never fully worked? I went back to 4.702 and its also broken in same way - shortcuts require page reload after configuring to start working? was it always like that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants