用video的bug来跳过进度条

Use the video bug to skip the progress bar

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

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         用video的bug来跳过进度条
// @namespace    http://tampermonkey.net/
// @version      1.23
// @description  Use the video bug to skip the progress bar
// @author       lvandy
// @match        *://*/*
// @license MIT
// @grant        none
// ==/UserScript==
// 定义一个函数来跳转到视频的最后1秒
function jumpToLastSecond(video) {
  // 检查视频元素是否已经加载了duration属性
  if (video && !isNaN(video.duration)) {
    // 设置当前播放时间为视频的总时长减去1秒
    video.currentTime = video.duration - 1;
  } else {
    console.log('无法获取视频时长或视频元素未准备好。');
  }
}

// 获取页面上的第一个视频元素
var videoElement = document.querySelector('video');

// 如果找到了视频元素,调用函数跳转到视频的最后1秒
if (videoElement) {
  jumpToLastSecond(videoElement);
} else {
  console.log('页面上没有找到视频元素。');
}