(16倍速)国家中小学智慧教育平台刷课脚本(支持“暑期教师研修”专题)

try to take over the world

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

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.

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

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

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         (16倍速)国家中小学智慧教育平台刷课脚本(支持“暑期教师研修”专题)
// @namespace    http://tampermonkey.net/
// @version      0.5
// @license      CC BY-NC-SA
// @description  try to take over the world
// @author       Zed Wong
// @match        https://*.zxx.edu.cn/*
// @match        https://*.smartedu.cn/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    setTimeout(main, 5000);
    function main(){
        console.log('刷课脚本开始运行');
        var vid = document.getElementsByTagName("video")[0];
        vid.muted = true;
        vid.play();
        console.log('开始播放');
document.querySelector('video').playbackRate = 16;
        var total_ep = document.getElementsByClassName('resource-item').length;
        console.log('总共集数: ${total_ep}');

        var current_index;
        document.getElementsByClassName('resource-item').forEach(function(element,index)
        { if (element.classList.length === 3) 
        { 
            current_index = index;
        }});
        console.log('当前集号: ${current_index}');

        vid.addEventListener('ended', function() {
            console.log('当前记号:',current_index, ' 总记号:', total_ep);
            if (current_index <= total_ep) {
                console.log('播放结束,切换下一个视频');
                //document.getElementsByClassName('resource-item')[current_index].click();
                document.getElementsByClassName('resource-item')[current_index+=1].click();
                console.log('已切换到视频${current_index}');
                setTimeout(main, 5000);
                console.log('开始刷视频${current_index}');
                var vid = document.getElementsByTagName("video")[0];
                vid.muted = true;
                vid.play();
                console.log('开始播放');
                document.querySelector('video').playbackRate = 16;
            } else {
                console.log("该章节已挂机完成。");
            }
        }, false);
    }
})();