// ==UserScript== // @name MOOC互评全自动化脚本 // @description 自动填充互评页面的选择题和文本框,并提交表单 // @version 1.0 // @author 无知呦 // @match https://www.icourse163.org//* // 替换为实际的匹配URL // @grant none // @license MIT // @namespace https://greasyfork.org/users/1195678 // @downloadURL none // ==/UserScript== //2023年10月14日15:17:22 mooc互评全自动化脚本 无知呦 function fillRadios() { var radios = document.getElementsByTagName('input'); for (var i = 0; i < radios.length; i++) { if (radios[i].type === 'radio') { radios[i].checked = true; } } } function fillTextareas() { var textareas = document.getElementsByTagName('textarea'); for (var i = 0; i < textareas.length; i++) { textareas[i].value = '100'; } } function clickLinkByTextContent(textContent) { var links = document.querySelectorAll('a'); for (var i = 0; i < links.length; i++) { if (links[i].textContent === textContent) { links[i].click(); break; } } } function clickNextLinks() { var nextLinks = document.querySelectorAll('a.j-gotonext'); for (var j = 0; j < nextLinks.length; j++) { nextLinks[j].click(); } } function doTask() { fillRadios(); fillTextareas(); clickLinkByTextContent('提交'); setTimeout(function() { clickNextLinks(); setTimeout(doTask, 3000); }, 2000); } for (var j = 0; j < 5; j++) { setTimeout(doTask, j * 10000); //如提示并发限制,可将间隔时间设置为更大(单位为毫秒) }