JavaScript之正方教务系统自动化教评[插件-转载]

时间:2021-11-18 12:23:14

【声明】本插件系学院学长原创,非博主所创,发布此处,仅供学习和效仿。

/**
* @name:正方教务系统自动化教评-插件
*
* @author:chenzhongshu
* @date:2017-07-04
* @notice:原生js;无需依赖项
*
*/
(function() {
var courseCode;
var timer; var autoFill = function() {
var frame = document.getElementById('rightDiv').querySelector('iframe').contentWindow.document;
var divJs = frame.getElementById('divJs');
var items = divJs.querySelectorAll('select'); if (!frame.getElementById('pjkc'))
return false; var newCourseCode = frame.getElementById('pjkc').value;
if (newCourseCode == courseCode) {
clearInterval(timer);
console.log('评价完成');
return true;
}
courseCode = newCourseCode; for (i = 0; i < items.length; i++)
items[i].value = "1(完全同意)"
frame.getElementById('Button1').click();
}
timer = setInterval(autoFill, 1000);
})();