// ==UserScript== // @name BJTU_auto 北交大快捷评教脚本 // @namespace http://tampermonkey.net/ // @version 0.1.2 // @description 自用分享,请勿传播 // @author huuc // @match https://aa.bjtu.edu.cn/teaching_assessment/stu* // @icon https://picsum.photos/id/331/200/200 // @require http://libs.baidu.com/jquery/2.0.0/jquery.min.js // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; // 设置框 const configBox = "
"+ "
刷新
"+ "
下一课
"+ "
提交
"+ "
随机选
"+ "
全选A
"+ "
全选E
"+ "
"+ "
"; $('body').append(configBox); // $('#config_window').hide(); // 默认隐藏设置框 // 给ESC按键添加事件:按下出现设置框 $(document).keyup(function (event) { switch (event.keyCode) { case 27: $('#config_window').toggle(); } }); // 给设置窗口添加效果 移入透明度加深 移出透明度变浅 $("#config_window").mouseenter(function(){ $("#config_window").css("opacity","1.0"); }); $("#config_window").mouseleave(function(){ $("#config_window").css("opacity","0.5"); }); let rand_txt=['good','好','非常好','giegie~~'] // 主观填空词库 let init_rand=function (first,last){ return parseInt(Math.random() * (first - last + 1) + last); } // 刷新 $('#config_reload').click(function (){ location.reload(); }) // 下一课 $('#config_next').click(function (){ window.location.href=getnxturl(); }) // 提交 $('#config_submit').click(function (){ $("button:contains('保存')").trigger("click"); }) // 随机选 $('#config_randchoose').click(function (){ randchoose(); }) // 全选A $('#config_chooseA').click(function (){ Achoose(); }) // 全选E $('#config_chooseE').click(function (){ Echoose(); }) let getnxturl=function (){ return 'https://aa.bjtu.edu.cn'+$("td>a:contains('评教')").attr('href') } let randchoose=function (){ for(let i=0;i<10;i++){ let choice = init_rand(-1,5) // 0~4 $("#id_select-"+i+"-select_result_"+choice).attr('checked', 'checked'); } } let Achoose=function (){ for(let i=0;i<10;i++){ let choice = 0; $("#id_select-"+i+"-select_result_"+choice).attr('checked', 'checked'); } } let Echoose=function (){ for(let i=0;i<10;i++){ let choice = 4; $("#id_select-"+i+"-select_result_"+choice).attr('checked', 'checked'); } } let rand_num = init_rand(-1,rand_txt.length) $('#id_comment-0-comment_result').text(rand_txt[rand_num]); Achoose(); // 默认全选A })();