Pornhub Banner Remover

Removes those pesky ad banners on everyones favorite Hub.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Pornhub Banner Remover
// @version      1.0
// @description  Removes those pesky ad banners on everyones favorite Hub.
// @author       nereids
// @namespace    http://tampermonkey.net/
// @match        https://*.pornhub.com/*
// @match        https://*.pornhubpremium.com/*
// @icon         https://icons.duckduckgo.com/ip3/www.pornhub.com.ico
// @grant        none
// @run-at       document-start
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    const css = `
        body, .homepage, .pcVideoList { display: block !important; }
        div:has(> .tj-inban-container)
        }
    `;
    const styleElement = document.createElement('style');
    styleElement.textContent = css;
    (document.head || document.documentElement).appendChild(styleElement);

    // Function removes ad dynamically.
    function removeAd() {
        const labels = document.querySelectorAll('.tj-inban-container');
        labels.forEach(label => {
            const adContainer = label.parentElement;
            if (adContainer && !adContainer.classList.contains('homepage')) {
                adContainer.style.display = 'none';
                adContainer.innerHTML = '';
            }
        });
    }

    const observer = new MutationObserver(removeAd);
    observer.observe(document.documentElement, { childList: true, subtree: true });

    removeAd();
    setInterval(removeAd, 500);
})();