全国民办高校党史学习教育知识竞赛练习题脚本

自动做全国民办高校党史学习教育知识竞赛练习题

// ==UserScript==
// @name         全国民办高校党史学习教育知识竞赛练习题脚本
// @namespace    Zcentury
// @version      1.3
// @description  自动做全国民办高校党史学习教育知识竞赛练习题
// @author       Zcentury
// @match        *://ks.wjx.top/*
// @icon         https://cdn.Zcentury.top/Image/favicon.ico
// @require      https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    $(document).ready(function() {

        console.log("欢迎使用全国民办高校党史学习教育知识竞赛练习题脚本")
        let html = '<div id="msg" style="border: 1px solid green;background: rgba(190, 247, 153, 0.90);width: 200px;height: 50px;font-size: 20px;position: fixed;top: 0;right: 0;z-index: 9999!important;text-align: center;line-height: 50px;">'
        html += '请选择学校'
        html += '</div>'

        $("body").append(html);
        let indexNum = 0

        $("body").on('click', 'a, td', function() {


            if ($(this).attr('class') == 'button white') {
                let el = $(".fieldset[style='']")
                $("#divNext > a").hide()

                setTimeout(() => {
                    let title = el.find('div.field-label').html()
                    let radio = el.find('.ui-controlgroup .ui-radio[ans="1"]')
                    let checkbox = el.find('.ui-controlgroup .ui-checkbox[ans="1"]')

                    if (checkbox.length > 0) {
                        checkbox.click()
                    } else {
                        radio.click()
                    }
                    indexNum++
                    setTimeout(() => {
                        if (indexNum <= 90) {
                            $("#divNext > a").click()
                            $("#msg").html("已答:&nbsp;" + indexNum + "&nbsp;题")
                        } else {
                            $("#msg").html("请手动填写填空题")
                            $("#divNext > a").show()
                        }
                    }, 0);
                }, 0);

            }

        })

    })

})();