网上学院函数库:自动报名
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/396002/769720/wsxy_autoSignup.js
// ==UserScript==
// @name wsxy_autoSignup
// @namespace Vionlentmonkey
// @version 0.1.1
// @description 网上学院函数库:自动报名
// @require https://greasyfork.org/scripts/395748-wsxy-getdata/code/wsxy_getData.js
// @grant none
// ==/UserScript==
// 自动报名高学分课程。2020年初,高于1学分的有且仅有20门3学分课程。
const autoSign3Credit = async () => {
// 彩蛋:需要 iframe 提升才会执行
if (window.top === window.self) {
let courses = document.querySelectorAll('#requiredCourseTable .course');
for await (let c of courses) {
let coursePk = c.getElementsByClassName('coursePk')[0].textContent;
let title = c.getElementsByClassName('title')[0].getAttribute('title');
let jdjs = c.getElementsByClassName('jdjs')[0].textContent; // 进度
let csInfo = await getCourseInfo(coursePk);
let csCredit = csInfo.courseCredit;
if (jdjs === '未报名') {
// 自动报名高学分课程
if (csCredit > 1) {
console.log(`${csCredit}学分:${title}`);
c.click();
console.log('Click:' + title);
const info = document.getElementsByClassName('layui-layer-btn0');
if (info.length === 1) {
document.getElementsByClassName('layui-layer-btn0')[0].click();
console.log('报名:' + title);
}
}
}
}
}
};