Greasy Fork is available in English.

Youtube HD

Select a youtube resolution and resize the player.

< Feedback on Youtube HD

مراجعة: Good - script works

§
Posted: 20-10-2023

Use local storage for settings? When the script updates, I have to update the settings. But it often updates when I'm not paying attention or have notifications disabled (in do-not-disturb mode for example), so I don't see that it got updated. If you used local storage for settings, you'd be able to query the values from storage instead of encoding them into the file.

For a really simple example where settings have to be modified through the userscript manager (in Values tab for violentmonkey):

let settings = {
  changeResolution: true,
  preferPremium: true,
  targetRes: "hd1080",
  ...
}

for (const key in settings) {
  settings[key] = GM_getValue(key, settings[key]);
}

If you want to provide a GUI for the settings, here's an example of that.

§
Posted: 20-10-2023

Oh, but you'd also need to add the meta tag @grant GM_getValue to the header. And GM_setValue if you want to set the default values in user storage to make them easier for users to change.

adisibمؤلف
§
Posted: 20-10-2023

I probably should.

Pros:
- People don't have to manually update if they use modified settings.

Cons:
- Not familiar for existing users. I could imagine someone deciding to change a value and editing the script to do it and then wondering why it didn't change or thinking there is a bug somewhere because it didn't.
- Makes the script technically bigger, more complicated, and slower. The greasepot wiki specifically states "Doing many gets/many sets can be slow", but I don't know what kind of hardware you need before that actually becomes an issue. It is unlikely to introduce new bugs but that is always a concern.
- There could be obscure/custom user script managers that don't implement those standard APIs. I would want to make sure that it shouldn't break for any of those.

The reason the script doesn't have it is more historical than for any point against it. I originally didn't expect many people to use it or for it to need to be updated much if at all. I certainly think it is better for me to take the time to implement settings storage than for many others to have to take the time because I didn't, so it is probably time I actually add it. I wouldn't want to make an update just for this, but if I remember I'll probably go ahead and implement settings storage next time I make an update.

adisibمؤلف
§
Posted: 25-10-2023

This has now been implemented in version 2023.10.24. Please let me know if you have any feedback.

§
Posted: 25-10-2023

Awesome, thanks! Settings storage is working perfectly for me.

§
Posted: 26-10-2023

How do I access these new(?) settings via Greasemonkey in Chrome? For me this script just stopped working irrespective of me setting overwriteStoredSettings to true (or false).

Now the script just enables theater mode by default – all other settings are ignored. (As described in this issue.)

adisibمؤلف
§
Posted: 27-10-2023

I'm assuming you mean tampermonkey if you are using chrome, but really right now the way to change the settings is by changing them and having overwriteStoredSettings set to true so that they get applied. If it is false then it will use what was saved since you first ran the script or last had overwriteStoredSettings as true.

There was a bug I made though in my last change that caused the script to break when configuring the script to change the player size. I have put out a fix, so please update and let me know if it is working for you now.

§
Posted: 27-10-2023

You were right, I meant Tampermonkey, sorry. And yes, with the latest update and overwriteStoredSettings: true it works again as intended. Thank you very much!

Post reply

تسجيل الدخول إلى مرحلة ما بعد الرد.