Pornhub Banner Remover

Removes those pesky ad banners on everyones favorite Hub.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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);
})();