Greasy Fork

Greasy Fork is available in English.

🔥【就是爽】解决网盘不保存只能观看1秒的限制+可显示字幕(360和chrome均已测试)

修复百度网盘视频播放暂停问题

目前为 2023-09-08 提交的版本,查看 最新版本

// ==UserScript==
// @name          🔥【就是爽】解决网盘不保存只能观看1秒的限制+可显示字幕(360和chrome均已测试)
// @namespace    http://tampermonkey.net/
// @version      4.0
// @description  修复百度网盘视频播放暂停问题
// @license       Yolanda Morgan
// @author       Your Name
// @match        https://pan.baidu.com/*
// @exclude       *://pan.baidu.com/disk/*
// @exclude      *://pan.baidu.com/play/video#/video*
// @exclude       *://pan.baidu.com/pfile/video*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // 添加样式表
    let style = document.createElement("style");
    style.innerHTML = `
        .vjs-control-bar {
            position: absolute;
            left: 0;
            right: 0;
            bottom: 50%;
            transform: translateY(50%);
        }
    `;
    document.head.appendChild(style);

    let checkAble = setInterval(function(){
        let video = document.querySelector("#html5player_html5_api");
        let controlsBar = document.querySelector("#html5player .vjs-control-bar");
        let overlayIframe = document.querySelector("#video-wrap-outer .video-overlay-iframe");
        let videoStartTip = document.querySelector(".video-start-tip");

        if (video && controlsBar && overlayIframe && videoStartTip) {
            console.log("%cBaidu Wangpan Video Control: ", "color:red;font-size:16px;font-weight:bold", "Start");
            clearInterval(checkAble);


            // 修复视频播放暂停问题
            video.controls = true;
            video.pause = null;
            overlayIframe.style.display = "none";
            videoStartTip.style.display = "none";

            console.log("%cBaidu Wangpan Video Control: ", "color:green;font-size:16px;font-weight:bold", "Successful");
        }
    }, 1000);
})();