Reddit - remove awards

Removes awards from posts

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey 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.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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        Reddit - remove awards
// @description Removes awards from posts
// @version     0.1
// @namespace   minirock
// @include     https://*.reddit.com/*
// @grant       none
// ==/UserScript==


function filter() {
    var awards = document.querySelectorAll("span[id*='PostAwardBadges']")

    for (let i = 0; i < awards.length; ++i) {
        awards[i].closest("div").remove()
    }

    //////////////////////////////////

    var give_award = Array.from(document.querySelectorAll('span')).filter(el => el.textContent === 'Give Award');

    for (let i = 0; i < give_award.length; ++i) {
        give_award[i].closest("button").remove()
    }

    ////////////////////////////////////

    var share = document.querySelectorAll("button[data-click-id='share']")

    for (let i = 0; i < share.length; ++i) {
        share[i].closest("div").remove()
    }
}

var mutationObserver = new MutationObserver(function(mutations) {
    filter();
});

mutationObserver.observe(document.documentElement, {
    childList: true,
    subtree: true,
});

filter();



// document.addEventListener("keydown", catch_code, false);

// function catch_code(evt) {
//     if (evt.keyCode === 192) {
//         filter();
//     }
// }