方正教务系统期末教学评价助手

用于自动完成期末教学评价

目前为 2022-07-03 提交的版本。查看 最新版本

// ==UserScript==
// @name         方正教务系统期末教学评价助手
// @namespace    http://tampermonkey.net/
// @version      2.1
// @description  用于自动完成期末教学评价
// @author       Eduarte
// @match        *://*/xspjgl/xspj_cxXspjIndex.html*
// @license MIT
// @grant        unsafeWindow
// ==/UserScript==
 
(() => {
    'use strict';
 
    const toInject = document.createElement('script')
    toInject.innerHTML = `
    async function start(awaitTime){
        // 修改UA绕过检测
        const UAs = [
            'Mozilla/5.0 (Linux; Android 12.0; Pixel 5 XL) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.86 Mobile Safari/537.36',
            'Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148',
            'Mozilla/5.0 (Linux; Android 10.0.0; Pixel 5 XL Build/OPP3.9705110.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.36 Mobile Safari/537.36',
            'Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Mobile/15E148 Safari/604.1',
            'Mozilla/5.0 (Linux; Android 10.1; Pixel 5 XL Build/OPM1.67011110.001) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.50 Mobile Safari/537.36'
        ]
        Object.defineProperty(navigator, 'userAgent', {
            value: UAs[Math.floor(Math.random() * 5)],
            writable: false
        })
 
        const sleep = ms => new Promise(r => setTimeout(r, ms))
 
        let courseList = document.getElementsByTagName('tbody')[0].childNodes
        for (let id_ in courseList)
        {
            if (typeof(courseList[id_]) === 'object')
            {
                if (courseList[id_].getAttribute('role') === 'row')
                {
                    let stat = courseList[id_].childNodes[7].getAttribute('title')
                    if (stat === '未评')
                    {
                        courseList[id_].click()
                        await sleep(awaitTime + Math.floor(Math.random() * 100))
                        let checkboxes = document.getElementsByClassName("radio-pjf")
                        let rnd = Math.floor(Math.random() * 10)
                        console.log(rnd * 5)
                        for (let id in checkboxes)
                        {
                            if (typeof(checkboxes[id]) === 'object')
                            {
                                if (id == rnd * 5)
                                {
                                    checkboxes[parseInt(id) + 1].checked = true
                                }
                                else if (checkboxes[id].getAttribute('data-sfzd') === '1')
                                {
                                    checkboxes[id].checked = true
                                }
                            }
                        }
                        document.getElementById('btn_xspj_tj').click()
                    }
                }
            }
        }
 
		alert('已完成评教,请刷新页面查看')
		location.reload()
    }
    `
    const style = document.createElement('link')
    style.setAttribute('rel', 'stylesheet')
    style.setAttribute('href', 'https://www.bootcss.com/p/buttons/css/buttons.css')
    const menu = document.createElement('div')
    menu.innerHTML = `
    <style>
        .closeBtn {
            transition: background-color 0.5s;
            border-radius: 2px
        }
        .closeBtn:hover {
            background-color: #cccccc;
            transition: background-color 0.5s;
            border-radius: 2px;
            cursor: pointer
        }
        .panel_ {
            box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(204,204,204,.6);
            transition: opacity 0.5s linear;
            width: 320px;
            opacity: 0.8;
            position: fixed;
            top: 18vh;
            right: 50px;
            background-color: #ffffff;
            border:solid; 
            border-radius: 5px
        }
        .panel_.hidden {
            opacity: 0
        }
        .title_ {
            font-size: 15px;
            font-weight:bold
        }
        .input_ {
            height: 26px;
            width: 120px;
            outline-style: none;
            border: 1px solid #cccccc;
            transform: translate(0, 4px)
        }
    </style>
	<div
        id="panel_"
        class="panel_"
	>
		<div
			style="padding: 20px 0 0 20px"
		>
			<p class="title_">
                方正教务系统期末教学评价助手 v2.1
			</p>
		</div>
        <div
            style="padding: 20px 0 0 20px"
        >
            <p style="display:inline">等待表单加载时间:</p>
            <input type="text" id= "awaitTime" class="input_" style="display:inline" value="1000" />
        </div>
		<div
			style="padding: 20px 0 0 20px"
		>
			<button
				onclick="start(document.getElementById('awaitTime').value)"
				class="button button-primary button-small"
			>
				开始
			</button>
		</div>
		<div
			style="padding: 20px 0 20px 20px"
		>
			<p>
				&copy; 2022 oxdl.cn
			</p>
		</div>
        <div
            style="position:absolute;top:10px;right:10px"
            class="closeBtn"
            onclick="document.getElementById('panel_').classList.add('hidden')"
        >
            <img src="https://ixnet.icu/statistics/cancel.png" alt="cancel" style="width:16px;height:12px;padding: 1px 4px 3px 4px" />
        </div>
	</div>
	`
 
    document.getElementsByTagName('body')[0].appendChild(menu)
    document.body.appendChild(style)
    document.body.appendChild(toInject)
})();

QingJ © 2025

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