用video的bug来跳过进度条

Use the video bug to skip the progress bar

当前为 2024-08-04 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         用video的bug来跳过进度条
// @namespace    http://tampermonkey.net/
// @version      1.27
// @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 triggerVideoEndedEvent() {
     var video = document.querySelector("video");
     if (video) {
         video.dispatchEvent(new Event("ended")); // 触发视频结束事件
     }
 }

 // 快速触发视频结束事件多次
 function rapidVideoEndTrigger(times, interval) {
     let count = 0;
     const intervalId = setInterval(() => {
         if (count >= times) {
             clearInterval(intervalId);
             return;
         }
         triggerVideoEndedEvent();
         count++;
     }, interval);
 }

 // 当文档加载完成时,移除弹窗和新弹窗
 document.addEventListener('DOMContentLoaded', function() {
     removePopup();
     removeNewPopup();
 });

 // 当页面上发生点击事件时,触发视频结束事件多次
 document.addEventListener('click', function(event) {
     if (event.button === 0) { // 左键点击
         rapidVideoEndTrigger(5, 50); // 快速触发视频结束事件5次,每次间隔50毫秒
     }
 });
})();