// ==UserScript== // @name Customize Zeit Online // @namespace https://greasyfork.org/en/users/689160-georg-vogt // @version 2.4.3 // @description Entferne unerwünschte Artikel/Abschnitte aus Zeit Online // @author Georg Vogt // @match https://www.zeit.de/* // @run-at document-body // @grant GM_setValue // @grant GM_getValue // @downloadURL none // ==/UserScript== 'use strict'; var customBadSections = {}; var customBadHeadings = {}; var customBadQueries = {}; customBadSections = GM_getValue("customBadSections", {}); customBadHeadings = GM_getValue("customBadHeadings", {}); customBadQueries = GM_getValue("customBadQueries", {}); //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// // Customize // customBadSections["newsticker"] = true; // customBadHeadings["Video"] = true; // customBadQueries["*[href='https://www.zeit.de/kaenguru-comics-marc-uwe-kling-bernd-kissel ']"] = 3; //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// GM_setValue("customBadSections", customBadSections); GM_setValue("customBadHeadings", customBadHeadings); GM_setValue("customBadQueries", customBadQueries); console.log("TM: Custom settings:", customBadSections, customBadHeadings, customBadQueries); 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 { const sections = document.querySelectorAll("section"); const articles = document.querySelectorAll("main article"); const podcasts = document.querySelectorAll(["article.zon-teaser-standard.zon-teaser-standard--podcast","article.zon-teaser-wide.zon-teaser-wide--podcast"]); // remove sections for (const section of sections) { if (badSections[section.getAttribute("data-ct-context")]??false) { hideNode(section.parentElement); } else if (badHeadings[section.querySelector("h2")?.innerText]??false) { hideNode(section.parentElement); } } // remove articles for (const article of articles) { // remove zplus article if (zplusKeywords.includes(article.getAttribute("data-zplus"))) { hideNode(article); } // remove zett article if (article.getAttribute("data-unique-id")?.includes("zett")) { hideNode(article); } // remove Verlagsangebot if (article.querySelector("h3")?.innerText.includes("VERLAGSANGEBOT")) { hideNode(article); } } // remove podcasts podcasts.forEach(node => hideNode(node)); // remove bad Queries Object.entries(badQueries).forEach(([query, num]) => hideParent(document.querySelector(query), num)); // remove sidebar Zeit+ const sideBoxes = document.querySelectorAll("aside.topicbox"); for (const sideBox of sideBoxes) { const text = sideBox?.childNodes[1]?.childNodes[1]?.innerText; if (/DAS BESTE|Z+/.test(text)) { hideNode(sideBox); } } }); // remove paywall footer const callback = function(mutationsList, observer) { for(const mutation of mutationsList) { for (const node of mutation.addedNodes) { try { if (node.className.includes("paywall-footer")) { hideNode(node); } } catch {} } } }; const observer = new MutationObserver(callback); observer.observe(document.body, {childList: true});