Greasy Fork

Greasy Fork is available in English.

sztu自动评教

深圳技术大学自动评教--2024-2025-一

当前为 2024-12-23 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==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
// ==/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);
  }
});