// ==UserScript==
// @name 河工程教学评估
// @namespace https://github.com/slightin
// @description 自动教学评估,自动评分和主观评价,适用于河北工程大学URP教务系统
// @author 万事可乐
// @version 2.2.2
// @match http://27.188.65.169:911*/
// @match http://27.188.65.169:911*/index.jsp
// @match http://202.206.161.181:46110/
// @match http://202.206.161.203:46110/
// @match http://202.206.161.206:46110/
// @match http://202.206.161.181:46110/index.jsp
// @match http://202.206.161.203:46110/index.jsp
// @match http://202.206.161.206:46110/index.jsp
// @match */student/teachingEvaluation/*
// @icon https://cdn.jellow.site/Fgwb1WzJddpQanzWwg9bVURFF37Vv2.png
// @grant none
// ==/UserScript==
(function() {
'use strict';
//主观评价
var eva="老师重视教学,严慈相济,关爱学生,讲授详略得当,重点突出,难点讲透"
// code here...
var tpath = "#page-content-template > div > div > div.widget-content > form > div > table > tbody > ";//记录多次用到的js路径前缀
var flag = true;
//评估主页模块
function index(){
var times = document.querySelector("#jxpgtbody").getElementsByTagName("tr").length;
for(var i=1;i<=times;i++)
{
if(/评估/.test(document.querySelector("#jxpgtbody > tr:nth-child("+i+") > td:nth-child(1) > button").innerText))
{
flag=false
document.querySelector("#jxpgtbody > tr:nth-child("+i+") > td:nth-child(1) > button").click();
break;
}
}
if(flag)
{
var div = document.createElement('div')
var ins = document.querySelector("#page-content-template").firstElementChild
document.querySelector("#page-content-template").insertBefore(div,ins)
div.innerText="评估未开始或已完成"
div.style="color: #128520;font-size: x-large;"
}
}
//评估主页面执行
if(/evaluation\/index/.test(window.location.href))
{
setTimeout(index,700);//延迟执行,防止网速问题导致页面加载未完全找不到DOM,不建议太小
}
//评估详情页执行
if(/evaluationPage/.test(window.location.href))
{
$("textarea").each(function(i){
if(i<10){
$(this).text(9+Math.floor(Math.random()*10)/10)
}
else{
$(this).text(eva)
}
})
//用户提示模块
var tip = document.createElement("h4")
var ins = document.getElementById("buttonSubmit")
var div = document.querySelector("#page-content-template > div > div > div:nth-child(3)")
div.insertBefore(tip,ins)
tip.innerHTML='时间结束会自动提交并进入下一评估中哦U•ェ•*U
为保证脚本的正常运行,请保持浏览器处于此窗口
计时检测在服务器端,暂无法跳过。开发不易,觉得好用还请给个好评'
window.scrollTo(0,document.body.clientHeight)//保证滚动到页面底端
//提交模块
setInterval(function(){
if(document.querySelector("#RemainM").innerText=='0' && document.querySelector("#RemainS").innerText=='0'){//时间结束时点击提交
document.querySelector("#buttonSubmit").click();
$('a.layui-layer-btn0').click()
}
},1000);//检测间隔
}
if(location.pathname=="/" || location.pathname=="/index.jsp") {//主页快捷面板
var shortcut=document.createElement("div")
document.querySelector("#page-content-template > div.row").appendChild(shortcut)
shortcut.className="col-sm-6 widget-container-col"
shortcut.innerHTML=`