// ==UserScript==
// @name 安全教育平台自动答题
// @description 支持安全课程、专题活动
// @namespace https://greasyfork.org/users/197529
// @version 0.8.1
// @author kkocdko
// @license Unlicense
// @match *://*.xueanquan.com/*
// @downloadURL none
// ==/UserScript==
"use strict";
const { addFloatButton } = {
addFloatButton(text, onClick) /* 20200707-123713 */ {
if (!document.addFloatButton) {
const container = document.body
.appendChild(document.createElement("div"))
.attachShadow({ mode: "open" });
container.innerHTML =
"";
document.addFloatButton = (text, onClick) => {
const button = document.createElement("button");
button.textContent = text;
button.addEventListener("click", onClick);
return container.appendChild(button);
};
}
return document.addFloatButton(text, onClick);
},
};
addFloatButton("自动答题", () => {
document.querySelectorAll(":enabled:not(:checked)").forEach((el) => {
el.value = 1;
el.click();
});
});