i find it annoying to have to manually change urls to subscribe to a community outside lemmy.world, so i wrote a bookmarklet to quickly switch to the lemmy.world instance
to use, just drag the following code to your bookmarks bar (name it whatever you like), then click it when you want to use it
javascript:(
function() {
// make sure to change this if using on a different instance
const myInst="lemmy.world";
let currUrl=window.location.toString().split("/");
let currInst=currUrl[2];
currUrl[2]=myInst;
// fix for kbin using "m" instead,
// without overriding /u/ for user
if (currUrl[3]=="m") {
currUrl[3]="c";
}
let newUrl=currUrl.join("/");
// fix for already foreign instances (e.g. lemm.ee/c/[email protected])
if (!currUrl[-1].includes("@")) {
newUrl=newUrl+"@"+currInst;
}
window.location=newUrl;
})
()
javascript:(
function() {
// make sure to change this if using on a different instance
const myInst="lemmy.world";
let currUrl=window.location.toString().split("/");
let currInst=currUrl[2];
currUrl[2]=myInst;
currUrl[3]="c"; // fix for kbin using "m" instead
let newUrl=currUrl.join("/")+"@"+currInst;
window.location=newUrl;
})
()
update 2023-06-27: add compatibility for kbin magazines
update 2023-07-01: compatibility with users, kbin, and already foreign instances
i'll be honest, i'm not sure what that's for? is it moving to another account if you want to change your home instance? if so, that's a good idea, i could add it to the post if you want in case this comment gets buried