Youtube: Remove Overlays

04/26/2023, 11:35:27 AM

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        Youtube: Remove Overlays
// @namespace   https://greatest.deepsurf.us/en/users/221281-klaufir
// @match       https://www.youtube.com/embed/*
// @match       https://www.youtube.com/*
// @match       https://www.youtube-nocookie.com/*
// @grant       none
// @version     1.12
// @author      -
// @description 04/26/2023, 11:35:27 AM
// ==/UserScript==
function addStyle(style)
{
    var headelem = document.getElementsByTagName("head")[0];
    var styleelem = document.createElement("style");
    styleelem.setAttribute("id","remove-overlays");
    styleelem.type="text/css";
    styleelem.appendChild(document.createTextNode(style));
    headelem.appendChild(styleelem);
}

function getRuleForClasses() {
  var classes = [
        'ytp-paid-content-overlay',  // paid promotion notification overlay in the bottom left corner
        'ytp-pause-overlay',         // "More Videos" overlay on paused embeds
        'ytp-ce-element',            // covering overlays at the end of the video
        'iv-branding',               // branding overlay in the bottom right corner
        'ytp-cards-teaser',          // info cards in the top right corner
        'ytp-cards-button-icon',     // info cards in the top right corner
        'ytp-cards-button-title',    // info cards in the top right corner
        'ytp-endscreen-content',     // endscreen recommended videos
        'ytp-spinner',               // remove spinner stuck on screen
        'ytd-reel-shelf-renderer'
      ];
  var style="";
  classes.forEach(cls => {
    style += "." + cls + " { visibility: hidden !important; }\n";
  });
  return style;
}

addStyle(getRuleForClasses());