Customize Zeit Online

Entferne unerwünschte Artikel/Abschnitte aus Zeit Online

目前為 2020-10-11 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Customize Zeit Online
// @namespace    https://greasyfork.org/en/users/689160-georg-vogt
// @version      1.4
// @description  Entferne unerwünschte Artikel/Abschnitte aus Zeit Online
// @author       Georg Vogt
// @match        https://www.zeit.de/index
// @grant        none
// ==/UserScript==

'use strict';

function hideNode(node) {
    node.style.display = 'none';
    //  node.style.background = 'red'; //  debug
}

// remove sections
const badSections = [
    "wochenmarkt",// Wochenmarkt
    "headed-zplus",// zplus
    "headed-zett",//  zett
    //  "headed-brandeins",// brand eins
    //  "headed-zar",// Zeit Arbeit
    //  "headed-zmo",//  Zeit Magazin
    "shop",//  Shop
    //  "headed-zco",//  Zeit Campus
    ];

const badHeadings = [
    "DAS BESTE AUS Z+",
    "Diese Woche in der ZEIT",
    "Beliebte Artikel",
    //  "Politik",
    //  "Gesellschaft",
    "Podcasts",
    //  "Wirtschaft",
    //  "Kultur",
    "Video",
    //  "Wissen",
    //  "Digital",
    //  "Entdecken",
    //  "Mobilität",
    //  "Hamburg",
    //  "Sport",
    "Spiele",
    ];

const sections = document.querySelectorAll("section");

for (var section of sections) {
    if (badSections.includes(section.getAttribute("data-ct-context"))) {
        hideNode(section.parentElement);
    } else if (badHeadings.includes(section.querySelector("h2")?.innerText)) {
       hideNode(section.parentElement);
    }
}


// remove other articles
const articles = document.querySelectorAll("main article");

const zplusKeywords = [
    "zplus",//  pay to read
    "zplus-register",// register to read
    //  "zplus-dynamic",// unknown zplus article type, can still be accessed
    ];

for (var article of articles) {
    // remove zplus article
    if (zplusKeywords.includes(article.getAttribute("data-zplus"))) {
        hideNode(article);
    }

    // remove zett teaser
    var zett = article.querySelector('svg.svg-symbol.zon-teaser-standard__kicker-logo--zett') || article.querySelector('svg.svg-symbol.zon-teaser-wide__kicker-logo--zett');;
    if (zett !== null) {
        hideNode(article);
    }

    // remove Verlagsangebot
    if (article.querySelector("h3")?.innerText.includes("VERLAGSANGEBOT")) {
        hideNode(article);
    }
}

// remove Stellenangebot
hideNode(document.querySelector("aside.joblisting").parentElement.parentElement)

// remove Quiz
hideNode(document.querySelector("*[class='frame frame--quiz']").parentElement)

// remove Stimmung Umfrage
hideNode(document.querySelector("*[class='zg-wiegehtsesihnen-appwrapper']").parentElement)