🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

腾讯视频跳过片头(2024)

视频开始播放时,按 J 或者 Enter 跳过片头

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name         腾讯视频跳过片头(2024)
// @namespace    http://tampermonkey.net/
// @version      0.1.0
// @description  视频开始播放时,按 J 或者 Enter 跳过片头
// @author       XHXIAIEIN
// @match        *://v.qq.com/*
// @icon         https://v.qq.com/favicon.ico
// @grant        none
// ==/UserScript==

//-------------------------------------------
// 看动漫总是好长的的片头手动点太烦
// 按 J 或 Enter 跳过一定时间。
// 按 N 或 小键盘. 跳转到下一集。
//-------------------------------------------

// 跳过时间的键值
const skipKey = ['j', 'Enter'];
const skipTime = 19; // 片头长度

// 跳转到下一集
const nextEpisodeKey = ['n', 'NumpadDecimal'];


//-------------------------------------------
// 基于 @PLAY233 发布的脚本改编(scripts/403400)
// 1. 适配新版页面,使跳过功能可以正常工作
// 2. 增加更多快捷键,可以跳转到下一集。
//-------------------------------------------

// 于防止按键一直按着进度条一直跳的情况
let allowed = true;

window.document.onkeydown = function(event) {
    if (event.repeat !== undefined) {
        allowed = !event.repeat;
    }
    if (!allowed) {
        return;
    }
    allowed = false;

    // 跳过时间
    if (skipKey.includes(event.key)) {
        let video = document.querySelector("video[src]");
        if (video && video.currentTime < skipTime) {
            video.currentTime += skipTime;
            video.play();
        }
    }

    // 跳转到下一集
    if (nextEpisodeKey.includes(event.key)) {
        let nextButton = document.querySelector("div[aria-label='下一个']");
        if (nextButton){
          nextButton.click();
        }
    }
};

window.document.onkeyup = function(event) {
    allowed = true;
};