Reddit Promotion Blocker

Blocks all of the promoted advertisements on Reddit.

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 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 Promotion Blocker
// @namespace    http://tampermonkey.net/
// @version      0.5.3
// @description  Blocks all of the promoted advertisements on Reddit.
// @author       Aiden Charles
// @match        http://reddit.com/*
// @match        https://reddit.com/*
// @match        http://www.reddit.com/*
// @match        https://www.reddit.com/*
// @match        http://old.reddit.com/*
// @match        https://old.reddit.com/*
// @require      https://code.jquery.com/jquery-3.4.1.slim.min.js
// @grant        none
// ==/UserScript==

(function() {
    console.log("Reddit promotion blocker script is running!");

    var observer = new MutationObserver(function() {
        if (window.location.hostname == "old.reddit.com") {
            $("span:contains('promoted')").parent().parent().parent().parent().parent().hide();
            $("div").find(".ad-container").parent().hide();
            $("span").find(".promoted-tag").parent().parent().hide();
        }
        else {
            $("shreddit-ad-post").hide();
            $("shreddit-comments-page-ad").hide();
            $("shreddit-comment-tree-ad").hide();
            $("shreddit-async-loader[bundlename='sidebar_ad']").hide();
            $("shreddit-async-loader[bundlename='feed_announcement']").hide();
            $("div[data-before-content='advertisement']").parent().parent().parent().hide();
            $("div").find(".adsense-ad").parent().parent().hide();
            $("span").find(".promoted-tag").parent().parent().hide();
            $("div").find(".promotedlink").hide();
        }
    });

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