自动批改超星作业

自动批改超星作业,以自定义score数组中的概率打分,并提交下一份

目前为 2020-05-30 提交的版本。查看 最新版本

// ==UserScript==
// @name         自动批改超星作业
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  自动批改超星作业,以自定义score数组中的概率打分,并提交下一份
// @author       aYan
// @match        https://mooc1.chaoxing.com/*
// @match        https://mooc1-1.chaoxing.com/*
// @grant        none
// ==/UserScript==

// function here

// 批改结束调用系统通知
if(window.location.pathname == "/work/reviewTheList"){
    if (window.Notification) {

        var ua = navigator.userAgent.toLowerCase();
        if (ua.indexOf('safari') != -1) {
            if (ua.indexOf('chrome') > -1) {
                // Chrome
                Notification.requestPermission().then(function (permission) {
                    if (permission == "granted") {
                        var notification = new Notification('桌面推送', {
                            body: '请点击批阅或更换作业',
                            icon: 'some/icon/url',
                        });

                        notification.onclick = function () {

                            console.log('点击');
                            notification.close();
                        };
                    } else {
                        Notification.requestPermission();
                        console.log('没有权限,用户拒绝:Notification');
                    }
                });
            } else {
                // Safari
                Notification.requestPermission(function (permission) {
                    if (permission == "granted") {
                        var notification = new Notification('桌面推送', {
                            body: '请点击批阅或更换作业',
                            icon: 'some/icon/url'
                        });

                        notification.onclick = function () {

                            console.log('点击');
                            notification.close();
                        };
                    } else {
                        Notification.requestPermission();
                        console.log('没有权限,用户拒绝:Notification');
                    }
                })
            }
        }
    } else {
        console.log('不支持Notification');
    }
    //alert("请点击批阅或更换作业")

}

// 重载批改函数,取消页面的confirm对话框
function pigai(back){
    $("#back").val(back);
    var a = "88286357,88286358,";
    $("#answerwqbid").val(a);
    var dengji = $("#dengji").val();
    var tmpScore = $("#tmpscore").val();
    tmpScore = tmpScore.replace(/\s+/g, "");
    $("#score").val(tmpScore);
    var score = $("#score").val();
    var fullScore = $("#fullScore").val();
    if(score.length == 0){
        alert("请输入分数。");
        return;
    }
    if(score < 0){
        alert("分数不能小于0。");
        return;
    }
    if(Number(score) > Number(fullScore)){
        alert("分数不能超过满分" + fullScore);
        return;
    }
    if(isNaN(score)){
        alert("分数只能是数字!");
        return;
    }

    if(Number(score)==0){
        if(window.confirm("总分为0,确认要提交批阅结果吗?")){
            setCompoundSubjectQuesScore();
            setCompoundSubjectQuesComment();
            formSubmit();
        }else{
            return false;
        }
    }else{
        if(1){
            setCompoundSubjectQuesScore();
            setCompoundSubjectQuesComment();
            formSubmit();
        }
    }

}

(function score() {
    // 定义分数轮盘
    var score = [90,90,90,90,90,90,90,85,95,100]

    // 按ID获取分数框元素
    var divA = document.getElementById("tmpscore");

    // 按轮盘概率填充分数
    divA.value=score[Math.floor(Math.random()*10)];

    // 超星的批改函数,延时自定义(最大值↓ 最小值↓,单位:毫秒)
    setTimeout(pigai, Math.random() * (1000) + 100);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址