那不抄疯了
4 Likes
总比让你花一个美好的假期夜晚做题好
3 Likes
油猴新建脚本,把这坨贴进去(校板有Edge的也可以装油猴插件)
只支持桌面端,因为移动端长得完全不一样所以就没适配,可以访问桌面版
// ==UserScript==
// @name PingJiaoFucker
// @match https://chalk-c3.seiue.com/*
// @run-at document-start
// @grant none
// @version 1.1.0
// @author Niarb
// @description Auto choose 5'
// ==/UserScript==
"use strict";
let added = false;
const check = () => {
if (added) return;
document.querySelectorAll('button[type="button"] span')?.forEach((span) => {
if (span.textContent.trim() !== "开始填写") return;
const btn = span.closest("button");
if (btn.dataset.listener) return;
btn.dataset.listener = true;
btn.addEventListener("click", () => setTimeout(addBtn, 500));
});
};
const addBtn = () => {
if (document.getElementById("auto-fill")) return;
added = true;
const h1 = [...document.querySelectorAll("h1")].find((h) => h.textContent.includes("填写评教"));
const div = Object.assign(document.createElement("div"), {
id: "auto-fill",
style: "margin:20px 0;text-align:center",
});
const btn = Object.assign(document.createElement("button"), {
textContent: "当前页自动勾选",
style: "padding:9px 18px;background:#f92672;color:white;border:none;cursor:pointer;font-size:14px;font-weight:bold",
onclick: autoFill,
});
div.appendChild(btn);
h1?.parentNode?.insertBefore(div, h1.nextSibling);
document.addEventListener("keydown", (e) => e.altKey && e.key === "a" && autoFill());
};
const autoFill = () => {
// 单选
document.querySelectorAll('input[type="radio"][value="option1"]').forEach((r) => !r.checked && r.click());
// 建议
setTimeout(() => {
const textarea = [...document.querySelectorAll(".ant-row.ant-form-item-row")]
.find((div) => div.textContent?.includes("对该课程的建议是"))
?.querySelector("textarea");
if (textarea) {
textarea.value = "无";
["input", "change"].forEach((e) => textarea.dispatchEvent(new Event(e, { bubbles: true })));
}
}, 100); // 不等会输入异常,不知道为啥
};
new MutationObserver(check).observe(document.body, { childList: true, subtree: true });
check();
应该没啥问题但使用后果自负 ![]()
大概是这个位置会多个按钮
6 Likes
好活儿,已收藏,虽然我用不上(doge)
1 Like
