Reddit remove avatars

Remove the reddit avatars in the comments and post list for easier reading.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Reddit remove avatars
// @name:de      Entferne Reddit Profilbilder
// @version      1.1.1
// @description  Remove the reddit avatars in the comments and post list for easier reading.
// @description:de Entfernt alle Profilbilder aus den Kommentaren und Beiträgen auf Reddit.
// @author       Drados
// @match        https://www.reddit.com/r/*
// @license      GPL-3.0 license
// @run-at document-idle
// @namespace https://greasyfork.org/users/1559751
// ==/UserScript==


// this removes the stupid background bloom on posts, needs // @grant        GM_addStyle
//GM_addStyle ( `
//.opacity-30 {
//  opacity: 0 !important;
//}
//` );


function removePostListAvatars() {
    let e = document.getElementsByClassName("inline-flex items-center justify-center w-lg h-lg relative ");
    if (e) {
        for (let i = 0; i < e.length; i++) {
            e[i].remove();
        }
    }
}

function removeCommentAvatarDivs() {
    const divs = document.querySelectorAll('div[slot="commentAvatar"]');
    divs.forEach(div => div.remove());
}


function updateUsernameMargin() {
    const elements = document.querySelectorAll('.author-name-meta');
    let parent_node;
    elements.forEach(element => {
        // move usernames to the left, changing this to -2 will look better but the collapsed comment button will overlap
        element.style.marginLeft = '-1.5rem';
        parent_node = element.parentNode;
        parent_node.style.overflow = "visible";
        parent_node = parent_node.parentNode;
        parent_node.style.overflow = "visible";
        parent_node = parent_node.parentNode;
        parent_node.style.overflow = "visible";
        parent_node.parentNode.style.overflow = "visible";
    });
}


const observer = new MutationObserver((mutationsList) => {
    for (let mutation of mutationsList) {
        if (mutation.type === 'childList') {
          updateUsernameMargin();
          removeCommentAvatarDivs();
          removePostListAvatars();
        }
    }
});


observer.observe(document.body, { childList: true, subtree: true });