20minCleaner

try to take over the world!

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         20minCleaner
// @namespace    org.free.world
// @version      0.1.5
// @description  try to take over the world!
// @author       You
// @match        https://www.20min.ch/*
// @grant        none
// @noframes
// @run-at document-body
// ==/UserScript==

(function() {
    'use strict';
    window.onload = function () {

        var targetNode = document.getElementsByTagName("body")[0];
        var targetNode2 = document.getElementsByTagName("html")[0];
        var config = { attributes: true, childList: true, subtree: true };

        var callback = function(mutationsList, observer) {
            for(var mutation of mutationsList) {
                if (mutation.type == 'childList') {
                    console.log('A child node has been added or removed.');
                    removeCrap(targetNode, targetNode2);
                }
                else if (mutation.type == 'attributes') {
                    console.log('The ' + mutation.attributeName + ' attribute was modified.');
                    //removeCrap();
                }
            }
        };

        var observer = new MutationObserver(callback);
        observer.observe(targetNode, config);
    };

    function removeCrap(targetNode, targetNode2 )
    {
        targetNode.style.height = "";
        targetNode.style.overflowY = "scroll";
        targetNode2.style = "";

        // maybe they change their prefix "sp_" then you have to change it below

        var nodesToRemove = document.querySelector('[id^="sp_"]');
        if(nodesToRemove !== null)
        {
            nodesToRemove.parentNode.removeChild(nodesToRemove);
        }
        var nodesToRemove2 = document.querySelector('[class^="sp_"]');
        if(nodesToRemove2 !== null)
        {
            nodesToRemove2.parentNode.removeChild(nodesToRemove2);
        }

    }

})();