borgx

UserScript - Hide Umingle video overlays

Dec 3rd, 2026 (edited)
1,615
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Hide Umingle video overlays
  3. // @description  Hide the Umingle logo and selected video controls
  4. // @version      0.2.0
  5. // @match        https://umingle.com/video/*
  6. // @run-at       document-start
  7. // @grant        none
  8. // @sandbox      raw
  9. // @inject-into  page
  10. // ==/UserScript==
  11.  
  12. (() => {
  13.   'use strict';
  14.  
  15.   const hostSelector =
  16.     'body > div.main.video > div.videoGridMain > div.videoWrapper.remote.noSelect';
  17.  
  18.   const elementsToHide = ['#flag', '#vol-control'];
  19.  
  20.   const roots = new WeakMap();
  21.   const watchedRoots = new WeakSet();
  22.   const originalAttachShadow = Element.prototype.attachShadow;
  23.  
  24.   function hideLogo(root) {
  25.     const findAndHide = () => {
  26.       for (const svg of root.querySelectorAll('svg')) {
  27.         const text = (svg.textContent || '').replace(/\s+/g, '').toLowerCase();
  28.  
  29.         if (text.includes('umingle.com')) {
  30.           svg.style.setProperty('display', 'none', 'important');
  31.         }
  32.       }
  33.     };
  34.  
  35.     findAndHide();
  36.  
  37.     if (!watchedRoots.has(root)) {
  38.       watchedRoots.add(root);
  39.  
  40.       new MutationObserver(findAndHide).observe(root, {
  41.         subtree: true,
  42.         childList: true,
  43.         characterData: true
  44.       });
  45.     }
  46.   }
  47.  
  48.   function scan() {
  49.     const host = document.querySelector(hostSelector);
  50.     const root = host && roots.get(host);
  51.  
  52.     if (root) hideLogo(root);
  53.  
  54.     for (const selector of elementsToHide) {
  55.       const element = document.querySelector(selector);
  56.  
  57.       if (element) {
  58.         element.style.setProperty('display', 'none', 'important');
  59.       }
  60.     }
  61.   }
  62.  
  63.   Element.prototype.attachShadow = function (init) {
  64.     const root = Reflect.apply(originalAttachShadow, this, [init]);
  65.  
  66.     roots.set(this, root);
  67.  
  68.     queueMicrotask(scan);
  69.  
  70.     return root;
  71.   };
  72.  
  73.   new MutationObserver(scan).observe(document, {
  74.     subtree: true,
  75.     childList: true,
  76.     attributes: true,
  77.     attributeFilter: ['class', 'id']
  78.   });
  79.  
  80.   scan();
  81. })();
  82.  
Advertisement
Add Comment
Please, Sign In to add comment