this post was submitted on 24 Jun 2023
28 points (96.7% liked)

Lemmy Plugins and Userscripts

2145 readers
1 users here now

A general repository for user scripts and plugins used to enhance the Lemmy browsing experience.

Post (or cross-post) your favorite Lemmy enhancements here!

General posting suggestions:

Thanks!

founded 1 year ago
MODERATORS
 

Next up is to actually rewrite post links, which is probably the most interesting feature.

you are viewing a single comment's thread
view the rest of the comments
[–] Limeey@lemmy.world 1 points 1 year ago (2 children)

was thinking this would best be a browser extension instead of a greasemonkey script. seems fairly trivial from that perspective. what do you think of collaborating on that?

Was thinking that the best user experience would be a banner message saying "Open this {lemmy|kbin} {post|community|magazine} in your home instance?" which can be dismissed or accepted.

[–] Azzu@lemm.ee 3 points 1 year ago* (last edited 1 year ago) (1 children)

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

[–] Limeey@lemmy.world 1 points 1 year ago* (last edited 1 year ago) (1 children)

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

[–] Azzu@lemm.ee 1 points 1 year ago* (last edited 1 year ago) (1 children)

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.

[–] Limeey@lemmy.world 1 points 1 year ago

Hm that was not my experience. I’ll try again tomorrow and report back

[–] Azzu@discuss.tchncs.de 1 points 1 year ago* (last edited 1 year ago)

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