Bitcoin Forum
July 26, 2026, 05:35:30 AM *
News: Latest Bitcoin Core release: 31.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Hiding gambling in bitcointalk  (Read 173 times)
rollinsweet (OP)
Jr. Member
*
Offline

Activity: 47
Merit: 10


View Profile
February 03, 2025, 12:23:42 PM
Last edit: February 04, 2025, 12:21:10 PM by rollinsweet
Merited by ABCbits (2)
 #1

sometimes it feels like I'm not sitting in a bitcoin forum, but on a gambling forum.
if someone needs to hide casino-related signatures, enjoy. now I'm adding a hide on personal text related to gambling.
if you want to hide something else, just add keywords

ver 1.1 - released


Code:
// ==UserScript==
// @namespace    https://bitcointalk.org/
// @ver         1.0
// @description  hiding gambling signatures
// @author       rollin
// @match        https://bitcointalk.org/*
// ==/UserScript==

(function() {
    'use strict';

    // keywords for hide signatures
    const gamblingKeywords = [
        'casino', 'bet', 'gambling', 'poker', 'slots', 'stake', '1xbit',
        'wager', 'bonus', 'free spins', 'sportsbook', 'betting', 'jackpot',
        'duelbits'
    ];

    function hideGamblingSignatures() {
        document.querySelectorAll('.signature').forEach(sig => {
            const sigText = sig.innerText.toLowerCase();
            if (gamblingKeywords.some(keyword => sigText.includes(keyword))) {
                sig.style.display = 'none';
            }
        });
    }

    hideGamblingSignatures();

    const observer = new MutationObserver(hideGamblingSignatures);
    observer.observe(document.body, { childList: true, subtree: true });

})();
rollinsweet (OP)
Jr. Member
*
Offline

Activity: 47
Merit: 10


View Profile
February 03, 2025, 01:21:21 PM
 #2

then, when I try to remove the personal text with these keywords, the entire "small text" block gets removed except for the nickname. maybe someone can help with this?
examplens
Legendary
*
Offline

Activity: 4088
Merit: 4791



View Profile WWW
February 03, 2025, 08:07:56 PM
Merited by ABCbits (1)
 #3

sometimes it feels like I'm not sitting in a bitcoin forum, but on a gambling forum.
if someone needs to hide casino-related signatures, enjoy. now I'm adding a hide on personal text related to gambling.
You have a regular option to turn off signature visibility, and considering that at least 90% of signatures are gambling, it seems that this is the option for you. Although it is probably enough to just put the gambling section on hide, the ads in the signature are not too disturbing. In fact, it is an integral part of the forum, largely influencing its activity even today.

then, when I try to remove the personal text with these keywords, the entire "small text" block gets removed except for the nickname. maybe someone can help with this?
I suggest you to follow thread Little things that bug you/me about the forum
There is one or more members who deal with patches for the forum and making custom addons

 
 b1exch.to 
  ETH      DAI   
  BTC      LTC   
  USDT     XMR    
.███████████▄▀▄▀
█████████▄█▄▀
███████████
███████▄█▀
█▀█
▄▄▀░░██▄▄
▄▀██▄▀█████▄
██▄▀░▄██████
███████░█████
█░████░█████████
█░█░█░████░█████
█░█░█░██░█████
▀▀▀▄█▄████▀▀▀
rollinsweet (OP)
Jr. Member
*
Offline

Activity: 47
Merit: 10


View Profile
February 04, 2025, 12:18:30 PM
 #4

Although it is probably enough to just put the gambling section on hide

this is gem for me, thanks.

I have added a toggle (ON/OFF) near the nickname at the top of the site. Also, there is a pencil icon to add or delete keywords that will be blocked in signatures and small text.
Additionally, I found a way to hide the small text message without affecting the entire block.

Code:
// ==UserScript==
// @namespace    https://bitcointalk.org/
// @ver         1.1
// @description  hiding gambling signatures
// @author       rollin
// @match        https://bitcointalk.org/*
// ==/UserScript==

(function() {
    'use strict';

    const defaultKeywords = [
        'casino', 'bet', 'gambling', 'poker', 'slots', 'stake', '1xbit',
        'wager', 'bonus', 'free spins', 'sportsbook', 'betting', 'jackpot',
        'duelbits'
    ];
    let gamblingKeywords = JSON.parse(localStorage.getItem('gamblingKeywords')) || defaultKeywords;
    let isFilterActive = JSON.parse(localStorage.getItem('filterActive')) ?? true;

    function hideGamblingContent() {
        if (!isFilterActive) return;

        document.querySelectorAll('.signature, .quote, .smalltext').forEach(el => {
            if (gamblingKeywords.some(keyword => el.innerText.toLowerCase().includes(keyword))) {
                el.style.display = 'none';
            }
        });

        document.querySelectorAll('.signature a, .smalltext a').forEach(link => {
            if (gamblingKeywords.some(keyword => link.href.toLowerCase().includes(keyword))) {
                link.style.display = 'none';
            }
        });
    }

    function createNicknameControls() {
        const helloMemberSpan = document.getElementById('hellomember');
        if (!helloMemberSpan) return;

        // toggle button
        const toggleButton = document.createElement('button');
        toggleButton.textContent = isFilterActive ? 'Filter: ON' : 'Filter: OFF';
        toggleButton.style.marginLeft = '10px';
        toggleButton.style.padding = '2px 8px';
        toggleButton.style.fontSize = '12px';
        toggleButton.style.cursor = 'pointer';
        toggleButton.style.border = '1px solid #ccc';
        toggleButton.style.background = isFilterActive ? '#28a745' : '#dc3545';
        toggleButton.style.color = 'white';
        toggleButton.style.borderRadius = '5px';

        toggleButton.addEventListener('click', () => {
            isFilterActive = !isFilterActive;
            localStorage.setItem('filterActive', JSON.stringify(isFilterActive));
            toggleButton.textContent = isFilterActive ? 'Filter: ON' : 'Filter: OFF';
            toggleButton.style.background = isFilterActive ? '#28a745' : '#dc3545';
            hideGamblingContent();
        });

        // pencil
        const editButton = document.createElement('button');
        editButton.innerHTML = '✏️';
        editButton.style.marginLeft = '5px';
        editButton.style.padding = '2px 6px';
        editButton.style.fontSize = '12px';
        editButton.style.cursor = 'pointer';
        editButton.style.border = '1px solid #ccc';
        editButton.style.background = '#007bff';
        editButton.style.color = 'white';
        editButton.style.borderRadius = '5px';

        editButton.addEventListener('click', () => {
            const userInput = prompt('Edit blocked keywords (comma separated):', gamblingKeywords.join(', '));
            if (userInput !== null) {
                gamblingKeywords = userInput.split(',').map(word => word.trim().toLowerCase()).filter(word => word !== '');
                localStorage.setItem('gamblingKeywords', JSON.stringify(gamblingKeywords));
                hideGamblingContent();
                alert('Filter list updated!');
            }
        });

        helloMemberSpan.appendChild(toggleButton);
        helloMemberSpan.appendChild(editButton);
    }

    hideGamblingContent();

    const observer = new MutationObserver(hideGamblingContent);
    observer.observe(document.body, { childList: true, subtree: true });

    createNicknameControls();
})();
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!