VideoPass player fix for MotoGP.com

Remove the dark overlay from videos

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         VideoPass player fix for MotoGP.com
// @namespace    http://tampermonkey.net/
// @version      2024-02-08
// @description  Remove the dark overlay from videos
// @author       MotoTiming.live
// @match        https://*.motogp.com/*
// @match        http://*.motogp.com/*
// @icon         https://www.google.com/s2/favicons?domain=mototiming.live
// @grant        none
// @run-at       document-idle
// ==/UserScript==

(function() {
    'use strict';

    function removeBlackOverlay() {
        const overlay = document.querySelector(".vjs-background ");
        const controlBar = document.querySelector(".vjs-control-bar");

        if (overlay && controlBar) {
            overlay.remove();
            controlBar.style.backgroundColor = "rgba(0,0,0,0.3)";
            console.log('MotoGP video overlay removed');
            return true;
        }
        return false;
    }

    const intervalId = setInterval(function() {
        const video = document.querySelector('video');
        if (video && !video.paused) {
            if (removeBlackOverlay()) {
                clearInterval(intervalId);
            }
        }
    }, 1000);
})();