this post was submitted on 23 Jun 2023
49 points (100.0% liked)
Lemmy Plugins and Userscripts
2148 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:
- Preface the submission with the type of enhancement - ex: [UserScript].
- Include a screenshot of the enhancement in use (where possible)
- Indicate the requirements for use (eg, greasemonkey, stylus, etc.)
Thanks!
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
What addon are you using for userscripts?
Greasemonkey
Alrighty, try updating, I've released a new version.
Got the 'home instance' dialog this time. Briefly checked it out, some of the links seem to be now directed towards my home instance, but there are no icons beside any link to show the original link as indicated in the description above.
Edit: Noticed the following error in the console:
Source map error: Error: URL constructor: tippy-bundle.umd.min.js.map is not a valid URL. Resource URL: user-script:http%3A//azzurite.tv//Lemmy%20-%20Rewrite%20Links%20to%20Home%20Instance Source Map URL: tippy-bundle.umd.min.js.map
That error's irrelevant. Can you check that you have version 1.0.2 not 1.0.1?
Ah, yes. It's 1.0.1. Let me upgrade once again.
Yep I fucked up :D
I have 1.0.1. An attempted update shows 'No newer update available.'
Go to https://greasyfork.org/en/scripts/469273-lemmy-rewrite-links-to-home-instance and press the button there. There's probably some throttling or whatever.
Got it. Upgraded to 1.0.2.
Still no icons to the right of links.
Maybe try violentmonkey instead of greasemonkey, which does not seem to be in development anymore.
Gave violentmonkey a try. Your script worked perfectly immediately. So yeah, something in greasemonkey was causing the issues.
Thanks for writing this, looks great so far!!
Yeah, that's not a bad idea. I think I'll give that a try a bit later when I get some time, as I'll have several scripts I'll need to move over to it.
...and I spoke too soon. Worked fine when I installed it. As soon as I went to another page on the instance it stopped working again. No icons, no button in settings. No idea what's going on.
Does it work again when you do a full refresh? So F5/press enter in the adress bar? If so then somehow listening to page changes is broken for you, lemmy doesn't actually load new pages when you click on an (instance-local) link, it just exchanges all the content within the currently loaded page.
It does not. I've tried that several times. Also tried opening a new tab and typing the site url directly.
I'm going to add a lot of logging and then give you a new version to try, then you can give me logs so I can diagnose this. There must be something weird about your setup, though I can't guess what.
Yup, that's my thinking too that there must be something weird going on here, though I can't imagine what.
Just for fun, I fired up Chrome instead of Firefox, installed violentmonkey, installed your script, and am having the exact same issue there! I did get the dialog asking me to set the home instance, which I did, but no button in settings and no icons. No idea what's going on.
Wild idea, but could it just be that you're using it wrong? :D if you're on lemmy.ca then almost nothing should be rewritten because almost all links already go to lemmy.ca. Only when you go to another instance somehow or a user posts a link, for example this one then it should be rewritten.
Anyway though, here is a debug version of the script: https://gitlab.com/-/snippets/2561468/raw/main/lemmy.user.js
To use, open the browser console, unselect all message types at the top right (errors, warnings, logs...) except for the "Debug" message type, then reload the page and right-click -> send me all messages.
I did think of that! Sure wouldn't be the first time I've done something like that, hehehe!! But no. For example, I'm on lemmy.ca, so I tried going to lemmy.ml and lemmy.world to see what the links looked like there. One of those I have a different account which I was logged in to, and the other I have no account so wasn't signed in. Nothing.
However, I've been trying a few things here, including disabling all my other extensions and scripts, which didn't make any difference. So then I left every extension disabled, removed your script, removed the few other scripts I installed in violentmonkey, removed violentmonkey, reinstalled violentmonkey and your script....and it was working again once more. So, I figured some other script or extension was causing havoc, so I renabled the other extensions and reinstalled the other scripts one by one, checking each time. They're all enabled again. Still working. I dunno....... Obviously something really weird is happening on my end. Right now, it's working, so I'll let you know if it starts to act odd again. My thinking right now is some other extension or script was messing something up big time, and all the disabling and re-enabling sorted it out somehow.
My working hypothesis right now: The issue wasn't your script, it was something else on my system.
Thanks for your help with this, btw!
Very weird :D glad it works now though :)
Me too. I went back and checked Chrome, and that was indeed my fault. I was being a doorknob, and so led myself astray, lol.
Still working, so far! :)
Yeah no idea, you can change
DEBUG
fromtrue
tofalse
and see if it's outputting any messages at all. I'd probably need to do some more advanced debugging steps, idk if you're willing to do that