大白兔联盟

文章搜索
搜索
当前位置:首页 > 前沿技术 > 编程技术 > 文章详情

【油猴】学习公社平台自动学习脚本

大白兔  编程技术  2022-12-8  410  0评论
背景

学习公社平台学习中,需要人工干预才可以连续学习。

解决办法
// ==UserScript==
// home.php?mod=space&uid=170990         学习公社平台
// home.php?mod=space&uid=467642    http://tampermonkey.net/
// home.php?mod=space&uid=1248337      0.3
// @description  try to take over the world!
// home.php?mod=space&uid=686208       You
// home.php?mod=space&uid=195849        https://study.enaea.edu.cn/viewerforccvideo.do?courseId=*&circleId=*
// home.php?mod=space&uid=593100         https://www.google.com/s2/favicons?domain=enaea.edu.cn
// home.php?mod=space&uid=609072        none
// ==/UserScript==

(function() {
    'use strict';

    let isLast = false;
     function gotoNext(){
         let todos = opener.$('table.dataTable tr:contains(%)').filter((i,v)=>{ return $(v).find('td:nth-child(4)').text().indexOf('#') == -1 &&  $(v).find('td:nth-child(5)').text().indexOf('100%') == -1})
         .filter((i,v)=>{ let vurl = $(v).find('a.saveStuCourse').attr('data-vurl'); return location.href.indexOf(vurl) == -1});
            if(todos.length > 0){
                console.log('switch to next.... reload  ');
                let nextCourse =  $(todos[0]);
                nextCourse.find('td').eq(3).text('#')
                let nextVurl = nextCourse.find('a.saveStuCourse').attr('data-vurl');
                location.href = nextVurl;
            }
    }

    function autoSetEvent(){
        setInterval(function(){
            var aud = $("div video").get(0);
            if( $(aud).prop('__ok__') != true){
                aud.addEventListener("ended", video_ended);
                console.log("add ended event listener.")
                $(aud).prop('__ok__',true);

                isLast = $('ul.cvtb-MCK-course-list li.last').text() == $('ul.cvtb-MCK-course-list li.current').text();

                let notStudyList = $('div.cvtb-MCK-CsCt-studyProgress').filter((i,v)=>$(v).text().indexOf('100%') == -1);
                if(notStudyList.length == 0){
                    gotoNext();
                }
                else if(notStudyList.length > 0 && $('ul.cvtb-MCK-course-list li.current').find('div.cvtb-MCK-CsCt-studyProgress').text().indexOf('100%') === 0){
                        notStudyList.eq(0).parent().click();
                }
            }

            $('.dialog-button-container button:contains(继续学习)').click()
        },3000);
    }

    function video_ended() {
        console.log("The audio has ended");

        if(isLast){
            console.log('switch to next.... ');       

           gotoNext();
        }
    }

    setTimeout(function(){
        // debugger;
        $(".continue .user_choise").click()
        autoSetEvent();
    },3000);

    // Your code here...
})();

免责声明

本站提供的一切软件、教程和内容信息仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络收集整理,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑或手机中彻底删除上述内容。如果您喜欢该程序和内容,请支持正版,购买注册,得到更好的正版服务。我们非常重视版权问题,如有侵权请邮件与我们联系处理。敬请谅解!

挤眼 亲亲 咆哮 开心 想想 可怜 糗大了 委屈 哈哈 小声点 右哼哼 左哼哼 疑问 坏笑 赚钱啦 悲伤 耍酷 勾引 厉害 握手 耶 嘻嘻 害羞 鼓掌 馋嘴 抓狂 抱抱 围观 威武 给力
提交评论

清空信息
关闭评论