用video的bug来跳过进度条

Use the video bug to skip the progress bar

目前為 2024-08-04 提交的版本,檢視 最新版本

// ==UserScript==
// @name         用video的bug来跳过进度条
// @namespace    http://tampermonkey.net/
// @version      1.29
// @description  Use the video bug to skip the progress bar
// @author       lvandy
// @match        *://*/*
// @license MIT
// @grant        none
// ==/UserScript==



(function() {
    'use strict';

    function removePopup() {
        var popup = document.querySelector('.fish-modal-confirm-btns');
        if (popup) {
            popup.parentNode.removeChild(popup);
        }
    }

    function removeNewPopup() {
        var newPopup = document.querySelector('.fish-modal-content');
        if (newPopup) {
            newPopup.parentNode.removeChild(newPopup);
        }
    }

    function skipVideoToTime(time) {
        var video = document.querySelector('video');
        if (video) {
            video.muted = true; // 确保视频静音
            video.currentTime = time; // 设置视频的当前播放时间为指定时间
            video.play(); // 播放视频
        }
    }

    document.addEventListener('DOMContentLoaded', function() {
        removePopup();
        removeNewPopup();
    });

    document.addEventListener('click', function(event) {
        if (event.button === 0) {
            // 点击时触发视频播放到120秒
            skipVideoToTime(120);

            // 触发视频结束事件,如果需要的话
            var video = document.querySelector("video");
            if (video) {
                video.dispatchEvent(new Event("ended"));
            }
        }
    });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址