• 0 Posts
  • 1 Comment
Joined 1 year ago
cake
Cake day: June 20th, 2023

help-circle
  • Thanks! This works pretty well for now, until a more integrated solution comes along. I made a slight modification, since the original script only works when you’re at the community level. This version redirects community URLs as before, but also redirects any non-matching URLs to the search form of your home instance. It seems to work pretty well for posts. Comments and user profiles have some issues- searching comments works as long as the user is commenting on their own instance, and searching profiles works as long as the user is registered with that instance.

    javascript:(() => { const inst = "lemmy.world"; const m = location.href.match(/(?:.*)\/c\/(.*(?=\/)|.*$)/i); if (m) { location.href = `https://${inst}/c/` + m[1] + "@" + location.host.toString(); } else if (location.host !== inst) { const q = new URLSearchParams(); q.append('q', location.href); location.href = `https://${inst}/search?${q.toString()}`; }})()