形势与政策,可挂后台,自动切换专题

进入个人学习界面后选择好要挂的专题以及时长,即可开始挂课

目前為 2021-04-27 提交的版本,檢視 最新版本

// ==UserScript==
// @name         形势与政策,可挂后台,自动切换专题
// @namespace    http://tampermonkey.net/
// @version      2.3.1
// @description  进入个人学习界面后选择好要挂的专题以及时长,即可开始挂课
// @author       Lai
// @match        http://xsyzc.gzcc.cn/*
// @grant        none
/* globals jQuery, $, waitForKeyElements */
// ==/UserScript==
        function x_y() {
            var x = Math.random() * 1000;
            var y = Math.random() * 1000;
            x = parseInt(x).toString();
            y = parseInt(y).toString();
            $("#xID").attr("value", x);
            $("#yID").attr("value", y);
            setTimeout(() => {
                x_y()
            }, 5000)
        }
        function win111(){
            var a = [];
            var b = [];
            for (var i = 1; i < 6; i++) {
                var n = "q" + i;
                var q = document.getElementsByName(n);
                if(q[0].checked){
                    a.push(parseInt(q[0].value));
                    b.push(parseFloat(q[1].value));
                }
            }
            fun(0,a,b);
        }
        function fun(n, p, q) {
            var xx = document.querySelectorAll(".nav-item .dropdown-menu li a");
            xx[p[n]].click();
            setTimeout(function () {
                $('#win').window('close');
                fun(n++, p, q);
            }, q[n++] * 60 * 1000);
            setTimeout(() => {
                x_y()
            }, 5000)
        }

        const info = $("        <div\n" +
            "            style='\n" +
            "                width: max-content;\n" +
            "                border-radius: 19px;\n" +
            "                position: absolute;\n" +
            "                right: 500px;\n" +
            "                bottom: 350px;\n" +
            "                background:rgb(237, 248, 187);\n" +
            "                text-align: center;\n" +
            "            '\n" +
            "        >\n" +
            "            <p>受网络影响,建议输入时长比预期时长多0.5~1分钟</p>\n" +
            "            专题1<input name=q1 type='checkbox' value='0'>时长:(分钟)<input name=q1 type='text'><br>\n" +
            "            专题2<input name=q2 type='checkbox' value='2'>时长:(分钟)<input name=q2 type='text'><br>\n" +
            "            专题3<input name=q3 type='checkbox' value='4'>时长:(分钟)<input name=q3 type='text'><br>\n" +
            "            专题4<input name=q4 type='checkbox' value='6'>时长:(分钟)<input name=q4 type='text'><br>\n" +
            "            专题5<input name=q5 type='checkbox' value='8'>时长:(分钟)<input name=q5 type='text'><br>\n" +
            "            <button id='btn' style='border-radius: 8px; background-color:rgb(221, 241, 129);'>开始挂课</button>\n" +
            "        </div>")
        $("html").append(info)
        $("#btn").click(() => {
            win111();
        })