Greasy Fork

Greasy Fork is available in English.

国家中小学智慧教育平台 2022年“暑期教师研修”专题 刷课脚本

Just a normal script

当前为 2022-08-12 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         国家中小学智慧教育平台 2022年“暑期教师研修”专题 刷课脚本
// @namespace    http://tampermonkey.net/
// @version      0.1
// @license      CC BY-NC-SA
// @description  Just a normal script
// @author       Zed Wong
// @match        https://www.zxx.edu.cn/teacherTraining/*
// @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('开始播放');

        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() {
            if (current_index <= total_ep) {
                console.log('播放结束,切换下一个视频');
                document.getElementsByClassName('resource-item')[current_index].click();
                current_index += 1;
                setTimeout(next(current_index), 2000);
            } else {
                console.log("该章节已挂机完成。");
            }
        }, false);
    }
    function next(current_index) {
        document.getElementsByClassName('resource-item')[current_index+=1].click();
        console.log('已切换到视频',current_index);
    }
})();