Greasy Fork

Greasy Fork is available in English.

方正教务系统自动评教脚本

方正教务系统自动评教脚本,随机选择一个赞同,其余选择完全赞同,并添加评语(目前只测试过南工大、杭师大)

当前为 2021-12-04 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        方正教务系统自动评教脚本
// @namespace   Violentmonkey Scripts
// @match       http*://*.edu.cn/*xspjgl/xspj_cxXspjIndex.html*
// @match       http://jwxt.hznu.edu.cn/jwglxt/xspjgl/xspj_cxXspjIndex.html*
// @match       https://jwgl.njtech.edu.cn/xspjgl/xspj_cxXspjIndex.html*
// @grant       none
// @version     2.01
// @author      PairZhu
// @description 方正教务系统自动评教脚本,随机选择一个赞同,其余选择完全赞同,并添加评语(目前只测试过南工大、杭师大)
// @license     GPL
// ==/UserScript==
/* jshint esversion: 8 */
const wait = ms => {
  return new Promise(resolve => {
    const rt = () => resolve()
    setTimeout(rt, ms)
  })
}
const alldo = async () => {
  let k = 0;
  for (let j of document.querySelector("#tempGrid > tbody").children) {
    if (j.querySelector("td:nth-child(8)").innerText == "未评") {
      j.click();
      await wait(1000);
      evaluation();
      await wait(500);
    }
  }
  alert("完成");
}
const evaluation = () => {
  let arr = document.querySelectorAll(".radio-pjf");
  for (let i = 0; i < arr.length; i += 5) {
    arr[i].click();
  }
  let num = Math.floor(Math.random() * arr.length / 5);
  arr[5 * num + 1].click();
  document.querySelector(".form-control").value = document.querySelector("#auto-evalution").value;
  document.querySelector("#btn_xspj_tj").click();
  document.querySelector("#btn_ok").click();
}
const init = async () => {
  console.log('begin');
  while (!document.querySelector("#kc-head")) {
    await wait(1000);
  }
  console.log('finish');
  let tempe = document.createElement('button');
  tempe.innerText = '全部评价';
  tempe.type = 'button';
  tempe.onclick = alldo;
  document.querySelector("#kc-head").appendChild(tempe);
  tempe = document.createElement('button');
  tempe.innerText = '评价当前页';
  tempe.type = 'button';
  tempe.onclick = evaluation;
  document.querySelector("#kc-head").appendChild(tempe);
  tempe = document.createElement('br');
  document.querySelector("#kc-head").appendChild(tempe);
  tempe = document.createElement('span');
  tempe.innerText = '评语:';
  document.querySelector("#kc-head").appendChild(tempe);
  tempe = document.createElement('input');
  tempe.id = 'auto-evalution';
  tempe.value = '很好';
  document.querySelector("#kc-head").appendChild(tempe);
}
setTimeout(init, 100);