Greasy Fork

来自缓存

Greasy Fork is available in English.

东奥会计人员在线继续教育刷课脚本

东奥会计人员在线继续教育

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name 东奥会计人员在线继续教育刷课脚本
// @namespace https://blog.mcraft.cn/s/DongaoStudy.html
// @version 0.1
// @description 东奥会计人员在线继续教育
// @author 7
// @match *://*.dongao.com/*
// @grant none
// ==/UserScript==

(function() {
    var href = location.href;
    var text;
    var i;

    if(href.indexOf("study/u/myCourse")!=-1){
        if(href.indexOf("auto=true")!=-1){
            //我的课程页面
            for(i=0;i<document.getElementsByClassName("operate-a active").length;i++){
                //进入第一门未完成课程
                text = document.getElementsByClassName("operate-a active")[i].innerText;
                if(text=="继续学习" || text=="开始学习"){
                    //自动开始学习
                    document.getElementsByClassName("operate-a active")[i].click();
                    break;
                }
            }
            //关闭页面
            window.close();
        }else{
            setInterval(function(){
                location.reload();
            },300000);

            //GM_setValue("accountId", href.match(/(\d+)/)[1]);
            var tb = document.getElementsByClassName("table all")[0];
            var rows = tb.rows;
            var rowNum = tb.rows.length;

            for (i = (rowNum-1); i >= 1; i--){
                if(rows[i].cells[6].innerText.indexOf("已完成") != -1){
                    tb.deleteRow(i);
                }
            }
        }
    }else if(href.indexOf("lecture/lectureList")!=-1){
        //课程目录页面
        //是否有下一节课
        var findNextCourseID = false;
        var courseID;
        for(i=0;i < document.getElementsByClassName("item-button1").length;i++){
            text=document.getElementsByClassName("item-button1")[i].innerText;
            if(text=="继续学习" || text=="开始学习"){
                var onclickValue = document.getElementsByClassName("item-button1")[i].getAttributeNode("onclick").nodeValue;
                courseID = onclickValue.match(/(\d+),(\d+)/);
                var endhref=href.indexOf("/lecture");
                var prefix=href.substring(endhref);
                findNextCourseID = true;
                break;
                //document.getElementsByClassName("item-button1")[i].click();
                //break;
            }
        }
        //尝试学习下一节课
        if(findNextCourseID == true){
            location.href="http://"+location.host+"/cwweb/videoShow/video/videoPlay?lectureID="+courseID[2]+"&cwID="+courseID[1];
        }else{
            //否则打开主页,并自动学习下一门课
            //location.href = "http://study.dongao.com/study/u/myCourse?accountId=" + GM_getValue("accountId") + "&auto=true";
            jumpToMainPage();
        }
    }else if(href.indexOf("video/videoPlay")!=-1){
        //视频结束后回到主目录
        var currentTime = (new Date()).getTime();
        setInterval(function(){
            //如果90分钟没有
            if((new Date()).getTime() - currentTime > 5400000){
                //checkVideoShow();
                jumpToMainPage();
            }
        },300000);

        document.getElementById('syno-nsc-ext-gen3').click();
        timerReopenMainPage();

        var paused = false;
        //自动点击弹窗
        setInterval(function(){
            var clickSure = document.querySelector(".box-sure");
            if(clickSure != null) clickSure.click();

            //如果视频暂停超过10秒,返回主页/课程目录
            if(isVideoPaused() == true){
                if(paused == true){
                    //checkVideoShow();
                    jumpToMainPage();
                }
                paused = true;
            }else{
                paused = false;
            }
        },10000);
    }
    function checkVideoShow(){
        var endhref=href.indexOf("/videoShow");
        var prefix=href.substring(endhref);
        var cwId=href.substring(href.indexOf("cwID="),href.indexOf("&lectureID"));
        cwId=cwId.substring(5);
        location.href="http://"+location.host+"/cwweb/lecture/lectureList?cwID="+cwId;
    }
    function jumpToMainPage(){
        location.href = "http://study.dongao.com/study/u/myCourse?auto=true";
    }
    function isVideoPaused(){
        return window.video.paused();
    }
    function getVideoTotalTime(){
        return window.video.getTotalTime();
    }
    function timerReopenMainPage(){
        setTimeout(function(){
            if(isVideoPaused()){
                window.video.play();
            }
            setTimeout(function(){
                jumpToMainPage();
            },parseInt(getVideoTotalTime()*1000/2+10000));
        },5000);
    }
})();