Greasy Fork

Greasy Fork is available in English.

JumpVideo

skip video

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         JumpVideo
// @namespace    http://tampermonkey.net/
// @version      0.6
// @description  skip video
// @author       You
// @match        https://lms.ouchn.cn/course/*/learning-activity/*
// @icon         https://www.google.com/s2/favicons?domain=ouchn.cn
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
     check();
    // Your code here...
})();

function check(){
    var retryCount = 0;
    var maxRetry = 3;
    var currentURL = window.location.href;
    var isNext = false;
    console.log("经过测试,interval 在切换视频时不会改变");
    var lock = setInterval(function(){
        console.log("开始检测是否播放完毕.....");
        let video = document.querySelector('#video video');
        if (currentURL !== window.location.href && isNext == true) {
          currentURL = window.location.href;
          isNext = false;
        }else if(currentURL == window.location.href && isNext == true){
            console.log("出现故障了,无法跳转到下一个作业,清除定时作业,lock:",lock);
            clearInterval(lock);
        }
        if(video == null || typeof video == 'undefined'){
            if(retryCount < maxRetry){
                console.log('可能是由于加载缓慢导致的未初始化问题,重试次数:'+retryCount+',最大次数:'+maxRetry)
                retryCount++;
                return;
            }else{
                console.log("判定为当前页面没有视频,直接下一个作业");
                retryCount = 0;
                $(".next").click();
                isNext = true;
                return;
            }

        }
        if (video.paused && video.duration != video.currentTime) {
            video.playbackRate=4;
            video.muted = true;
            $('.mvp-toggle-play').click();
            return;
        }else if(video.duration == video.currentTime){
            console.log("播放完毕,下一个视频");
            $(".next").click();
            isNext = true;
        }},3000);
}