Greasy Fork is available in English.
block the horizontal and the vertical ad bars
当前为
// ==UserScript==
// @name Yandex Mail Adblock
// @namespace Violentmonkey Scripts
// @match https://mail.yandex.ru/*
// @grant none
// @version 1.0.2
// @author lavrent
// @description block the horizontal and the vertical ad bars
// @license MIT
// ==/UserScript==
(() => {
function clearAds() {
const adsVBar = document.querySelector('[class^="PageLayout-m__body--"]');
if (adsVBar && adsVBar.children.length === 2) {
adsVBar.children[1].remove();
}
const headerDiv = document.querySelector('[class^="ContentHeader-m__header--"]');
if (headerDiv && headerDiv.children.length === 3) {
headerDiv.children[1].remove();
}
}
const observer = new MutationObserver(clearAds);
const page = document.querySelector('[class^="PageLayout-m__main--"]');
observer.observe(page, { childList: true, subtree: true });
})();