Cleanup Electrek: Hide Unwanted Content

Hide articles tagged Tesla, Elon Musk, or Green Deals; remove Featured carousel; strip sidebars

Stan na 24-04-2025. Zobacz najnowsza wersja.

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         Cleanup Electrek: Hide Unwanted Content
// @description  Hide articles tagged Tesla, Elon Musk, or Green Deals; remove Featured carousel; strip sidebars
// @match        https://electrek.co/*
// @version 0.0.1.20250424082716
// @namespace https://greasyfork.org/users/1435046
// ==/UserScript==

(function() {
    const style = document.createElement('style');
    style.textContent = `
        /* 1. Hide any <article> (standard or featured) tagged Tesla, Elon Musk, or Green Deals */
        article.article:has(ul.article__meta-guides a[href*="/tesla/"]),
        article.article:has(ul.article__meta-guides a[href*="/elon-musk/"]),
        article.article:has(ul.article__meta-guides a[href*="/green-deals/"]) {
            display: none !important;
        }

        /* 2. Remove the entire Featured section (carousel under the "Featured" heading) */
        div.container.xs:has(> h2[attr-title="Featured"]) {
            display: none !important;
        }

        /* 3. Remove sidebar panels and widgets */
        aside.sidebar,
        aside.home-poll,
        div.widget.ninetofive-branded-rss {
            display: none !important;
        }
    `;
    document.head.appendChild(style);
})();