JumpVideo

skip video

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==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);
}