// ==UserScript== // @name BJTU_auto 北交大快捷评教脚本 // @namespace http://tampermonkey.net/ // @version 1.0 // @description 自用分享,请勿传播 // @author ziu // @match https://aa.bjtu.edu.cn/teaching_assessment/stu* // @icon https://gitee.com/ziuc/utool-filebed/raw/master/20210514-231824-0795.png // @require http://libs.baidu.com/jquery/2.0.0/jquery.min.js // @license MIT // @grant none // @downloadURL none // ==/UserScript== (function() { "use strict"; const rand_txt=["good","好","挺好","非常好"] // 主观填空词库 const configBox = /*html*/`
🔄 刷新
⏩ 下一课
❔ 随机
✅ 提交
1️⃣ 选A
4️⃣ 选D
5️⃣ 选E
`; $("body").append(configBox); let commonColor = "#25ae84"; let overColor = "#187457"; $("#config_window").css({"position":"fixed","border":"solid","width":"80px","z-index":"999999","opacity":"0.3","cursor":"pointer","top":"25%","left":"0px"}); $(".config").css({"font-size":"14px","text-align":"center","padding":"8px 3px","color":"#FFF","background-color":commonColor}); // 给设置窗口添加效果 移入透明度加深 移出透明度变浅 $("#config_window").mouseenter(()=>{ $("#config_window").css("opacity","1.0"); $("#config_window").mouseleave(()=>{ $("#config_window").css("opacity","0.5"); }); }); $(".config").mouseenter(function (){ $(this).css("background-color",overColor); $(".config").mouseleave(function (){ $(this).css("background-color",commonColor); }) }) let init_rand=(first,last)=>{ return parseInt(Math.random() * (first - last + 1) + last); } // 刷新 $("#config_reload").click(()=>{location.reload();}) // 下一课 $("#config_next").click(()=>{ if(window.location.href.indexOf("list")==-1){ alert("当前不在选课列表,无法跳转。"); return }else window.location.href=getnxturl(); }) $("#config_submit").click(()=>{$("button:contains('保存')").trigger("click");}) // 提交 $("#config_randchoose").click(()=>{randchoose();}) // 随机选 $("#config_chooseA").click(()=>{choose(0);}) // 全选A $("#config_chooseD").click(()=>{choose(3);}) // 全选D $("#config_chooseE").click(()=>{choose(4);}) // 全选E let getnxturl=()=>{return "https://aa.bjtu.edu.cn"+$("td>a:contains('评教')").attr("href")} let randchoose=()=>{ 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 choose = (choice)=>{ for(let i=0;i<10;i++){ $("#id_select-"+i+"-select_result_"+choice).attr("checked", "checked"); } } $("#id_comment-0-comment_result").text(rand_txt[init_rand(-1,rand_txt.length)]); choose(0); // 默认全选A })();