ReHike Fixes 4 SYTARB

Hides the .player-unavailable element on age-restricted videos

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

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 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         ReHike Fixes 4 SYTARB
// @namespace    http://tampermonkey.net/
// @author       wavypurples
// @version      1.0
// @description  Hides the .player-unavailable element on age-restricted videos
// @icon         https://www.youtube.com/favicon.ico
// @match        https://www.youtube.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Function to check and hide the player-unavailable element
    function hidePlayerUnavailable() {
        const messageElement = document.querySelector('.player-unavailable .content .message');
        if (messageElement && messageElement.textContent.trim() === "Sorry, this content is age-restricted") {
            const playerUnavailable = document.querySelector('.player-unavailable');
            if (playerUnavailable) {
                playerUnavailable.style.display = 'none';
            }
        }
    }

    // Run the function initially
    hidePlayerUnavailable();

    // Observe for changes to dynamically loaded content
    const observer = new MutationObserver(hidePlayerUnavailable);
    observer.observe(document.body, { childList: true, subtree: true });
})();