济南专业技术人员继续教育—公需课

公需科目辅助|自动答题|自动切换下一小节

ติดตั้งสคริปต์นี้?
สคริปต์ที่แนะนำของผู้เขียน

คุณอาจชื่นชอบ 暴力猴控制台美化

ติดตั้งสคริปต์นี้
// ==UserScript==
// @name        济南专业技术人员继续教育—公需课
// @namespace   Violentmonkey Scripts
// @match       *://*.ghlearning.com/*
// @match       http://221.214.69.254:9091/*
// @grant       none
// @version     0.1.10
// @author      aliha
// @description 公需科目辅助|自动答题|自动切换下一小节
// @license      GPL-3.0
// @run-at       document-end
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEwAAABNCAIAAACDqRXZAAAACXBIWXMAABnWAAAZ1gEY0crtAAAAEXRFWHRTb2Z0d2FyZQBTbmlwYXN0ZV0Xzt0AAB3TSURBVHictXz3d1zHleZ3q+qlTkA3IpHBKFEkrUAFS7LCaGzJtmzPeL07c9Zn91/Qn7Pn7J5N49n1eD3jHY2Og6SRrGBZkZYpRokEAYIAkdEAGt39QlXd/eF1Aw2gm5TD1ulDvq5XXXW/qpurCvS1/zCFvYUBCxAg2n1t2+ZLViaAJrgMufcVAQnABIf3/Hbfzy3Azc73DbTzigAcGEjhQCE03rX9etdKIigJ17W+kzgqcWWsVCQpEWQ0wRArJslgCMsyMZ7WXmTcauKEieCEYDsO1Ip/3+j7pmZfaQPyjyuuw1lf54J6V3ajr7tyqKc21FvuKawXc6vdmcXA23BVVZJJGzNDGz/U+Uqtf6Pav17pWSiXFlZzy+XseqW4VctXQ7cewVr644hRgGRQy9c/qRBBClZS9xejicHqsdG5e4c/6e+6kffLjqOVSKQwUmhBBsTEjWViEp6sZtR6l3d7qEsaIxOr6lFus9Z/fens1bnjNxZKt5aCeii1FczE/AdSBbROz58Ekgi5jB3rr9w7duPekfODpYVidrM7u+o7W1IkRAwAO/S1ENpAKyChIQEHAAr+Zim/1lNYOXHo/bVKcWrxniu37rs2379SdrX5U8gEHVQ8X6ZISfmMPjW58tiJdyb6pvoLK8XssuPU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b8fu/3/4v/8lMLZL2CYqJbDa78PCz5+/55qWBr05nj5dRCCE1UQMJNa5CaIIhOLxrHXTzldwxIbQTenGL18cNNWFSHdXYkUBkxIrs3Sp01eXw9gmvd3C2tDWfX5p1qmscbdV//a48MumPDtj55ejND/Slq1RjYrfJPjt8JMm6ZnUzevtD58gRdXjUzM6HP38juTUPo6zfXesZ3OwZWw8Gbg0/eMsf29ZBaIQGiKGaMVN6mz01Gzt37AwB3PAMUuJ374U0ZLRFdncuu5vmzZnGpifDgkLtzNnSxtBTPcPlwc3pQ9kLXVvzQbxkZ+adi5edB06a2dvxh5+YhTJZ2UGvCaqTvvx5cu2as3gmuXajfu73od9XHz1UDfpXho4tDZxccfrXTT5KHMswIENwmsacWjrdUXS2iUq1EH/3m7A7orznkCCDQbGRGyJbgT+fKRZPHC/J7d5ouTj/UXHZLX60oGqrSawp168kUWLIpEdeG0JppYBSiVswGRWvVDc+mN2+tlXOjpfvf3at68gada/ZXCiy2ijDIs1u7izdHUraZvcIX3rBsMPe8h6Qd2hgLRhCUzYRQVn2zvmD3vBItytLs/kuA2/kqcBbCsplt1IR9RolSbrFyFJaz02y+ahYqpeKMY5UrgXrm8c3BoeqlI9VNmI3Ae27l35neDvU7vsjCbRzL+RPKendG82kWdQ5kO7wZoKlJfiQjvuw6qk62ZqMI0oS0g3Tz4JYSut6SZAxXqDDbLSQqWsVqaKxxJpAf+Qd7bblz/bHFJrXjIRmGI1QgxAAAaleZJmyAJhbCCdKL4IQA4hSxdfu5sefo/zZQLYWbljnhq3dIyLtf/D/g4rd8v8AQkxrrVnjfEAAAAAASUVORK5CYII=
// ==/UserScript==
(function () {

    // 定义一些设置变量
    const NEXT_SUBMIT_DEALY = 6;    // 尝试错误后下一次提交间隔秒,目前测试6秒刚好,不然会在弹窗出现之前往下执行,跳过一些答案选项组合
    const SUBMIT_DELAY = 1;         // 填写完成答案后,提交间隔
    const FIRST_RUN_DELAY = 15;     // 首次运行延迟15秒,防止在player没加载前运行出错
    const RUN_INTERVAL = 180;       // 脚本运行间隔,默认180秒
    const PLAY_TYPE = 1;            // 播放方式,1-方式一;2-方式二


    // 延迟s秒
    function delay(s) {
        return new Promise(resolve => setTimeout(resolve, s * 1000));
    }

    // 检测答题元素,获取选项
    function getItems() {
        if (document.querySelector(".pv-ask-modal")) {
            let qusCard = document.querySelector(".pv-ask-modal")
            let inputs = qusCard.querySelectorAll("input")
            return inputs
        }

        return null
    }

    // 生成数组所有的穷举组合并剔除空数组
    function generateCombinations(arr) {
        const combinations = [
            []
        ];

        // 遍历数组元素
        for (let i = 0; i < arr.length; i++) {
            const currentLength = combinations.length;

            // 遍历当前已生成的组合
            for (let j = 0; j < currentLength; j++) {
                const currentCombination = combinations[j];

                // 生成新的组合,包含当前数组元素
                const newCombination = currentCombination.concat(arr[i]);

                // 如果组合不为空,则将新组合添加到二维数组中
                if (newCombination.length > 0) {
                    combinations.push(newCombination);
                }
            }
        }

        // 剔除空数组
        return combinations.filter(combination => combination.length > 1);
    }

    // 判断是否暂停
    function isPuased() {
        var elements = document.getElementsByClassName("pv-icon-btn-play");
        for (var i = 0; i < elements.length; i++) {
            var element = elements[i];
            var computedStyle = window.getComputedStyle(element);
            if (computedStyle.getPropertyValue("display") === "block") {
                // console.log(element);
                return true;
            } else {
                return false;
            }
        }
    }

    // 获取进度,自动播放
    function getProcess() {
        let jindu = document.querySelector("#a span[du-html=sumschedule]"); // 获取总进度
        if (jindu) {

            if (jindu.innerText === "100.00") {
                console.info("本课程已完成");
                return 0;
            } else {
                // 获取当前进度,如果播放完毕或者未开始,点击播放按钮开始播放,(因为系统播放完一节会自动切换下一节,所以光点击播放按钮就可以了,不用手动切换小节)
                let dangqian = document.querySelector(".videoLi.active");
                let ispaused = isPuased();
                if (dangqian.innerText.match(/[0-9]+%/)[0] == "100%" || dangqian.innerText.match(/[0-9]+%/)[0] == "0%" || ispaused) {
                    console.info("本课程未完成,继续播放");

                    if (PLAY_TYPE === 1) {
                        console.info("使用方式一自动播放")
                        const pauseBtn = document.querySelector('button[type="button"].pv-playpause.pv-iconfont.pv-icon-btn-play');
                        if (pauseBtn) {
                            pauseBtn.click();
                        }

                    } else if (PLAY_TYPE === 2) {
                        console.info("使用方式二自动播放")
                        const video = document.getElementById('video');
                        video.muted = true;
                        video.play()
                            .then(() => {
                                console.info("自动播放成功");
                            })
                            .catch(error => {
                                console.error('自动播放失败,请手动点击播放:', error);
                            });
                    }
                }
            }
        }
    }

    // 挨个尝试,检测到回答错误继续,检测到回答正确跳出,同时清空答案
    async function answer(res_ls) {

        for (let i = res_ls.length - 1; i != 0; i--) {
            await delay(NEXT_SUBMIT_DEALY)

            let inputs = getItems()
            if (inputs) {
                console.log(`尝试第${res_ls.length - i}次作答`)
                // console.log(...res_ls[i])
                for (let j = 0; j < res_ls[i].length; j++) {
                    inputs[res_ls[i][j]].checked = true;
                }

                // 提交答案
                let button = document.querySelector('button.pv-ask-submit[data-type="pvSubmit"]');
                await delay(SUBMIT_DELAY)
                if (button) {
                    button.click()
                }
            }else{
                console.log("回答正确");
                break;
            }
        }
    }

    // 主函数
    async function main() {
        console.info("开始答题")

        await getProcess()

        // 自动答题
        if (getItems()) {
            let inputs = getItems()
            const array = Array.from({
                length: inputs.length
            }, (_, index) => index);
            let num = generateCombinations(array)
            await answer(num)
            console.info("答题脚本执行完毕")
        } else {
            console.info(`未检测到答题卡,${RUN_INTERVAL}秒后再次运行`)
        }
    }


    setTimeout(main, FIRST_RUN_DELAY*1000);
    setInterval(main, RUN_INTERVAL*1000);
})();