vgrabovets
3/29/2017 - 10:58 AM

adblock

adblock

// ==UserScript==
// @name         Remove images from cookies
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Remove all images previously stored in cookies
// @author       Vitaliy
// @match        http://*/*
// @grant        none
// ==/UserScript==

function getCookie(name) {
      var value = "; " + document.cookie;
      var parts = value.split("; " + name + "=");
      if (parts.length == 2) return parts.pop().split(";").shift();
    }

(function() {
    var cookies = getCookie('block');
    if(cookies){
        cookies_arr = cookies.split(',');
        var i = cookies_arr.length;
        while(i--){
            var img = document.querySelector('img[src="' + cookies_arr[i].trim() + '"]');
            if (img) {
                console.log('TamperMonkey removed cookie: ', cookies_arr[i].trim());
                img.parentNode.remove();
            }
        }
    }
}
)();
korrespondent.net##DIV[class="unit-side-banner"]
korrespondent.net##DIV[class="unit-top-dark-banner"]
korrespondent.net##DIV[class="comments"]
korrespondent.net##DIV[class="unit-inner-banner"]
korrespondent.net##DIV[class="archidea_informer"]
korrespondent.net##DIV[class="unit-side-informer"]
www.fresher.ru##ASIDE[id="side"]
www.fresher.ru##DIV[id="respond"]
nnmclub.to##TD[class="row2"]
nnmclub.to##DIV[id*="Composite"]
www.fresher.ru##DIV[class="tip comment"]
// ==UserScript==
// @name         remove_trash
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Remove trash from korrespondent.net
// @author       Vitaliy
// @match        http://korrespondent.net/*
// @grant        none
// ==/UserScript==

function contains(target, pattern){
    var value = 0;
    pattern.forEach(function(word){
      value = value + target.includes(word);
    });
    return (value === 1);
}

(function() {
    var l = document.links;
    var i = l.length;
    var pattern = ['/sport/', '/motors/', '/poker/'];
    while(i--){
        if(contains(l[i].href, pattern))
        {
            console.log('(TamperMonkey, remove_trash) removed:', l[i].href);
            l[i].parentNode.parentNode.remove();
        }
    }
})();

(function() {
    var el = document.querySelectorAll('.special-project, .advertising, .press-release');
    var i = el.length;
    while (i--){
        console.log('(TamperMonkey, remove_trash) removed ',el[i].innerHTML, el[i].parentNode.innerHTML);
        el[i].parentNode.parentNode.parentNode.remove();   
    }
}
)();