Userscripts are more portable than extensions. There’s also basically no reason for this to be an extension, what features does being an extension provide which this would benefit from?
You made me second guess myself, and I’m not entirely sure what to believe.
The GM.setValue documentation says
… persist simple values across page loads and across origins.
But using your script I don’t see that’s the case. I go to a lemmy instance, open options, set my home, and then go to a new instance, and the home is not saved. I was under the impression that the best way to solve this was an extension which can access sandboxed files (which you could write to instead of the localstorage). Or we could deploy a rest api that can hold that info, I guess that doesn’t need to be an extension though.
I’m not entirely sure now. Let me know if I’m way off base.
PS. Also you replied twice.
EDIT: ok so based on my research setValue is using a storage that is based on the script name… so then it should work. I’m not sure why mine isn’t working. But regardless, I am using another script from lemmy_monkey that alters the layout and seems to be conflicting with the design you’ve implemented… I will look at making a PR that I think will provide a better UX.
But still, please explain if I am off base on this because I’m fairly new with the GM library. > h
I’m not sure what you’re doing. If you “go to a lemmy instance, open options, set my home, and then go to a new instance, and the home is not saved” then I think you’re doing it wrong.
If you press “Make this my home instance for URL rewriting” then the button should disappear. If you then go to another instance, also into the settings, then of course there the button “Make this my home instance for URL rewriting” will be there again, because this new instance is not your home, you just made the other one your home. Your home has been saved correctly if, at your home instance, there is NO button “Make this my home instance for URL rewriting” anymore. But at every other instance this button should be there, because all other instances are not your home.
And yes, you understood correctly how GM.setValue works.
PS. I deleted one of the comments, but apparently that has not been federated.
Userscripts are more portable than extensions. There’s also basically no reason for this to be an extension, what features does being an extension provide which this would benefit from?
It’s definitely fine to collaborate, just make an issue/PR here: https://gitlab.com/azzurite/lemmy-universal-link-switcher
You made me second guess myself, and I’m not entirely sure what to believe.
The
GM.setValue
documentation saysBut using your script I don’t see that’s the case. I go to a lemmy instance, open options, set my home, and then go to a new instance, and the home is not saved. I was under the impression that the best way to solve this was an extension which can access sandboxed files (which you could write to instead of the localstorage). Or we could deploy a rest api that can hold that info, I guess that doesn’t need to be an extension though.
I’m not entirely sure now. Let me know if I’m way off base.
PS. Also you replied twice.
EDIT: ok so based on my research
setValue
is using a storage that is based on the script name… so then it should work. I’m not sure why mine isn’t working. But regardless, I am using another script fromlemmy_monkey
that alters the layout and seems to be conflicting with the design you’ve implemented… I will look at making a PR that I think will provide a better UX.But still, please explain if I am off base on this because I’m fairly new with the GM library. > h
I’m not sure what you’re doing. If you “go to a lemmy instance, open options, set my home, and then go to a new instance, and the home is not saved” then I think you’re doing it wrong.
If you press “Make this my home instance for URL rewriting” then the button should disappear. If you then go to another instance, also into the settings, then of course there the button “Make this my home instance for URL rewriting” will be there again, because this new instance is not your home, you just made the other one your home. Your home has been saved correctly if, at your home instance, there is NO button “Make this my home instance for URL rewriting” anymore. But at every other instance this button should be there, because all other instances are not your home.
And yes, you understood correctly how
GM.setValue
works.PS. I deleted one of the comments, but apparently that has not been federated.
Hm that was not my experience. I’ll try again tomorrow and report back