sam / Yandex Mail Ad blocker

// ==UserScript==
// @name         Yandex Mail Ad blocker
// @namespace    https://openuserjs.org/users/sam
// @version      1.0
// @description  The script for blocking ads in the Yandex Mail
// @author       sam
// @copyright    2018, sam (https://openuserjs.org/users/sam)
// @license      GPL-2.0-or-later
// @include      https://mail.yandex.ua/*
// @include      https://mail.yandex.ru/*
// @grant        none
// @require      https://code.jquery.com/jquery-3.3.1.slim.min.js
// ==/UserScript==

// ==OpenUserJS==
// @author sam
// ==/OpenUserJS==

(function () {
  'use strict';
  var selectors = [
    '.mail-Layout-Aside-Inner-Box .mail-CollectorsList-Setup + div',
    '.mail-Layout-Content .ns-view-infoline-box + div',
    '.mail-Layout-Aside-Inner-Box .ns-view-abook-left-box + div'
  ];
  var rules = {
    display: 'none !important'
  };
  window.jQuery('<style id="style-test">' + cssBuilder(selectors, rules) + '</style>').appendTo("head");
})();

function cssBuilder(selectors, rules) {
  var result = '';
  result += selectors.join(',') + '{';
  for (var name in rules) {
    result += name + ':' + rules[name] + ';'
  }
  return result + '}';
}