Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Should I make it auto-select the Search field afterwards? (Update: Done! See v1.3.)

About: Automatic Material Dark-Mode for YouTube
After this script has auto-enabled dark mode, the "dark mode" settings panel stays open. So you need to manually click the Search box if you want to type in a video search for something.

I could make this script auto-select the search field. It would make it easier to type something to search for when visiting YouTube, whenever an automatic switchover from Light to Dark happens.

But the downside is that the "Dark Mode" toggle panel will be immediately hidden if I make the search-field get focus. I kinda like the fact that the Dark Mode toggle panel currently stays open, so that users of this script can clearly see the script opening the settings and enabling dark mode.

If I change it to auto-targeting the search box, you'll lose that visual feedback (unless you happen to look at the exact moment the switchover happens). But you'll gain access to easier searching.

So I'd like to ask users for feedback: Should I make this script auto-target the video search field? I'll hold off any change until I get some feedback in this thread, however long that takes. ;-)


  • edited September 2017 Safari
    @bmn Thanks for the feedback, you make a great point: People already expect this script to switch the theme. I will make it select the Search field.

    As for the popup: It's unfortunately necessary. YouTube's own internal scripts responsible for changing themes aren't loaded until the theme panel is opened. So a theme switch cannot be scripted until that panel is opened. :-O Although I will restructure the code a bit to make the switch even faster, so that the panel is seen as little as possible.

    Tomorrow I will start work on the update which enables the search field and speeds up the theme switch.

    This new update/rewrite will be out as soon as I have time.
  • edited September 2017 Safari
    @bmn I have released 1.2 now, which automatically selects the search-field.

    I'll now casually work on 1.3 which will speed up the theme switching to be as fast as YouTube can handle.
  • edited September 2017 Safari
    @bmn Glad you're enjoying the update! I wanted to get the 1.2 "search field focus" update out fast in case the other rewrite would take a few days.

    Well, good news, I kept working on it all day! Version 1.3 is also out now!

    I've rewritten all code, literally: There were a few problems with speeding things up this much (YouTube wasn't saving the theme-switch), which almost made me think the speedup was impossible, but I managed to find the reason and solve those problems.

    This new version now runs through all steps as fast as your web browser (and YouTube) is capable of. The settings panel just briefly flickers and then it's done with the theme switch! :-)

    Thanks for your feedback. This was definitely a worthwhile update and made the script slicker. Enjoy, and have fun! ;-)

    PS: I highly recommend also installing Stylish and this userstyle: It's a tweak for YouTube's dark theme which makes the colors less harsh. It's awesome.
  • edited September 2017 Safari
    Wow, I had no idea that YouTube's settings menu HTML is different when you're logged in and that it didn't work there. I almost never log in, and I always visited the normal first and signed in from there *after* it had already switched to the dark theme. I'm very thankful that you brought this up, so that every scenario can be handled properly.

    Version 1.4 is now out and perfectly handles their logged in website too. This should be the final version until the day that YouTube changes their design again. Hopefully their new "Material Design" site will stay the same for a few years. But either way, I use the script myself (I hate watching videos on a bright, white background), so I'll fix it as soon as I notice anything going wrong, hehe. And I'm sure users will let me know too. ;-)

    Thanks for your feedback and help, and take care! :-)
  • @bmn Hey, if you're still reading this, I'd just like to notify you that I've created a second script to solve another constant annoyance: YouTube's privacy policy bar, which constantly appears when you clear your cache. Ugh! But no more! ;-)
Sign In or Register to comment.