🚀云班课一键完成所有资源🚀

咕咚没了!蓝墨云没了!发生什么事了?!不行,必须得有人站出来。那这个人为什么不能是我呢?

目前為 2023-11-04 提交的版本,檢視 最新版本

// ==UserScript==
// @name         🚀云班课一键完成所有资源🚀
// @namespace    http://tampermonkey.net/
// @version      1.0.2
// @description  咕咚没了!蓝墨云没了!发生什么事了?!不行,必须得有人站出来。那这个人为什么不能是我呢?
// @author       Handsomedog
// @match        https://www.mosoteach.cn/web/index.php?c=res&m=index&clazz_course_id=*
// @icon         https://static-cdn-oss.mosoteach.cn/mosoteach2/common/images/logo2.png
// @grant        none
// ==/UserScript==

(function () {
    var body = document.getElementById("cc-main")
    var button = document.createElement("button")
    var courseId = document.getElementsByName("clazz_course_id")[0].value
    var res = $('div[data-mime]')
    var finished = $('span[data-is-drag]')
    var box = document.getElementsByClassName("create-box manual-order-hide-part")
    var studyres= document.getElementsByClassName("study-res")[0].children[0].innerHTML
    var totalres= document.getElementsByClassName("total-res")[0].children[0].innerHTML
    body.appendChild(button)
    button.id = "button"
    button.style = "background: green;width: 200px;height: 30px;right: 20px;position: absolute;border-radius: 5px;top: 73px;text-align:center;color:#fff;line-height:30px;border:none"
    button.innerHTML = "一键完成所有资源(" + studyres + "/" + totalres + ")"
    button.addEventListener('click', function () {
        if(studyres==totalres) {setTimeout(() => {
            location.reload()
        }, 1000);}
        for (let i = 0; i < res.length; i++) {
            let type = res[i].getAttribute("data-mime")
            let value = res[i].getAttribute("data-value")
            let finish = finished[i * 2].getAttribute("data-is-drag")
            if (finish === 'N') {
                if (type === 'video') {
                    let time = box[i].children[4].innerHTML
                    let hour = time.substring(0, 2)
                    let minute = time.substring(3, 5)
                    let second = time.substring(6, 8)
                    let alltime = Number(hour * 60 * 60) + Number(minute * 60) + Number(second)
                    //console.log(hour, minute, second);
                    //console.log(type, value, finish, alltime);
                    getVideo(value, alltime)
                } else {
                    getResource(value)
                }
            }
        }
    })

    function getResource (value) {
        $.ajax({
            type: 'head',
            url: 'index.php?c=res&m=online_preview&clazz_course_id=' + courseId + '&file_id=' + value,
            error: function (res){
                //console.log(res,"错误")
                studyres = Number(studyres)+1
                button.innerHTML = "一键完成所有资源(" + studyres + "/" + totalres + ")"
                if(studyres==totalres) {setTimeout(() => {
                    location.reload()
                }, 1000);}
            },
            success: function (res){
                //console.log(res,"成功")
                studyres = Number(studyres)+1
                button.innerHTML = "一键完成所有资源(" + studyres + "/" + totalres + ")"
                if(studyres==totalres) {setTimeout(() => {
                    location.reload()
                }, 1000);}
            }
        });
    }

    function getVideo (value, alltime) {
        $.ajax({
            type: 'post',
            dataType: 'json',
            url: 'index.php?c=res&m=save_watch_to',
            data: {
                clazz_course_id: courseId,
                res_id: value, //当前观看视频资源的id
                watch_to: alltime, //假数据
                duration: alltime,
                current_watch_to: 0 //假数据
            },
            success: function (res){
                studyres = Number(studyres)+1
                button.innerHTML = "一键完成所有资源(" + studyres + "/" + totalres + ")"
                if(studyres==totalres) {setTimeout(() => {
                    location.reload()
                }, 1000);}
            }
        });
    }
})();

QingJ © 2025

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