ReHike Fixes 4 SYTARB

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

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

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