Pornhub Banner Remover

Removes those pesky ad banners on everyones favorite Hub.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

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