4k影视网页全屏播放去滚动条

去掉4k影视网页全屏播放时浏览器屏幕右侧的垂直滚动条

// ==UserScript==
// @name         4k影视网页全屏播放去滚动条
// @namespace    http://tampermonkey.net/
// @version      2024-03-12
// @description  去掉4k影视网页全屏播放时浏览器屏幕右侧的垂直滚动条
// @author       zhaoxinsoft.com
// @match        https://www.4kvm.org/artplayer?*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=4kvm.org
// @grant        none
// ==/UserScript==

(function () {
  'use strict';
  console.log('HELLO FROM zhaoxinsoft.com');
  // Your code here...
  // Create an observer instance linked to the callback function
  const observer = new MutationObserver((mutations, ob) => {
    // 检查节点的class变化是否包含了art-fullscreen-web
    mutations.forEach((mutation) => {
      if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
        if (mutation.target.classList.contains('art-fullscreen-web')) {
          // set the parent document body to overflow hidden because the artplayer-app is in an iframe
          window.parent.document.body.style.overflowY = 'hidden';
        } else {
          // 退出了全屏播放
          window.parent.document.body.style.overflowY = 'auto';
        }
      }
    });
  });
  // Start observing the target node for configured mutations
  observer.observe(document.querySelector('#artplayer-app .art-video-player'), { attributes: true });
})();