Greasy Fork

Greasy Fork is available in English.

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

进入个人学习界面后点击//右下角//按钮即可开始挂课

当前为 2021-04-22 提交的版本,查看 最新版本

// ==UserScript==
// @name         形势与政策,可挂后台,自动切换专题
// @namespace    http://tampermonkey.net/
// @version      1.6.3
// @description  进入个人学习界面后点击//右下角//按钮即可开始挂课
// @author       Lai
// @match        http://xsyzc.gzcc.cn/*
// @grant        none
/* globals jQuery, $, waitForKeyElements */
// ==/UserScript==

        function fun(n, p, q) {
            var xx = document.querySelectorAll(".nav-item .dropdown-menu li a");
            xx[parseInt(p[n] * 2 - 2)].click();
            setTimeout(function () {
                $('#win').window('close');
                fun(n++, p, q);
            }, q[n++] * 60 * 1000);
            setTimeout(() => {
                x_y()
            }, 5000)
        }

        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)
        }

        var board = document.getElementById("myNewSource");
        var e = document.createElement("input");
        e.type = "button";
        e.id = "btn";
        e.value = "点击此处开始挂课";
        e.style = "float: right; height: 50px; width: 150px;text-align: center; line-height: 50px;"
        e.onclick = function () {
            var patt1 = /[0-9]+/g;
            var patt2 = /[0-9]+(\.\d{1,2})?/g;
            var ti = alert("受网络影响,时间会稍有误差");
            var name = prompt("请输入您想要挂的专题", "如:1,3,4,2");
            var time = prompt("您选择的题号是" + name + ",请输入您想要挂的时长(分钟)", "如:1,36,80,70");
            var a = name.match(patt1);
            var b = time.match(patt2);

            fun(0, a, b);
            setTimeout(() => {
                x_y()
            }, 5000)
        };
        window.onload = board.appendChild(e);