Greasy Fork

来自缓存

Greasy Fork is available in English.

永祥学习中心自动脚本

时代光华课程自动学习,自动进入学习,定时刷新课程页面,自动点击下一步,自动课程评价满分

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         永祥学习中心自动脚本
// @namespace    https://github.com/zhengchuan
// @version      0.5
// @description  时代光华课程自动学习,自动进入学习,定时刷新课程页面,自动点击下一步,自动课程评价满分
// @author       zhengchuan
// @match        https://yxgf.21tb.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=21tb.com
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    let util = {
        url_course_info:'https://yxgf.21tb.com/els/html/course/course.courseInfo.do',
        url_course_learn:'https://yxgf.21tb.com/els/html/courseStudyItem/courseStudyItem.learn.do',
        url_course_eval:'https://yxgf.21tb.com/els/html/studyCourse/studyCourse.enterCourse.do',
        /**
         * 初始化加载,全局入口
         */
        init : function(){
            let url = location.href;
            // 自动点击“进入学习”
            if(url.startsWith(this.url_course_info)){
                util.autoCourseInfo();
            }
            // 自动完成学习
            if(url.startsWith(this.url_course_learn)){
                util.autoCourseLearn();
            }
            // 自动评分
            if(url.startsWith(this.url_course_eval)){
                util.autoCourseEval();
            }
        },
        /**
         * 课程信息页面自动点击“进入学习”
         */
        autoCourseInfo : function(){
            $("#goStudyBtn")[0].click();
        },
        /**
         * 自动学习课程 (监控进度自动点击下一步,定时刷新页面)
         */
        autoCourseLearn : function(){
            setInterval(function(){
                learnUtil.auto();
            },learnUtil.offset);
        },
        /**
         * 课程学习自动评分(默认满分)
         */
        autoCourseEval : function(){
            $("body > article > div > div.cs-test-head.cs-evaluate-head > div > p.cs-eval-score > input:nth-child(9)").click();
            $("#courseEvaluateForm > div:nth-child(2) > ul > li:nth-child(1) > div.cs-test-option.cs-test-radio.cs-test-radio-last").click();
            $("#courseEvaluateForm > div:nth-child(2) > ul > li:nth-child(2) > div.cs-test-option.cs-test-radio.cs-test-radio-last").click();
            $("#courseEvaluateForm > div:nth-child(2) > ul > li:nth-child(3) > div.cs-test-option.cs-test-radio.cs-test-radio-last").click();
            $("#courseEvaluateForm > div:nth-child(2) > ul > li:nth-child(4) > div.cs-test-option.cs-test-radio.cs-test-radio-last").click();
            $("#courseEvaluateSubmit").click();
            $("#layui-layer1 > div.layui-layer-btn > a.layui-layer-btn1")[0].click();
        }
    };

    /**
     * 自动学习相关方法参数
     */
    let learnUtil = {
        // 间隔次数计数
        count : 0,
        // 定时任务间隔
        offset : 10000,
        // 自动操作
        auto : function(){
            // 下一步按钮可见时自动点击下一步
            let nextBtn = $("#goNextStep");
            if(nextBtn.is(":visible")){
                $("#goNextStep").click();
                return;
            }
            // 630秒自动刷新页面
            learnUtil.count++;
            console.log(learnUtil.count);
            if(learnUtil.count * learnUtil.offset / 1000 > 630){
                location.reload();
            }
        }
    }

    // 执行方法
    util.init();

})();