Greasy Fork

Greasy Fork is available in English.

SYUCT沈阳化工大学教务系统助手

提供一键自动填写评价功能

当前为 2022-01-05 提交的版本,查看 最新版本

// ==UserScript==
// @name         SYUCT沈阳化工大学教务系统助手
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  提供一键自动填写评价功能
// @author       Yuhang Shang
// @match        https://jws.syuct.edu.cn/*
// @icon         https://www.shangyuhang.icu/favicon/64_64.ico
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    //使用帮助
    //在使用脚本按键前请先点击页面,使脚本能够获取焦点
    //按下回车键自动填写教师评价(默认第一行是良好,其余行均为优秀)

    //美化部分
    //这部分修改只是无聊之作啦,原谅我的幼稚hhhhh
    var a=document.querySelector('#xhxm').textContent;
    var e=a.split('同学');
    var name=e[0]+'大人';
    document.querySelector('#xhxm').textContent=name;

    //键盘监听事件
    document.addEventListener('keydown', my);
    function my(e){
        if(e.keyCode==13){
            write();
        //window.alert("press");
        }
    }

    //自动评价功能
    //其实我想写遍历功能的,但是不知道为什么这个选择器就是选择不上去。
    //所以遍历功能作废吧,等哪天bug解决了再说,我的思路你可以在最下面找到。
    //目前的解决方法就是多写一点代码,尽可能多的捕捉下拉框,如果捕捉到了就执行,捕捉不到也不会阻塞js进程。
    function write(){
        var a=document.getElementById('DataGrid1__ctl2_JS1');
        a.value='良好';
        if(a=document.getElementById('DataGrid1__ctl3_JS1'))
        {
            a.value='优秀';
        }
        if(a=document.getElementById('DataGrid1__ctl4_JS1'))
        {
            a.value='优秀';
        }
        if(a=document.getElementById('DataGrid1__ctl5_JS1'))
        {
            a.value='优秀';
        }
        if(a=document.getElementById('DataGrid1__ctl6_JS1'))
        {
            a.value='优秀';
        }
        if(a=document.getElementById('DataGrid1__ctl7_JS1'))
        {
            a.value='优秀';
        }
        if(a=document.getElementById('DataGrid1__ctl8_JS1'))
        {
            a.value='优秀';
        }
        if(a=document.getElementById('DataGrid1__ctl9_JS1'))
        {
            a.value='优秀';
        }
        if(a=document.getElementById('DataGrid1__ctl10_JS1'))
        {
            a.value='优秀';
        }
        if(a=document.getElementById('DataGrid1__ctl11_JS1'))
        {
            a.value='优秀';
        }
        if(a=document.getElementById('DataGrid1__ctl12_JS1'))
        {
            a.value='优秀';
        }
        if(a=document.getElementById('DataGrid1__ctl13_JS1'))
        {
            a.value='优秀';
        }
        if(a=document.getElementById('DataGrid1__ctl14_JS1'))
        {
            a.value='优秀';
        }
        if(a=document.getElementById('DataGrid1__ctl15_JS1'))
        {
            a.value='优秀';
        }
        if(a=document.getElementById('DataGrid1__ctl16_JS1'))
        {
            a.value='优秀';
        }
        if(a=document.getElementById('DataGrid1__ctl17_JS1'))
        {
            a.value='优秀';
        }
        if(a=document.getElementById('DataGrid1__ctl18_JS1'))
        {
            a.value='优秀';
        }
        if(a=document.getElementById('DataGrid1__ctl19_JS1'))
        {
            a.value='优秀';
        }
        if(a=document.getElementById('DataGrid1__ctl20_JS1'))
        {
            a.value='优秀';
        }
        if(a=document.getElementById('DataGrid1__ctl21_JS1'))
        {
            a.value='优秀';
        }
        document.querySelector('#pjxx').value='非常好';
        document.querySelector('#Button1').click();
    }

})();

//我把这些历史遗留的解决思路放在这里,留待我以后会了的时候再解决

/*
//这个代码无法直接执行,需要点击选中元素才能执行,解决方法未知
    function write2(){
        let rows=document.querySelector('#DataGrid1').rows.length-1;
        for(let i=0;i<rows;i++){
            let my_selector='#DataGrid1__ctl'+(i+2)+'_JS1';
            document.querySelector(my_selector).value='良好';
            console.log(my_selector);}
    }
*/