Mail.ru ad blocker

Blocks mail.ru ads

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

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

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         Mail.ru ad blocker
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Blocks mail.ru ads
// @author       mail.ru group
// @match        https://e.mail.ru/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var worked = false;
    $(document).on("DOMNodeInserted",function(e){
        if (!worked && $(".b-layout__col_1_2").length) {
        	var upperBlockerFunc = function(e){
                if ($(".b-datalist__head").length) {
                    $(".b-datalist__head").remove();
                }
                if ($(".b-letter__head__rb").length) {
                    $(".b-letter__head__rb").remove();
                }
            };
            $(".b-layout__col_2_2").on("DOMNodeInserted", upperBlockerFunc);
            $(".b-layout__col_2_2").on("DOMCharacterDataModified", upperBlockerFunc);
            $(".b-layout__col_1_2").on("DOMNodeInserted",function(e){
                var children = $(".b-layout__col_1_2").children();
                if (children[5]) children[5].remove();
            });
            worked = true;
        }
    });
})();