Warning: fopen(/www/sites/update.greasyfork.icu/index/store/forever/060b5882d916a8d5b7b87531e113064c.js): failed to open stream: No space left on device in /www/sites/update.greasyfork.icu/index/scriptControl.php on line 65
// ==UserScript==
// @name sztu自动评教
// @namespace http://tampermonkey.net/
// @version 0.1.2
// @description 深圳技术大学自动评教——2024-2025-1
// @author xiaowhang
// @match https://jwxt.sztu.edu.cn/jsxsd/framework/xsMain.htmlx#*
// @match https://jwxt.sztu.edu.cn/jsxsd/xspj/xspj_list.do*
// @match https://jwxt.sztu.edu.cn/jsxsd/xspj/xspj_edit.do*
// @match https://jwxt.sztu.edu.cn/jsxsd/xspj/xspj_find.do
// @grant none
// @license MIT
// @downloadURL none
// ==/UserScript==
const URLS = {
MAIN: 'https://jwxt.sztu.edu.cn/jsxsd/framework/xsMain.htmlx#',
FIND: 'https://jwxt.sztu.edu.cn/jsxsd/xspj/xspj_find.do',
LIST: 'https://jwxt.sztu.edu.cn/jsxsd/xspj/xspj_list.do',
EDIT: 'https://jwxt.sztu.edu.cn/jsxsd/xspj/xspj_edit.do',
};
const sleep = time => new Promise(resolve => setTimeout(resolve, time));
async function handleFindPage() {
const evaluate = document.querySelector('a');
if (evaluate) {
window.open(evaluate.getAttribute('href'));
}
}
async function handleListPage() {
const urlList = [];
const trList = document.querySelectorAll('tr');
for (let i = 1; i < trList.length; i++) {
const isDone = trList[i].children[5].children[0].value;
if (isDone === '否') urlList.push(trList[i].children[7].children[0].getAttribute('href'));
console.log(trList[i].children[2].textContent, trList[i].children[3].textContent);
}
if (urlList.length !== 0) {
urlList.forEach(url => window.open(url));
} else {
alert('已完成所有评教,请点赞老师后及时提交!!!');
}
}
async function handleEditPage() {
const tdList = document.querySelectorAll('[name="zbtd"]');
console.info(tdList);
for (const td of tdList) {
td.children[0].click();
}
tdList[tdList.length - 2].children[2].click();
const submit = document.getElementById('bc');
submit.click();
window.close();
}
async function main() {
await sleep(500);
const currentUrl = location.pathname;
if (URLS.FIND.includes(currentUrl)) {
await handleFindPage();
} else if (URLS.LIST.includes(currentUrl)) {
await handleListPage();
} else if (URLS.EDIT.includes(currentUrl)) {
await handleEditPage();
}
}
main().catch(err => console.error('脚本执行出错:', err));