sz / Gmail remove ads +

// ==UserScript==
// @name       Gmail remove ads +
// @namespace  Gmail remove ads +
// @version    2.03
// @description  remove right ads and inline ads in tabs
// @include        https://mail.google.com/mail/*
// @icon        http://icons.iconarchive.com/icons/wwalczyszyn/android-style-honeycomb/128/GMail-icon.png
// @license MIT
// ==/UserScript==

function GM_addStyle(css) {
  const style = document.getElementById("GM_addStyleBy8626") || (function () {
    const style = document.createElement('style');
    style.type = 'text/css';
    style.id = "GM_addStyleBy8626";
    document.head.appendChild(style);
    return style;
  })();
  const sheet = style.sheet;
  sheet.insertRule(css, (sheet.rules || sheet.cssRules || []).length);
}

function hideAds() {
  var spans = document.getElementsByTagName("span");
  var spanContainer;
  for (var i = 0; i < spans.length; i++) {
    if (spans[i].innerText == "Ad") {
      spanContainer = spans[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.classList.add("a2q");
    }
  }
}

GM_addStyle(".u5, .nH.u8, .a2q { display: none !important; }");

const interval = setInterval(hideAds, 5000);