宝武/baowu微学院挂机脚本

跳过挂机判断,自动续播,列表播放完毕自动关闭当前标签页

目前为 2021-11-15 提交的版本。查看 最新版本

// ==UserScript==
// @name         宝武/baowu微学院挂机脚本
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  跳过挂机判断,自动续播,列表播放完毕自动关闭当前标签页
// @author       SpaceJJ
// @license MIT
// @match        http://mooc.baosteel.com/*
// @icon         https://www.google.com/s2/favicons?domain=baosteel.com
// @grant        GM_log
// @grant        GM_addStyle
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_xmlhttpRequest
// @grant        GM_deleteValue
// ==/UserScript==
// 自动点击下一节
(function () {
        // 定时器自动确认
    setInterval(() => {
        // 判断是否下一节按钮
        if (document.getElementsByClassName('ant-btn ant-btn-primary ant-btn-lg')[0]) {
            // 模拟点击
            console.log("自动确认");
            document.getElementsByClassName('ant-btn ant-btn-primary ant-btn-lg')[0].click();
        }

    }, 5000)
    setTimeout(function a(){
        if(!document.getElementsByTagName('video')[0]){
            console.log("未找到视频");
        }
        var vid = document.getElementsByTagName('video')[0];
        console.log("定时启动");
        vid.addEventListener('ended',function(){ //视频播放完的事件
            //这里触发点击事件
            console.log("播放完毕");
            //延迟点击下一节
            setTimeout(() => {
                if(document.getElementsByClassName('go-survey')[0]){
                    //延迟执行关闭脚本,否则关闭太快被视为未完成当前视频的学习
                    setTimeout(() => {
                        window.close();
                    },1000);
                }
                else{
                    document.getElementsByClassName('go-next')[3].click();
                    console.log("点击下一节");
                    setTimeout(() => {
                        a();
                    },5000);
                }
            },2000);
        });
    },3000);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址