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;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;
		let newUrl=currUrl.join("/")+"@"+currInst;
		window.location=newUrl;
	})
()
  • Grenfur@lemmy.one
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Do you know if the process works differently in FireFox? (Note that technically I use Ghostery but it’s based in Firefox). I copied the script to a new bookmark URL and changed lemmy.world to lemmy.one since thats the instance I’m registered on. However, when clicked nothing happens. Is there something I’m missing?