this post was submitted on 11 Jun 2023
26 points (100.0% liked)

Lemmy.World Announcements

29099 readers
35 users here now

This Community is intended for posts about the Lemmy.world server by the admins.

Follow us for server news ๐Ÿ˜

Outages ๐Ÿ”ฅ

https://status.lemmy.world

For support with issues at Lemmy.world, go to the Lemmy.world Support community.

Support e-mail

Any support requests are best sent to [email protected] e-mail.

Report contact

Donations ๐Ÿ’—

If you would like to make a donation to support the cost of running this platform, please do so at the following donation URLs.

If you can, please use / switch to Ko-Fi, it has the lowest fees for us

Ko-Fi (Donate)

Bunq (Donate)

Open Collective backers and sponsors

Patreon

Join the team

founded 2 years ago
MODERATORS
26
submitted 1 year ago* (last edited 1 year ago) by Zeus to c/lemmyworld
 

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(){const myInst="lemmy.world";let currUrl=window.location.toString().split("/");let currInst=currUrl[2];currUrl[2]=myInst;if(currUrl[3]=="m"){currUrl[3]="c";}let newUrl=currUrl.join("/");if(!(currUrl[-1].includes("@"))){newUrl=newUrl+"@"+currInst;}window.location=newUrl;})()

readable version:

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;
	})
()

old version

javascript:(function(){const myInst="lemmy.world";let currUrl=window.location.toString().split("/");let currInst=currUrl[2];currUrl[2]=myInst;currUrl[3]="c";let newUrl=currUrl.join("/")+"@"+currInst;window.location=newUrl;})()

readable version:

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

you are viewing a single comment's thread
view the rest of the comments
[โ€“] Yoru 1 points 1 year ago

I didn't want to use it but I didn't see any other way to tackle the cors issue