Disable Video Popouts

Disable/remove non browser native video overlays on web pages. This script applies on all sites by default, and must be manually configured to exclude specific sites. Note: this is a somewhat aggresive blocker, where it may break site functionality.

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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         Disable Video Popouts
// @namespace    https://greasyfork.org/en/users/85671-jcunews
// @version      1.0.3
// @license      AGPLv3
// @author       jcunews
// @description  Disable/remove non browser native video overlays on web pages. This script applies on all sites by default, and must be manually configured to exclude specific sites. Note: this is a somewhat aggresive blocker, where it may break site functionality.
// @match        *://*/*
// @exclude      *://dont-block.this.com/*
// @grant        none
// ==/UserScript==

(() => {
  var ans = ["class", "style"];

  function getStyle(e, z) {
    try {
      return getComputedStyle(e)
    } catch(z) {
      return null
    }
  }

  function chkStyle(n, s) {
    return (s = getStyle(n)) && (s.position === "fixed") && (s.left !== "0px") && (s.top !== "0px") && (s.right !== "0px") && (s.bottom !== "0px");
  }

  function chkParentEle(n, s) {
    while (n = n.parentNode) {
      if (chkStyle(n)) {
        n.remove(n);
        break;
      }
    }
  }

  function chkEle(n, s) {
    if (n.tagName) {
      if (n.tagName !== "VIDEO") {
        if (n.querySelector('video')) {
          if (chkStyle(n)) {
            n.remove(n);
          } else chkParentEle(n);
        }
      } else chkParentEle(n);
    }
  }

  (new MutationObserver(recs => {
    recs.forEach((r, i) => {
      r.addedNodes.forEach((n) => chkEle(n));
      if (ans.includes(r.attributeName)) chkEle(r.target);
    });
  })).observe(document, {attributes: true, childList: true, subtree: true});
})();