您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
自动完成校园智慧英语网页版的默写作业
当前为
// ==UserScript== // @name 校园智慧英语自动默写 // @namespace https://github.com/andywang425 // @version 0.1 // @author andywang425 // @description 自动完成校园智慧英语网页版的默写作业 // @include /https?:\/\/129.211.74.198\/.*/ // @require https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js // @require https://cdn.jsdelivr.net/gh/lzghzr/TampermonkeyJS@ba7671a0d7d7d13253c293724cfea78a8dc1665c/Ajax-hook/Ajax-hook.js // @require https://cdn.jsdelivr.net/gh/sentsin/layer@0018e1a54fbfb455d7b30d5a2901294dd0ab52c5/dist/layer.js // @license MIT // @run-at document-start // ==/UserScript== function sleep(millisecond) { return new Promise(resolve => { setTimeout(() => { resolve() }, millisecond) }) }; function getClass (className) { var res = document.getElementsByClassName(className); if (res === undefined) return getClass(); else return res; }; const main = () => { $('head').append('<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/sentsin/[email protected]/dist/theme/default/layer.css">');//加载样式 var AnsLsit = []; const submitTime = 60;//提交前等待时间 ah.proxy({ onRequest: (config, handler) => { handler.next(config); }, onResponse: async (response, handler) => { if (response.config.url.indexOf("/exam/all.asp") > -1) { var jsonRes = JSON.parse(response.response); console.log("/exam/all.asp", jsonRes); if (jsonRes.aProcess != undefined) { layer.msg('开始自动答题'); for (const Ans of jsonRes.aProcess) { console.log("aProcess Ans", Ans.sAnswer); AnsLsit.push(Ans.sAnswer); } var classes = await getClass("pjAnswer"); var count = 0; for (const c of classes) { console.log('class', c); c.focus(); var finalAns = AnsLsit[count].split("/")[0] c.value = finalAns; ++count; await sleep(300) }; layer.msg('答题完成,默认60秒后自动提交'); console.log("答题完成,等待中", submitTime + '秒'); setTimeout(() => { console.log("点击提交按钮"); if ($("#BtnSubmit").length > 0) $("#BtnSubmit").click(); }, submitTime * 1000) } } handler.next(response); } }); } main();