// ==UserScript== // @name sztu自动评教 // @namespace http://tampermonkey.net/ // @version 0.1.1 // @description 深圳技术大学自动评教--2024-2025-一 // @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== // alert('hello world'); const url = location.pathname, mainPage = 'https://jwxt.sztu.edu.cn/jsxsd/framework/xsMain.htmlx#', findPage = 'https://jwxt.sztu.edu.cn/jsxsd/xspj/xspj_find.do', listPage = 'https://jwxt.sztu.edu.cn/jsxsd/xspj/xspj_list.do', editPage = 'http://jwglxt.qau.edu.cn/jsxsd/xspj/xspj_edit.do'; // console.info(url) function sleep(time) { return new Promise(resolve => setTimeout(resolve, time)); } // function refresh() { // window.location.reload(); // } if (findPage.indexOf(url) != -1) { //---学生评价页面 const evaluate = document.querySelector('a'); //---评教 window.open(evaluate.getAttribute('href')); } sleep(500).then(() => { //---教师列表页面 if (listPage.indexOf(url) != -1) { const urlList = []; const trList = document.querySelectorAll('tr'); console.info(trList); for (let i = 1; i < trList.length; i++) { const isDone = trList[i].childNodes[11].innerText; //---是否评教 if (isDone === '否') urlList.push(trList[i].childNodes[15].childNodes[1].getAttribute('href')); } console.info(urlList); if (urlList.length !== 0) urlList.forEach(url => window.open(url)); else alert("已完成所有评教,请注意提交") } }); sleep(500).then(() => { //----评教页面 if (editPage.indexOf(url) != -1) { const tdList = document.getElementsByName('zbtd'); console.info(tdList); for (td of tdList) { td.childNodes[1].childNodes[1].click(); } // console.info(tdList[tdList.length - 2].childNodes[5].childNodes[1]); tdList[tdList.length - 2].childNodes[5].childNodes[1].click(); const submit = document.getElementById('bc'); submit.click(); setTimeout(function () { window.close(); }, 1000); } });