用video的bug来跳过进度条

Use the video bug to skip the progress bar

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

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



(function() {
    'use strict';

    // 定义操作视频的函数
    function manipulateVideo() {
        var video = document.querySelector('video');
        if (video) {
            // 触发"ended"事件
            video.dispatchEvent(new Event('ended'));

            // 延迟设置视频的当前时间,以避免视频播放器的防抖动机制
            setTimeout(function() {
                video.currentTime = 120; // 你可以根据需要设置不同的时间

                // 再次延迟以确保视频播放器接受更改
                setTimeout(function() {
                    if (!isNaN(video.duration)) {
                        video.currentTime = video.duration; // 跳转到视频末尾
                    }
                }, 100);
            }, 100);
        }
    }

    // 将函数绑定到鼠标点击事件
    document.addEventListener('click', function(event) {
        manipulateVideo();
    });
})();

QingJ © 2025

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