originally posted here: https://hexbear.net/comment/3702575

I slapped together a userscript to auto-collapse comment chains made by users not from hexbear.net or lemmygrad.ml. Hope this helps people who aren’t happy about federation to not have to see the eye-wateringly bad takes (I recommend combining this with setting your defaults to browse posts by Local and Hot to not see posts from other instances and not use the struggle-session sort aka Active). You can use it by installing the TamperMonkey/ViolentMonkey extension in your browser and then creating a new script and copy/pasting the following into it:

// ==UserScript==
// @name         Lib Blocker
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Block federated users on hexbear.net
// @author       YearOfTheCommieDesktop
// @match        https://hexbear.net/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @require      https://cdn.jsdelivr.net/gh/CoeJoder/waitForKeyElements.js@v1.2/waitForKeyElements.js
// @grant        none
// ==/UserScript==

function processComment(comment) {
    var link = comment.querySelectorAll('a[title="link"]');
    if (link.length >= 2 && (!link[1].href.includes("hexbear.net") && !link[1].href.includes("lemmygrad.ml"))) {
        comment.querySelector('button[aria-label="Collapse"]').click();
    }
    return true;
}