Cleanup Electrek: Hide Unwanted Content

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

اعتبارا من 24-04-2025. شاهد أحدث إصدار.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==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);
})();