With the search being partially broken ATM, it’s a bit annoying to open another community (https://lemmy.world/c/selfhosted) in kbin (https://kbin.social/m/selfhosted@lemmy.world)

There’s an extension for firefox that transforms links found in comments, but it doesn’t work if you’ve already got the community open in its original site.

I’ve just put together a quick and dirty js bookmarklet for this (mostly for myself, but I figured I’d post it in case anyone else finds it useful).
You basically save this code as a bookmark, and just click it when you’re in a community on another site to be taken to that communiy on kbin:

javascript:(function()%7Blet%20reg%20%3D%20window.location.href.match(%2Fhttps%3F%3A%5C%2F%5C%2F(.*)%5C%2F%5Bcm%5D%5C%2F(%5Ba-zA-Z%5D%2B)%5C%2F%3F.*%2F)%3B%0Awindow.location.href%20%3D%20%60https%3A%2F%2Fkbin.social%2Fm%2F%24%7Breg%5B2%5D%7D%40%24%7Breg%5B1%5D%7D%60%3B%7D)()%3B

The original, unminified code is just

let reg = window.location.href.match(/https?:\/\/(.*)\/[cm]\/([a-zA-Z]+)\/?.*/);
window.location.href = `https://kbin.social/m/${reg[2]}@${reg[1]}`;

Unfortunately it doesn’t work for threads (seems like they’re a bit more complex than a quick find and replace), you need to be on the frontpage of the community

  • Kaldo@kbin.social
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    Hmm, might be a good workaround but dunno why is it now opening the page - I kept getting 404 errors on it before, I’m 100% certain. I subscribed now too so I’ll see if it starts getting populated over time.