Pornhub Banner Remover

Removes those pesky ad banners on everyones favorite Hub.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

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