Greasy Fork

Greasy Fork is available in English.

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

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

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

// ==UserScript==
// @name         SYUCT沈阳化工大学教务系统助手
// @namespace    http://tampermonkey.net/
// @version      0.2
// @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");
        }
    }

    //自动评价功能
    //其实我想写遍历功能的,但是不知道为什么这个选择器就是选择不上去。
    //所以遍历功能作废吧,等我会了再写。
    //解决方法就是多写一点代码,尽可能多的捕捉下拉框,如果捕捉到了就执行,捕捉不到也不会阻塞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();
    }

})();

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

/*
//第一行代码遍历是成功的,但是num++无法执行
    var rows=document.getElementsByClassName('datelist pjnr ').DataGrid1.rows.length-1;
    for(var i=0;i<rows;i++)
    {
        var num=2;
        var my_selector='#DataGrid1__ctl'+num+'_JS1';
        document.querySelector(my_selector).value='差';
        num++;
    }

*/