高校实训平台直播课堂自动签到
// ==UserScript==
// @name 千峰直播课堂自动签到
// @version 1.2
// @description 高校实训平台直播课堂自动签到
// @author jxxxxx
// @match https://live.polyv.cn/watch/*
// @namespace https://greasyfork.org/users/755789
// ==/UserScript==
(() => {
var timer;
function autoSignIn() {
console.log("等待签到中...")
document.querySelectorAll(".c-modal.g-mask").forEach((e) => {
if (e.style.display === "none") {
return;
}
// 有模态框显示,点击签到按钮
e.querySelector(".plv-iar-btn-default.pws-btn-bg-color.pws-vclass-btn--primary").click();
console.log("签到成功!");
})
}
function autoOn() {
timer = setInterval(autoSignIn, 2000);
}
function autoOff() {
clearInterval(timer);
}
function handleChange() {
const e = document.querySelector("#autoSignIn");
if (e.checked) {
autoOn();
} else {
autoOff();
}
}
autoOn();
setTimeout(() => {
document.querySelector(".c-input-controller__tools").innerHTML += `
<label style="color:black;" id="auto">
<input id="autoSignIn" type="checkbox" style="margin-right:3px;" checked></input>自动签到
</label>
`;
document.querySelector("#autoSignIn").addEventListener('change', handleChange);
}, 5000)
})()