// ==UserScript==
// @name Customize Zeit Online
// @namespace https://greasyfork.org/en/users/689160-georg-vogt
// @version 3.1
// @description Entferne unerwünschte Artikel/Abschnitte aus Zeit Online
// @author Georg Vogt
// @match https://www.zeit.de/*
// @run-at document-body
// ==/UserScript==
'use strict';
function hideNode(node) {
try {
node.style.display = 'none';
// node.style.background = 'red'; // debug
} catch {};
}
function hideParent(node, num) {
if (i < 0) return;
for (var i=0; i<num; i++) {
node = node?.parentElement;
}
hideNode(node);
}
document.addEventListener('DOMContentLoaded', () => {
// remove zplus articles
const zplusArticles = document.querySelectorAll("article:not([data-zplus='zplus-dynamic']) svg.svg-symbol.zplus-logo");
zplusArticles.forEach(node => hideParent(node, 5));
// remove zett articles
const zettArticles = document.querySelectorAll("article svg.svg-symbol.zett-logo");
zettArticles.forEach(node => hideParent(node, 5));
// remove Verlagsangebot
const verlagsangebotArticles = document.querySelectorAll("article.zon-teaser-standard.zon-teaser-standard--ad");
verlagsangebotArticles.forEach(node => hideNode(node));
// remove podcasts
const podcasts = document.querySelectorAll(["article.zon-teaser-standard.zon-teaser-standard--podcast","article.zon-teaser-wide.zon-teaser-wide--podcast"]);
podcasts.forEach(node => hideNode(node));
// remove bad single nodes
const queries = new Map([
["section.zon-teaser-printbox", 1], // Diese Woche in der ZEIT
["section[data-ct-context='buzzboard']", 1], // Beliebte Artikel
["section[data-ct-context='headed-zplus']", 1], // Exklusiv für Digital-Abonnenten
["section[data-ct-context='wochenmarkt']", 1], // Wochenmarkt
["section.frame.frame--quiz", 2], // Quiz
["section[data-ct-area='podcast-bar']", 1], // Podcasts
["section[data-ct-context='headed-zett']", 1], // ze.tt
["section[data-ct-context='headed-video']", 1], // Video
["section[data-ct-context='shop']", 1], // Shop
["section[data-ct-context='headed-spiele']", 1], // Spiele
["section[data-ct-context='dossier-das_beste_aus_z']", 1], // DAS BESTE AUS Z+
["aside.newsletter-signup", 0], // Newsletter
["aside.joblisting", 2], // stellenangebot
["div.zg-wiegehtesihnen", 0], // Stimmungsumfrage
["figure [href^='https://www.zeit.de/serie/die-kaenguru-comics']", 3], // Känguru comic
]);
queries.forEach((num, query) => hideParent(document.querySelector(query), num));
// remove ad regions
document.querySelectorAll("div.cp-region.cp-region--ad").forEach(node => hideNode(node));
// remove sidebar Zeit+
const sideBoxes = document.querySelectorAll("article aside.topicbox");
for (const sideBox of sideBoxes) {
if (sideBox.childNodes[1]?.childNodes[1]?.innerText == "DAS BESTE AUS Z+") {
hideNode(sideBox);
}
}
});
// remove paywall footer
const callback = function(mutationsList, observer) {
for(const mutation of mutationsList) {
for (const node of mutation.addedNodes) {
try {
if (node.classList[0] == "paywall-footer") {
hideNode(node);
observer.disconnect();
}
} catch {}
}
}
};
const observer = new MutationObserver(callback);
observer.observe(document.body, {childList: true});