/*globals jQuery,$,waitForKeyElements*/
// ==UserScript==
// @name cumtb教务系统
// @namespace http://tampermonkey.net/
// @version 5.2.21
// @description cumtb教务系统常用功能集合
// @author Su.
// @match https://*.cumtb.edu.cn/*
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAABCJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iCiAgICAgICAgICAgIHhtbG5zOmV4aWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vZXhpZi8xLjAvIgogICAgICAgICAgICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iCiAgICAgICAgICAgIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyI+CiAgICAgICAgIDx0aWZmOlJlc29sdXRpb25Vbml0PjI8L3RpZmY6UmVzb2x1dGlvblVuaXQ+CiAgICAgICAgIDx0aWZmOkNvbXByZXNzaW9uPjU8L3RpZmY6Q29tcHJlc3Npb24+CiAgICAgICAgIDx0aWZmOlhSZXNvbHV0aW9uPjcyPC90aWZmOlhSZXNvbHV0aW9uPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICAgICA8dGlmZjpZUmVzb2x1dGlvbj43MjwvdGlmZjpZUmVzb2x1dGlvbj4KICAgICAgICAgPGV4aWY6UGl4ZWxYRGltZW5zaW9uPjMyPC9leGlmOlBpeGVsWERpbWVuc2lvbj4KICAgICAgICAgPGV4aWY6Q29sb3JTcGFjZT4xPC9leGlmOkNvbG9yU3BhY2U+CiAgICAgICAgIDxleGlmOlBpeGVsWURpbWVuc2lvbj4zMjwvZXhpZjpQaXhlbFlEaW1lbnNpb24+CiAgICAgICAgIDxkYzpzdWJqZWN0PgogICAgICAgICAgICA8cmRmOkJhZy8+CiAgICAgICAgIDwvZGM6c3ViamVjdD4KICAgICAgICAgPHhtcDpNb2RpZnlEYXRlPjIwMTctMTItMDFUMDk6MTI6MzI8L3htcDpNb2RpZnlEYXRlPgogICAgICAgICA8eG1wOkNyZWF0b3JUb29sPlBpeGVsbWF0b3IgMy4zPC94bXA6Q3JlYXRvclRvb2w+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgo/5hY1AAAEZUlEQVRYCe1W3WscVRS/587Obm03H9WCFaUPbSxYpLSi6IMf9FWQYFJEqYoBUaw2LS1RiEmNYLMxVsVEUyu1FEulEG1obd9E8ME/QG2lfjyIfVGUtm6WNN2Pe/2dMzuzM+vNZvISX7zZmTlz7jm/3++ee+cQpf4f/3EFaKn8j75R7K5Zs19Zez63wn9l+uX870vFiMenEmCtpe2F2e6qEeKt1ipl8YdfUWsa2Xp/5+TINqrGgdPaLQUI8fhst6na10C4hYmxcv6xUX8qBZAfPK13zQx3fpWWOIxrKaBnrHjUGtsndDHyYPUNATxPjER6mii77/TQykvsSzOcAraPlc5arU7c1LHqs7+ulgaVsa9CiM/E8SqgQhEHsYLgN6c8OrAu3/H2ZD9djwIWMLTTr9U9IP308tXSSe8GNUXKu1dp+p7A4FRcBwnmaCUZdeBSqXi+d/Tvh534MadTAOHQ8YKwwB47py4oZdZnNrTdTZoKuGpSb2ZzqQl9VnUZq871FIpnegvz62OcCTMMTzgfe6v0pzFqTfygodgnvWz+RVW51lWtVI4Za+7gLZBdAIpUh5/RVogz0Kj1dezeuJfLF6b30rU4mbMCINPBoQKsgMpiHzfl0gXl1Uodt7bfhYCDpLSJwBAXVkQ2SvjrydbmSNlhWy5djOLrhlOA5nWAWTADJSIEOWtNVW841kfzM0OdA15GP4iJnxvcLFiYpSIMEGCwOEhQal0qARZLk2QWIRfnB7bnNSBODbZ/c8vNnVswM4EAHBwmCmKDZ0DMzkhII10sdwXQ3jglItd12xH90fM0d3r/6t1ae9uQ9ovkCK8gAIMFsYP55MZGNByQCLPCXU8MhaAsjBSrQIQCY2aw7Wsv175Ze/ogrlpAGjCLFDjEF0+C7RZAxMdApIelx+eHRqeVr71G92kCU7epMuIvIvVKVL1AQ3Nk9J6JrLiBpaIKicE4rcYT78w/Yn6bG0PaJi61a7WufLcA3oJYNK9GBh5e/BTCuWOifB/c46ZmHtCokPQGDo4WEBhyj3yCJjenAO2RjrX5RjQsNCiBefp9u9HUyqMg7GUHb5HirsBaY2xYi7yz23EGlVMAyCWec5oHkVm7473yoVqt8izmEvkJEZgUYQIgiiCAfpXX2C0BEPM7DyfPG2OPxOL+ZQYi0KKxbdJ6gvLMgn10TSb7bnOCW0A9tzk47Xsoglu10fbjVSo3fGQP/eHKdwrgPlAvmisnnU+rL/HB7juxZ8V3rRKcAlDABbegFRjP4fD8SOQNHO/PfLFYLM87ibB9b6ZJTsbQZbSP3V2bs3emJef8BU/7k5PlPhzjw/jM/CRR8g09ooK4qTbff/3QTrqSnF38bUEBnPrUROUhY+0pfFA3uqBQqTNaZwc+eYl+cs2n8bUUwADPfGhvr5bLZ9EbNoaAWPW3uPYe3+Uv+d/wECN8LiqAA1+YsquL1crnKPUmJAx19ftHR9CRQpBleT532Po7P7D5ZSFbTpJ/ADD+XJu5KreuAAAAAElFTkSuQmCC
// @require https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_deleteValue
// @grant GM_notification
// @grant GM_openInTab
// @grant window.close
// @grant unsafeWindow
// ==/UserScript==
/*对按钮内容进行自定义*/
let URLs=[],按钮内容=["我的课表","选课","考试信息","成绩信息","学生总结性评教","空闲教室查询"]//可自行调整,务必与教务系统中按钮下方的内容一样,注意格式(符号为英文格式),中间用逗号隔开
/*自定义完毕*/
const URL对照={"空闲教室查询":"/room-free","学籍信息":'/student-info',"学生信息核对":'/std-info-check-apply',"学籍异动申请":'/std-alteration-apply',"转专业申请":'/change-major-apply',"我的培养方案":'/program',"培养方案完成情况":'/program-completion-preview',"选课":'/course-select',"我的课表":'/course-table',"体育保健课申请":'/course-select-apply',"免修申请":'/exempt-study-apply',"专业课组选择":'/std-professional-group',"学生学生专业课组变更申请":'/pro-group-change-apply',"缓考申请":'/exam-delay-apply',"考试信息":'/exam-arrange',"成绩信息":'/grade/sheet',"成绩复核申请":'/grade-review-apply',"补考成绩查询":'/make-up-grade/sheet',"学生可信学业证明申请":'/credible-school-report-apply',"创新学分":'/other-achievement-apply',"导师互选结果查询":'/select/std-tutor-select-result',"学生变更导师申请":'/change-tutor-apply',"学生总结性评教":'/evaluation/summative',"学生问卷调查":'/questionnaire',"毕业设计(论文)抽检结果查询":'/thesis-check',"毕业设计(论文)":'/thesis-flow',"课题申报":'/sie-project-apply/index',"学生选题":'/sie-project-member-apply',"我的项目":'/sie-project'}
let members = 按钮内容.length;for(let i=1;i<=members;i++){URLs[i]='https://jwxt.cumtb.edu.cn/student/for-std'+URL对照[按钮内容[i-1]]}
let identify=GM_getValue("身份");//入口、主页
let numb = GM_getValue("账号");//登陆
let mima = GM_getValue("密码");//登录
let 上次课程数 = GM_getValue("上次课程数")//成绩单
let 上次不及格 = GM_getValue("上次不及格")//成绩单
let setTime = GM_getValue("刷新时间")//成绩单
var 刷新;//成绩单
let last_page = GM_getValue("上次打开");//登录、主页
function 教务系统入口(){
if(!identify){
identify=prompt("首次登录需要输入身份。学生/教师/管理/外聘/家长?")
if(identify!=null && identify!=""){GM_setValue("身份",identify)}
}
setTimeout(()=>{
switch (identify){
case "学生":document.querySelector("body > div.login-box > div > div.login-content > div:nth-child(1) > div.login-student-box > a").click();break;
case "教师":document.querySelector("body > div.login-box > div > div.login-content > div:nth-child(1) > div.login-teacher-box > a").click();break;
case "管理":document.querySelector("body > div.login-box > div > div.login-content > div:nth-child(2) > div.login-manager-box > a").click();break;
case "外聘":case "家长":document.querySelector("body > div.login-box > div > div.login-content > div:nth-child(2) > div.login-parent-box > a");break;
}
},500)
let table=null
table = document.createElement('div');
table.style.cssText="width:100px;padding:20px;border:1px solid #ccc;border-radius:10px;position:fixed;top:10px;right:50px;background:rgba(255, 255, 255,0.5);display:flex;justify-content:center;align-items:center;flex-direction:column"
let body = document.querySelector('body');
body.appendChild(table);
let btn1 = document.createElement('button');
btn1.innerHTML="更改身份"
btn1.style.cssText="height:30px;width:80px;border-color:#ffb6c1;border-radius:5px;position:fixed;cursor:pointer;background:white;color:red";
table.appendChild(btn1);
document.querySelector('button').onmouseover=function(){this.style.background ='lightpink';this.style.color='black'}
document.querySelector('button').onmouseout =function(){this.style.background = 'white' ; this.style.color ='red'}
btn1.addEventListener('click',更改身份)
}
function 登录(){
console.log("登录页面")
//账号密码判断
if(!numb){
numb=prompt("首次登录需要输入账号")
if(numb!=null && numb!=""){GM_setValue("账号",numb)}
};
if(!mima){
mima=prompt("首次登录需要输入密码(仅存储在本地)")
if(mima!=null && mima!=""){GM_setValue("密码",mima)}
};
//添加div
let t = document.createElement('div');
t.style.cssText="width:300px;padding:20px;border:1px solid #ccc;border-radius:10px;z-index:1001;position:fixed;top:43px;left:1610px;background:rgba(255, 255, 255,0.5);display:block;justify-content:center;flex-direction:column";
let cssText="height:30px;border-color:#ccc;border-radius:5px;margin:10px;cursor:pointer;background:lightgreen;"
$("body").append(t)
let btns= ['更改账号','查看密码','更改密码'];let amount = btns.length;
for(let i=1;i<=amount;i++){
let tnnd = ['button#'+btns[i-1]]
$(`<button id = ${btns[i-1]} style=${cssText+"border-color:lightpink;width:80px;background:white;color:red"}>${btns[i-1]}</button>`).appendTo($(t)).on('click',eval(btns[i-1]))
document.querySelector(tnnd).onmouseover=function(){this.style.background ='lightpink';this.style.color='black'}
document.querySelector(tnnd).onmouseout =function(){this.style.background = 'white' ; this.style.color ='red'}
}
console.log("ok")
console.log(`
账号:${numb}
密码:${mima}
`)
//登录1
if(location.href.indexOf('https://auth.cumtb.edu.cn/authserver/login?service=')!=-1){//从教务系统入口点击进入的登录
var 用户名 = document.querySelector('[name="username"][placeholder="用户名"]')
用户名.value = numb
var 密码 = document.querySelector('[type="password"][placeholder="密码"]')
密码.value = mima
var 移动端 = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
let 一周内免登录,登录
for (let i = 0; i < 移动端.length; i++) {
if (navigator.userAgent.indexOf(移动端[i])!=-1) {
console.log("移动端")
一周内免登录 = document.querySelector("#rememberMe");
登录 = document.querySelector("#loading")
break
}
else if (navigator.userAgent.indexOf(移动端[i])==-1){
console.log("电脑端")
一周内免登录 = document.querySelector('ins[class="iCheck-helper"]')
登录 = document.querySelector("#casLoginForm > p:nth-child(5) > button")
break
}
}
setTimeout(()=>{
一周内免登录.click(登录.click())
console.log("正在登陆")
},500)
}
//登录2
if(location.href.indexOf('https://jwxt.cumtb.edu.cn/student/login?refer=https://jwxt.cumtb.edu.cn')!=-1){//长时间无操作会导致教务系统自动退出,在个别子页面内刷新页面之后需要点统一身份认证登录
let 统一身份认证登录 =document.querySelector("body > div > div > div:nth-child(2) > div > div > div.form-group.text-center > a")
setTimeout(()=>{
统一身份认证登录.click()
console.log("前往统一身份认证登录")
},500)
let url=location.search;
let tr = url.split('=')[1];
GM_setValue("上次打开",tr)
}
}
function 教务系统主页(){
if(location.href=='https://jwxt.cumtb.edu.cn/student/home'||identify=="学生"){
console.log("主页面")
let t = document.createElement('div1');
t.style.cssText="width:300px;padding:20px;border:1px solid #ccc;border-radius:10px;z-index:1001;position:fixed;background:rgba(255,255,255,0.5);display:block;justify-content:center;flex-direction:column";
let cssText="height:30px;border-color:#ccc;border-radius:5px;margin:10px;cursor:pointer;background:lightgreen;"
$("body").append(t);for(let i=1;i<=members;i++){
$(`<button id ="btn${i}"style=${cssText+"border-color:lightgreen;background:white;color:green"}>${按钮内容[i-1]}</button>`).appendTo($(t)).on('click',跳转(i));
document.querySelector('button#btn'+i).onmouseover=function(){this.style.background ='lightgreen';this.style.color='black'};
document.querySelector('button#btn'+i).onmouseout =function(){this.style.background = 'white' ; this.style.color = 'green'};
}
$(`<hr></hr>`).appendTo($(t))
let fixedbtn= ['更改身份','更改账号','查看密码','更改密码'];let amount = fixedbtn.length;
for(let i=1;i<=amount;i++){
let tnnd = ['button#'+fixedbtn[i-1]]
$(`<button id = ${fixedbtn[i-1]} style=${cssText+"border-color:lightpink;width:80px;background:white;color:red"}>${fixedbtn[i-1]}</button>`).appendTo($(t)).on('click',eval(fixedbtn[i-1]))
document.querySelector(tnnd).onmouseover=function(){this.style.background ='lightpink';this.style.color='black'}
document.querySelector(tnnd).onmouseout =function(){this.style.background = 'white' ; this.style.color ='red'}
}
$(`<hr><h4><p>若想修改绿色按钮,请修改代码里的按钮内容</p><p><strong>修改按钮内容时不要改格式!!!</strong></p><p>红色为固定按钮不会改变</p>`).appendTo($(t))
let to=GM_getValue("top1");
let lef=GM_getValue("left1");
if(!to){GM_setValue("top1",50);to=50}if(!lef){GM_setValue("left1",10);lef=10}
t.style.top=to+"px";t.style.left=lef+"px";
$("div1").mousemove(function(e){
$("div1").unbind("mousedown");$("div1").css("cursor","default");var left=$("div1").offset().left;var top=$("div1").offset().top;
if(e.pageX-left&&e.pageY-top){
$("div1").css("cursor","move");
$("div1").mousedown(function(e){
var ismove=true;
var x= e.pageX-$("div1").offset().left;
var y = e.pageY-$("div1").offset().top;
$(document).mousemove(function(e) {
if(ismove) {
$("div1").css({"left":e.pageX-x,"top":e.pageY-y-document.documentElement.scrollTop});
GM_setValue("top1",e.pageY-y-document.documentElement.scrollTop);GM_setValue("left1",e.pageX-x)
}
}).mouseup(function() {
ismove = false;
});
});
}
});
console.log("ok")
console.log(`
账号:${numb}
密码:${mima}
`)
}
if(last_page=='https://jwxt.cumtb.edu.cn/student/home'){GM_deleteValue("上次打开")}
else if(last_page){window.location.href=last_page;GM_deleteValue("上次打开")}
}
function 本周课表(){
console.log("课表")
let a = setInterval(()=>{
if(document.querySelector('div.card-content > p')){
document.querySelector('.currWeek').click();clearInterval(a)
}
},50)
}
function 评教() {
console.log("评教页面")
let table=null
table = document.createElement('div');
table.style.cssText="width:200px;padding:20px;border:1px solid #ccc;border-radius:10px;z-index:1001;position:fixed;top:43px;right:50px;background:#fff;display:block;justify-content:center;flex-direction:column";
let body = document.querySelector('body');
body.appendChild(table);
let btn1 = document.createElement('button');
let btn2 = document.createElement('button');
btn1.innerHTML="好评"
btn2.innerHTML="差评"
btn1.style.cssText="height:30px;border-color:#ccc;border-radius:5px;position:inline;margin:10px;cursor:pointer;background:lightgreen;";
btn2.style.cssText="height:30px;border-color:#ccc;border-radius:5px;position:inline;margin:10px;cursor:pointer;background:lightpink;";
table.appendChild(btn1);
table.appendChild(btn2);
btn1.addEventListener('click',评教_1(1))
btn2.addEventListener('click',评教_1(2))
}
function 成绩单(){
let 本学期 = document.querySelector("body > div.container > div.table-wrapper > div:nth-child(1) > div > h3").innerText;
let 各课程 = document.querySelector("body > div.container > div.table-wrapper > div:nth-child(1) > table")
let 课程数 = $('body > div.container > div.table-wrapper > div:nth-child(1) > table > tbody > tr').length;
let 及格数 = 0;
console.log("学期:"+本学期)
if ($('div').length){
$('div.table-wrapper').each(function (index, element) {
for(let i=1;i<=课程数;i++){
let 成绩格 = "body > div.container > div.table-wrapper > div:nth-child(1) > table > tbody > tr:nth-child("+i+") > td:nth-child(4)"
let 成绩 = document.querySelector(成绩格).innerText;
console.log(成绩);
if(成绩=="良好"||成绩=="合格"||成绩=="优秀"||成绩>=60)及格数++;
}
});
console.log("课程数:"+课程数)
console.log("及格数:"+及格数)
console.log("不及格数:"+(课程数-及格数))
};
if(上次不及格==null){GM_setValue("上次不及格",(课程数-及格数))}
if(上次课程数==null){GM_setValue("上次课程数",课程数)}
else if(上次课程数==课程数){}
else if((课程数-上次课程数)!=0){
let t=null,p=null,q='新出了'+(课程数-上次课程数)+'门课的成绩';
if((课程数-及格数)>上次不及格){GM_setValue("上次不及格",(课程数-及格数));t ="Bad News";p = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAzCAMAAAANf8AYAAAAqFBMVEUAAAD/YGD3VVH5VFD4VFD4U0/5VFH4VFD4VVD3VE/5VlD4U1D3VE/4VE/7VlL3U1D3VFH4VFD/gID/VVX3U1D3VFD3VFD4VFD3VFD3U0/////+7Oz4a2f3Z2P4eHX3WVX94+L3YV76mZf++vr+7e34cW74dnP3V1P8zcv93d36oqD939/+/f3+9/f4bGj7sK78xML6npz8vr37rKn3VFD6paP3ZmP3WFRHwQxvAAAAGXRSTlMACEJ/8/hVs2noU9qnzjvpYfkEHubGg/zFlZIbtgAAAYJJREFUeF6d1teSgzAMBVCbTmhLSZFTey/b9///bDMZYmIbJcT3/YyGkbBE1FDDDKPC6lpFFJoGJU9DHdeG+9iu85hlng9qfC/DSSuA+gQtRORtwNPO60icwKMksUreUnic9E0mHXiejlQFmkSoFKeNTBpXJE+gWZKcmzY0TY+3EpqnbG4WvGCC7Go8eCXedZJ9EQxX6zswHY1F49OLcUTyc2CTASezOVssReRcjCtWOTDG+jf0wS7ZiMYlhNqCWTF2RRVhW9HYlBggZD0pESdsB2IMYoKYQb9EN/L5LRmThICgL4RASCJAEEYgIgUgCCNQEAsQhBGwSBdqUn7L8QQ16Sp1eF94n9Q6BUJwVJAII0cMRSREyOepj6BQmYPZrS+8ub+SMeV5m85LUvXpXTKGPNcjTjjay3Mt/z/jRUkqdBaNq/6ny812V3V/+L4//6n/KfXhlfhU493Red803lGN91pnL2jsH409p7FPNfa2/n3Q/A7p5Rr3jvZdpX+/6dyJ/y1EyzXVRf1XAAAAAElFTkSuQmCC'}
else {t = "Good News!";p = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAzCAMAAAANf8AYAAAAtFBMVEUAAABA30A+wzQ+wzQ+wjQ/wzU/wjQ/wjU/wzU/wjQ/wzVA/0A/wjVExDw/wzVBwjg+wzVCxTY/wjU/wzZBxTQ/wjU+wzU/wjU+wjU+wjT///9Awjb+/v696rm86bhWyU5by1Ps+evo9+eL2oV51HKC13x61XPX8tWb35aq5KVpz2FFxDus5Ki66bdTyEri9eDC67/d9Nva89hYyVD3/Pb4/PeO24hu0Wb5/fmu5apu0WdMxkIehkT0AAAAGXRSTlMACH/55qf4zrPz6ATaHmE76UJpVVPGg/zFwrG5tQAAAWBJREFUeNqd1ueSgkAQRtEeMggryfCNqJtzzuH932tdi1pHYQbs8//WlFXS3dQkMsv1nXASOr5rZYI6iSLwoPKCwpwN8ghNUT4grTJGu7jUFMkIeqOEWgxTmKRDajiwYWYf0I4xuo13XkEfWy8NbfRhK78pSdFPmvw3I/Q1pVqJ/sr6DxOjv3iwbnLsI6cVEWEfkSCiAh1OL6+hKIgogNHsTsrqDBsBkfDMyUKuPGPDE5T1SOQFFBlZxmS+TqpzKCxyu1+pTqByyYfi5uppcd+RwCcHilsp5fHSnMChEIoHuYlm8/YEIU2geJR1ZEgw2X5neVRHhgQhOVAd1tGLPoFDPtqiV30Cn1y0RYYELlloROYEFmVoRsYEGQmvGb39Je9o54nW7+fjU1Zf0Ag03+ns+wc6BWceMOYOZ74x5ihjXnP2AmP/MPYcZ5/y9zb/Pui+Q6YJ495h31X8+41zJ/4Cq+rI0+SEAkcAAAAASUVORK5CYII='}
GM_notification({
title:q,
text:t,
image:p,
timeout:10000,
onclick:()=>{window.focus()},
})
GM_setValue("上次课程数",课程数)
}
let t = document.createElement('div1');
t.style.cssText="width:251px;padding:20px;border:1px solid #ccc;border-radius:10px;z-index:1001;position:fixed;background:lightblue;display:block;";
let cssText="height:30px;border-color:#f2d6a5;border-radius:5px;margin:2.5px;cursor:pointer;background:#282828;color:#f2d6a5"
$("body").append(t)
let btns= ['设置刷新','显示间隔','停止刷新'];
let amount = btns.length;
for(let i=1;i<=amount;i++){
let tnnd = ['button#'+btns[i-1]]
$(`<button id = ${btns[i-1]} style=${cssText}>${btns[i-1]}</button>`).appendTo($(t)).on('click',eval(btns[i-1]))
document.querySelector(tnnd).onmouseover=function(){this.style.background='#f2d6a5';this.style.color='#282828';this.style.borderColor='#282828'}
document.querySelector(tnnd).onmouseout =function(){this.style.background='#282828';this.style.color='#f2d6a5';this.style.borderColor='#f2d6a5'}
}
$(`<hr><p><h3><em><strong>统计:${本学期}</strong></em></h3><dd><h4>  课程数: ${课程数}门<dd>    及格: ${及格数}门<dd>    没过: ${课程数-及格数}门</dd></p>`).appendTo($(t))
if(setTime!=null&&setTime!=0){执行刷新(console.log(setTime+"分钟后刷新"))}
let to=GM_getValue("top2");
let lef=GM_getValue("left2");
if(!to){GM_setValue("top2",43);to=43}
if(!lef){GM_setValue("left2",14);lef=14}
t.style.top=to+"px";t.style.left=lef+"px";
$("div1").mousemove(function(e){
$("div1").unbind("mousedown");$("div1").css("cursor","default");var left=$("div1").offset().left;var top=$("div1").offset().top;
if(e.pageX-left&&e.pageY-top){
$("div1").css("cursor","move");
$("div1").mousedown(function(e){
var ismove=true;
var x = e.pageX - $("div1").offset().left;
var y = e.pageY - $("div1").offset().top;
$(document).mousemove(function(e) {
if(ismove){
$("div1").css({"left":e.pageX-x,"top":e.pageY-y-document.documentElement.scrollTop});
GM_setValue("top2",e.pageY-y-document.documentElement.scrollTop);GM_setValue("left2",e.pageX-x)
}
}).mouseup(function(){
ismove = false;
});
});
}
});
}
function 选课(){
setTimeout(()=>{
if(document.querySelector("body > div > div > div > span").innerText.indexOf("~ 当前还未开放选课 ~")!=-1){
location.reload()
}
},2000)
}
function choose(){
if(location.href == 'https://jwxt.cumtb.edu.cn/student/home')教务系统主页()
if(location.href == 'https://jwxt.cumtb.edu.cn/'&&identify!="")教务系统入口()
if(location.href == 'https://jwxt.cumtb.edu.cn/student/for-std/course-table')本周课表()
if(location.href.indexOf('/evaluation-student-frontend/')!==-1)评教()
if(location.href.indexOf('login?refer')!==-1&&numb!=""&&mima!="")登录()
if(location.href.indexOf('login?service')!==-1)登录()
if(location.href.indexOf('student/for-std/grade/sheet')!==-1){if($('div').length){let a = setInterval(()=>{成绩单();setTimeout(()=>{clearInterval(a)},10)},800)}}
if(location.href.indexOf("student/for-std/course-select")){选课()}
}choose()
//主页
function 跳转(x){return()=>{执行(x)}}
function 执行(i){window.open(URLs[i])}
//入口、主页
function 更改身份(){
identify=prompt("输入新身份,学生? 教师? 管理? 外聘? 家长?\n将决定之后登录自动点击的入口")
if(identify!=null && identify!=""){GM_setValue("身份",identify)}
}
//登录、主页
function 更改账号(){
numb=prompt("输入新账号\n将决定之后登录自动填写的账号")
if(numb!=null && numb!=""){GM_setValue("账号",numb)}
}
function 查看密码(){
alert("当前密码为:"+mima)
}
function 更改密码(){
mima=prompt("输入新密码\n将决定之后登录自动填写的密码,不代表修改教务系统登陆密码")
if(mima!=null && mima!=""){GM_setValue("密码",mima)}
}
//评教
function 评教_1(x){
return ()=>{
if(x==1){console.log("即将进行好评");评教_2(x)}
else {console.log("即将进行差评");评教_2(x)}
};
}
function 评教_2(x){
setTimeout(()=>{
$('tr.el-table__row').each(function (index, element) {
const st1="不在开放时间"
let a=('el-tag el-tag--info el-tag--small el-tag--light').ltrim
if(a != st1){var b=document.querySelector('.el-tooltip.el-link.el-link--primary.is-underline').click()}
else console.log("不对应")
})
},2000)//两秒后点击进入评教页面
setTimeout(()=>{
if ($('.item').length) {
$('div.item').each(function (index, element) {
let xuanxiang=$(element).find('.el-radio-group .el-radio__input .el-radio__original');
var str,str1,t;
if (x==1){str = "A"; str1 = "是"; t="无" }
else {str = "D"; str1 = "否"; t="讲得太晦涩听不懂!!!"}
xuanxiang.each(function (ind, ele) {
let da = $(ele).attr('value');
if(da == str||da==str1){
$(ele).click();
return false;
}
});
var d=document.querySelector('textarea');d.focus();d.value=t;
var ev1 = new Event('change');var ev2 = new Event('input');d.dispatchEvent(ev1);d.dispatchEvent(ev2);
});
};
}, 4000);
setTimeout(() => {
var b=document.querySelector('button.el-button.el-button--primary.el-button--small');
if($(b).length){b.click();console.log("本课评教已完成")};
}, 6000);
}
//成绩单
function 设置刷新(){
setTime = prompt("输入刷新间隔: X(单位分钟,0为不刷新)\n如果刷新后有新成绩将会进行通知(需要在系统设置里允许浏览器通知)\n不要关闭页面! 关闭后无法刷新")
if(setTime!=null && setTime!=""){GM_setValue("刷新时间",setTime);location.reload();}
if(setTime==0){clearTimeout(刷新);console.log('over');}
}
function 执行刷新(){
刷新 = setTimeout(()=>{
location.reload();
},setTime*60*1000);
}
function 显示间隔(){
if(setTime==0){alert('不会进行刷新')}
if(0 < setTime && setTime < 1){alert('刷新间隔为'+(setTime*60).toFixed()+'秒')}
if(1 <=setTime && setTime < 60){alert('刷新间隔为'+(parseInt(setTime))+'分'+((setTime-parseInt(setTime))*60).toFixed()+'秒')}
if(60<=setTime){alert('刷新间隔为'+Math.floor(setTime/60)+'小时'+ (Math.floor(setTime)-Math.floor(setTime/60)*60)+'分'+((setTime-Math.floor(setTime))*60).toFixed()+'秒')}
}
function 停止刷新(){clearTimeout(刷新);GM_setValue("刷新时间",0);console.log('over')}