Remove annoying users from StackOverflow

Masks out the comments and the names of users you don't like on StackOverflow

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @namespace https://trajano.net
// @name     Remove annoying users from StackOverflow
// @description Masks out the comments and the names of users you don't like on StackOverflow
// @version  1
// @include  https://stackoverflow.com/*
// @grant    none
// @license EPL-2.0
// ==/UserScript==
(function() {
    'use strict';

    const ids = [-1, 1507691, 216691, 3001761, 4216641];
    const selector = ids.map(( id ) => `[data-comment-owner-id="${id}"]`);
    const styles = `
        ${selector.map( s => `${s} .comment-copy > *`)},
				${selector.map( s => `${s} .comment-date > *`)} {
            color: transparent;
            background: rgba(0, 0, 0, 0.15);
        }
        ${selector.map( s => `${s} div a.comment-user`)} {
            display: none;
        }
    `;

    document.head.appendChild(
        document.createElement("style")
    ).innerHTML = styles;

    function maskComments () {
        document.querySelectorAll(selector.join(',')).forEach(createMask);
    }

    function createMask ( element ) {
        const commentCopy = element.querySelector(".comment-copy");
        for ( const child of commentCopy.childNodes ) {
            if ( child.nodeName === "#text" && child.nodeValue !== " " ) {
                const fragment = document.createDocumentFragment();
                for ( const token of child.nodeValue.split(" ") ) {
                    const span = document.createElement("span");
                    span.textContent = token;
                    fragment.append(span, " ");
                }
                commentCopy.replaceChild( fragment, child );
            }
        }
    }

    maskComments();

})();