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

Lemmy Plugins and Userscripts

2145 readers
1 users here now

A general repository for user scripts and plugins used to enhance the Lemmy browsing experience.

Post (or cross-post) your favorite Lemmy enhancements here!

General posting suggestions:

Thanks!

founded 1 year ago
MODERATORS
 

If you try to access a community on your local instance and it gives you a 404, this automatically takes you to your local instance's search instead and puts the community in for you.

Recommended to use with https://sh.itjust.works/post/33762](local instance redirect script) by @[email protected]

I started using Tampermonkey today, so dunno if this works with GreaseMonkey, but I assume it does.

// ==UserScript==
// @name         Lemmings Redirect
// @version      1.0
// @description  Redirect to your local Lemmy instance
// @author       @reddthat.com/u/Fanghole
// @match        https://*/c/*@*
// @icon         https://join-lemmy.org/static/assets/icons/favicon.svg
// ==/UserScript==

var unknownLemmy =
  document.body.textContent === "404: couldnt_find_community";

if (unknownLemmy) {
    // Get URL info
    var splitUrl = location.href.split("/");
    var split2 = splitUrl[4].split("@");
    var instanceUrl = split2[1];
    var community = split2[0];
    var searchUrl =
        "https://" + splitUrl[2] + "/search/q/!" + community + "%40" + instanceUrl + "/type/All/sort/TopAll/listing_type/All/community_id/0/creator_id/0/page/1";

    window.location.replace(searchUrl);
}
no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here