Created
May 26, 2019 22:57
-
-
Save 0xF6/540dfcee8af44b7b0e2b136e00207ae5 to your computer and use it in GitHub Desktop.
Yandex ads clearner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Yandex Block | |
// @namespace http://tampermonkey.net/ | |
// @version 1.3 | |
// @author Yuuki Wesp <ls-micro@ya.ru> | |
// @match https://yandex.ru/* | |
// @grant none | |
// @require https://code.jquery.com/jquery-3.3.1.min.js | |
// @require https://code.jquery.com/ui/1.12.1/jquery-ui.min.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var $ = jQuery.noConflict(); | |
let safe = (f) => { try { f(); } catch(e) { console.log(e); } } | |
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver; | |
var observer = new MutationObserver((mutations, observer) => { | |
safe(() => { $(".adv").remove(); }); | |
safe(() => { $("[aria-label='Реклама']").remove(); }); | |
safe(() => { $("[href='https://direct.yandex.ru/?partner']").parent().parent().remove(); }); | |
safe(() => { $('[data-blockname="kinopoisk"]').remove(); }); | |
safe(() => { $('[data-blockname="afisha_inserts"]').remove(); }); | |
safe(() => { $('[data-blockname="tv_online"]').remove(); }); | |
safe(() => { $('[data-blockname="infinity_zen"]').remove(); }); | |
safe(() => { $('[data-blockname="infinity_zen"]').remove(); }); | |
}); | |
observer.observe(document, { | |
subtree: true, | |
childList: true | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
does not work too