Reddit remove avatars

Remove the reddit avatars for easier reading.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

Advertisement:

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

Advertisement:

// ==UserScript==
// @name         Reddit remove avatars
// @name:de      Entferne Reddit Profilbilder
// @version      1.0.1
// @description  Remove the reddit avatars for easier reading.
// @description:de Entfernt alle Profilbilder aus den Kommentaren auf Reddit.
// @author       Drados
// @match        https://www.reddit.com/r/*
// @license      GPL-3.0 license
// @grant        GM_addStyle
// @run-at document-idle
// @namespace https://greasyfork.org/users/1559751
// ==/UserScript==


// this prevents usernames from being cut off
// opacity-30 removes the stupid background bloom on posts
GM_addStyle ( `
.overflow-hidden {
  overflow: unset;
}
.text-neutral-content {
  overflow: hidden !important;
}
` );

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

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

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

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