郑州大学远程教育

郑州大学远程教育自动播放

< Feedback on 郑州大学远程教育

Review: OK - script works, but has bugs

§
Posted: 2022-07-12

郑大暗改了网站内容,已修改,需要将源码中所有的【已修改】三个字换成【100%】即可。

// ==UserScript==
// @name         郑州大学远程教育
// @version      2.0
// @description  郑州大学远程教育自动播放
// @author       壹局QQ639446649
// @match        http://ols.v.zzu.edu.cn/*
// @icon         http://tm.yjgame.top/tampermonkey/zzdxycjy/logo.png
// @require      https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js
// @namespace 好好学习天天向上
// ==/UserScript==
(function () {
    let coursePage = "http://ols.v.zzu.edu.cn/xsd/#/index/dibble";
    setInterval(() => {
        let bt = $("li.ant-menu-item:nth-child(2)");
        if (bt.length === 2) {
            let selected = $(bt[0]).attr('class').includes('ant-menu-item-selected');
            if (!selected) {
                window.location.href = coursePage;
            }
        }
        let studyList = $('.dibble_head_ul__4ECnR li');
        if (studyList.length != 0) {
            for (let index = 0; index < studyList.length; index++) {
                const study = studyList[index];
                let studyStateEle = $(study).find('.curriculumCard_study__1OjwM');
                let studyState = $(studyStateEle).text()
                if (studyState == '学习中' || studyState == '未学习') {
                    let scoreEle = $(study).find('.curriculumCard_headP2__2Mx3s span:first span');
                    let lowScore = $(scoreEle).text().split('/')[0];
                    if (Number(lowScore) < 10) {
                        $(study).children().click();
                        break;
                    }
                } else {
                    continue;
                }
            }
        }
        let couresListTableEles = $('.ant-tree-switcher_close');
        if (couresListTableEles.length > 0) {
            couresListTableEles.click();
        }
        let video = $('video');
        if (video.length == 0) {
            if (couresListTableEles.length == 0) {
                let couresliEles = $('.ant-tree-treenode-switcher-close');
                if (couresliEles.length != 0) {
                    let couresClickEle = $('span:nth-child(2) .ant-tree-title > p');
                    let couresTypeEle = $('.video_start__GSWLP');
                    let couresStateEle = $('.video_state__2M6CF');
                    for (let index = 0; index < couresliEles.length; index++) {
                        const couresType = $(couresliEles[index]).find(couresTypeEle);
                        const couresState = $(couresliEles[index]).find(couresStateEle);
                        if ($(couresType).text() == '视频') {
                            console.log($(couresState).text());
                            if ($(couresState).length == 0 || $(couresState).text() !== '100%') {
                                $(couresliEles[index]).find(couresClickEle).click();
                                break;
                            }
                        }
                    }
                }
            }
        } else {
            video[0].muted = true;
            if (video[0].paused) {
                video[0].play();
            }
            let ingItem = $('.ant-tree-treenode-switcher-open.ant-tree-treenode-selected .video_state__2M6CF').text();
            if (ingItem == '100%' || video[0].ended) {
                window.location.href = coursePage;
            }
        }
        let quxiao = $('.ant-modal-confirm-btns button:first');
        if (quxiao.length == 1) {
            quxiao.click();
            window.location.href = coursePage;
        }
        let x = $('.ant-modal-content > button > span');
        if (x.length == 1) {
            x.click();
            window.location.href = coursePage;
        }
        let errMsg = $('.prism-error-content p');
        if (errMsg.length == 1 && errMsg.text() == '播放出错啦,请尝试退出重试或刷新') {
            window.location.href = coursePage;
        }
    }, 1000);
})();


Post reply

Sign in to post a reply.