贵师大正方教务教学评价勾选
// ==UserScript==
// @name 贵师大正方教务教学评价勾选
// @namespace https://bbs.tampermonkey.net.cn/
// @version 1.1.0
// @description 贵州师范大学评教勾选
// @author LongAnKang
// @match https://jwgl.gznu.edu.cn/jwglxt/xspjgl/xspj_cxXspjIndex.html*
// ==/UserScript==
(function () {
const sleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay));
const createButton = (id, text) => {
const button = document.createElement('button');
button.id = id;
button.style.width = '80px';
button.style.height = '40px';
button.innerText = text;
return button;
};
const addButton = (parent, button) => {
parent.appendChild(button);
};
const selectItems = (doc, start, end, step) => {
for (let i = start; i <= end; i += step) {
doc[i].checked = true;
}
};
const btnContainer = document.createElement('div');
btnContainer.style.position = 'fixed';
btnContainer.style.marginLeft = '40%';
btnContainer.style.zIndex = '999';
btnContainer.style.top = '0';
btnContainer.style.width = '1900px';
const btna = createButton('btna', '从未出现(优秀)');
const btnb = createButton('btnb', '无法判断(良好)');
const btnc = createButton('btnc', '极少出现(中等)');
const btnd = createButton('btnd', '有时出现(及格)');
const btne = createButton('btne', '经常出现(不及格)');
addButton(btnContainer, btna);
addButton(btnContainer, btnb);
addButton(btnContainer, btnc);
addButton(btnContainer, btnd);
addButton(btnContainer, btne);
document.body.appendChild(btnContainer);
btna.addEventListener('click', async function () {
const doc = document.getElementsByClassName("radio-pjf");
const docLength = doc.length;
const act = docLength - 30;
selectItems(doc, 0, 25, 5);
doc[26].checked = true;
selectItems(doc, 31, 74, 5);
selectItems(doc, 67, 97, 5);
await sleep(4000);
});
btnb.addEventListener('click', async function () {
const doc = document.getElementsByClassName("radio-pjf");
const docLength = doc.length;
const act = docLength - 30;
selectItems(doc, 1, 25, 5);
doc[26].checked = true;
selectItems(doc, 30, 74, 5);
selectItems(doc, 68, 97, 5);
await sleep(4000);
});
btnc.addEventListener('click', async function () {
const doc = document.getElementsByClassName("radio-pjf");
const docLength = doc.length;
const act = docLength - 30;
selectItems(doc, 2, 25, 5);
doc[26].checked = true;
selectItems(doc, 29, 74, 5);
selectItems(doc, 69, 97, 5);
await sleep(4000);
});
btnd.addEventListener('click', async function () {
const doc = document.getElementsByClassName("radio-pjf");
const docLength = doc.length;
const act = docLength - 30;
selectItems(doc, 3, 25, 5);
doc[26].checked = true;
selectItems(doc, 28, 74, 5);
selectItems(doc, 70, 97, 5);
await sleep(4000);
});
btne.addEventListener('click', async function () {
const doc = document.getElementsByClassName("radio-pjf");
const docLength = doc.length;
const act = docLength - 30;
selectItems(doc, 4, 24, 5);
doc[26].checked = true;
selectItems(doc, 27, 74, 5);
selectItems(doc, 71, 97, 5);
await sleep(4000);
});
})();