Violentmonkey - Nostr.ch Chatbox Filter

Filters spam messages from Nostr chatbox based on specified pattern - Tested with Chromium

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Violentmonkey - Nostr.ch Chatbox Filter
// @namespace    NostrChatboxFilter
// @version      1.1
// @description  Filters spam messages from Nostr chatbox based on specified pattern - Tested with Chromium
// @author       gourcetools
// @match        https://nostr.ch/*
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    function hideMessages() {
        // Define the patterns to hide
        const patternsToHide = ['lightning', 'chatgpt', 'free sats', 'nokyc'];

        // Select all message boxes
        const messageBoxes = document.querySelectorAll('.mbox');

        // Iterate through the message boxes
        messageBoxes.forEach((messageBox) => {
            // Get the message text
            const messageText = messageBox.innerText.toLowerCase();

            // Check if the message contains any of the patterns to hide
            const shouldHide = patternsToHide.some((pattern) => messageText.includes(pattern));

            // Hide the message if it contains any of the patterns to hide
            if (shouldHide) {
                messageBox.style.display = 'none';
            }
        });
    }

    setInterval(hideMessages, 1000);
})();