Greasy Fork 支持简体中文。

Remove gradient elements from the media control overlay on Max.com

Remove the annoying gradient element from the control overlay which is shown on a mouse movement

  1. // ==UserScript==
  2. // @name Remove gradient elements from the media control overlay on Max.com
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.2
  5. // @description Remove the annoying gradient element from the control overlay which is shown on a mouse movement
  6. // @author Behike
  7. // @match *://play.max.com/video/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=max.com
  9. // @grant window.onurlchange
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. if (window.onurlchange === null) {
  17. window.addEventListener('urlchange', (info) => waitAndRemove());
  18. }
  19. })();
  20.  
  21. function waitAndRemove() {
  22. waitForElm("[class^='BottomGradient-Beam-Web-Ent']").then((elm) => {
  23. console.log(elm);
  24. console.log('Bottom gradient element removed.');
  25. elm.remove()
  26. });
  27. waitForElm("[class^='TopGradient-Beam-Web-Ent']").then((elm) => {
  28. console.log(elm);
  29. console.log('Top gradient element removed.');
  30. elm.remove()
  31. });
  32. }
  33.  
  34. function waitForElm(selector) {
  35. return new Promise(resolve => {
  36. if (document.querySelector(selector)) {
  37. return resolve(document.querySelector(selector));
  38. }
  39.  
  40. const observer = new MutationObserver(mutations => {
  41. if (document.querySelector(selector)) {
  42. observer.disconnect();
  43. resolve(document.querySelector(selector));
  44. }
  45. });
  46.  
  47. observer.observe(document.body, {
  48. childList: true,
  49. subtree: true
  50. });
  51. });
  52. }