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.

  1. // ==UserScript==
  2. // @name Disable Video Popouts
  3. // @namespace https://gf.qytechs.cn/en/users/85671-jcunews
  4. // @version 1.0.3
  5. // @license AGPLv3
  6. // @author jcunews
  7. // @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.
  8. // @match *://*/*
  9. // @exclude *://dont-block.this.com/*
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (() => {
  14. var ans = ["class", "style"];
  15.  
  16. function getStyle(e, z) {
  17. try {
  18. return getComputedStyle(e)
  19. } catch(z) {
  20. return null
  21. }
  22. }
  23.  
  24. function chkStyle(n, s) {
  25. return (s = getStyle(n)) && (s.position === "fixed") && (s.left !== "0px") && (s.top !== "0px") && (s.right !== "0px") && (s.bottom !== "0px");
  26. }
  27.  
  28. function chkParentEle(n, s) {
  29. while (n = n.parentNode) {
  30. if (chkStyle(n)) {
  31. n.remove(n);
  32. break;
  33. }
  34. }
  35. }
  36.  
  37. function chkEle(n, s) {
  38. if (n.tagName) {
  39. if (n.tagName !== "VIDEO") {
  40. if (n.querySelector('video')) {
  41. if (chkStyle(n)) {
  42. n.remove(n);
  43. } else chkParentEle(n);
  44. }
  45. } else chkParentEle(n);
  46. }
  47. }
  48.  
  49. (new MutationObserver(recs => {
  50. recs.forEach((r, i) => {
  51. r.addedNodes.forEach((n) => chkEle(n));
  52. if (ans.includes(r.attributeName)) chkEle(r.target);
  53. });
  54. })).observe(document, {attributes: true, childList: true, subtree: true});
  55. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址