Zero Hedge - Auto-expand Comments

Automatically expands the fun comments.

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        Zero Hedge - Auto-expand Comments
// @match       https://www.zerohedge.com/*
// @version     1.0
// @author      MedX
// @namespace   MedX-AA
// @license     MIT
// @icon        https://s2.googleusercontent.com/s2/favicons?domain=www.zerohedge.com
// @description Automatically expands the fun comments.
// ==/UserScript==

(function() {
    'use strict';

    function clickComments() {
        const buttons = document.getElementsByClassName("BlockComments_showBtn__Ds_Lu");
        if (buttons.length > 0) {
            for (const button of buttons) {
                button.click();
            }
            observer.disconnect(); // Stop observing once clicked.
        }
    }

    const observer = new MutationObserver(mutations => {
        clickComments();
    });

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

    // Initial check, in case the elements are already loaded.
    clickComments();
})();