Greasy Fork

Zeit Newsticker Autoupdate

Dieses Skript ist zum filtrieren und hervorheben von Schlagzeilen vom Zeit.de Newsticker (zeit.de/news/index)

目前为 2017-12-06 提交的版本。查看 最新版本

// ==UserScript==
// @name         Zeit Newsticker Autoupdate
// @namespace    http://tampermonkey.net/
// @version      0.2
// @match        http://www.zeit.de/news/index*
// @description  Dieses Skript ist zum filtrieren und hervorheben von Schlagzeilen vom Zeit.de Newsticker (zeit.de/news/index)
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var filter = [
        "sport",
        "Sport",
        "Biathlon",
        "hockey",
        "ball",
        "Ski",
        "athletik",
        "Film",
        "Rodeln",
        "Golf",
        "Freizeit",
        "Tennis"
        ];
    var highlight = [
        'International',
        'Konflikte',
        'Regierung',
        'Ukraine',
        'UNO',
        'Verfassung',
        'USA',
        'Russland'
        ];
    var articles = document.querySelectorAll('article');
    var kicker='';
    var intervall = 10; //minuten

    for(var x of articles){
        kicker=x.querySelector('.newsteaser__kicker').innerText;
        for(var y of highlight)
            if( kicker.includes(y) ){
                x.style.border = '2px solid red';
                x.style.marginBottom = '2px';
                break;
            }
        for(var y of filter)
            if( kicker.includes(y) ){
                console.log('%cRemoving:%c '+kicker, 
                 'color:red; font-size: 13px;',
                 'color:black, font-size: 13px;');
                x.remove();
                break;
            }
    }

    setTimeout(function(){ location.reload(); },intervall*60*1000);
})();