goodfon

remove ads

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name        goodfon
// @namespace   [email protected]
// @description remove ads
// @include     https://www.goodfon.ru/
// @version     1
// @grant       none
// ==/UserScript==

let bigBanner = document.querySelector(`div[style*='baner_f']`);
if(bigBanner) {
    bigBanner.parentElement.parentElement.removeChild(bigBanner.parentElement);
}

let bannerObserver = new MutationObserver(mutations => {
    mutations.forEach(mutation => {
        if(mutation.addedNodes.length > 0) {
            if(mutation.target.id.includes('google_ad')) {
                let banner = mutation.target.parentElement;
                banner.parentElement.removeChild(banner);
            } else if(mutation.target.id.includes('rb_ad')) {
                let banner = mutation.target.parentElement.parentElement.parentElement;
                banner.parentElement.removeChild(banner);
            }
        }
    });
});
bannerObserver.observe(document.body, { childList: true, subtree: true });  

let paragraphs = Array.from(document.querySelectorAll('div.container > p'));
if(paragraphs.length > 0) {
    paragraphs.forEach(p => p.parentElement.removeChild(p));
}

let footer = document.getElementById('footer');
if(footer) {
    footer.parentElement.removeChild(footer);
}

let widgetLine = document.querySelector('.menu_l > noindex');
if(widgetLine) {
    widgetLine.parentElement.removeChild(widgetLine);
}