Use the video bug to skip the progress bar
当前为
// ==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毫秒
}
});
})();