// ==UserScript==
// @name 安徽专业技术人员继续教育-课程助手
// @namespace http://tampermonkey.net/zzzzzzys_安徽专业技术人员继续教育-课程助手
// @version 1.0.4
// @copyright zzzzzzys.All Rights Reserved.
// @description 安徽专业技术人员继续教育-课程助手(https://www.zjzx.ah.cn),脚本功能有限,可自动静音播放视频,防暂停。更全自动方法,请查看文档介绍!客户端课程助手,最高30倍速播放所有课程内容!准确率100%!请按照提示进行!轻松帮助课程视频学习,支持批量账号导入同时学习!
// @author zzzzzzys
// @match https://www.zjzx.ah.cn*
// @require https://fastly.jsdelivr.net/npm/crypto-js@4.2.0/crypto-js.min.js
// @resource https://cdn.staticfile.org/limonte-sweetalert2/11.7.1/sweetalert2.min.css
// @require https://fastly.jsdelivr.net/npm/sweetalert2@11.12.2/dist/sweetalert2.all.min.js
// @require https://scriptcat.org/lib/637/1.4.5/ajaxHooker.js#sha256=EGhGTDeet8zLCPnx8+72H15QYRfpTX4MbhyJ4lJZmyg=
// @connect fc-mp-8ba0e2a3-d9c9-45a0-a902-d3bde09f5afd.next.bspapp.com
// @connect mp-8ba0e2a3-d9c9-45a0-a902-d3bde09f5afd.cdn.bspapp.com
// @grant unsafeWindow
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_deleteValue
// @grant GM_xmlhttpRequest
// @grant GM_info
// @grant GM_addStyle
// @run-at document-start
// @antifeature ads 有弹窗广告,介绍完全自动化软件
// @antifeature payment 脚本基础功能使用免费,但需要使用完全自动化软件时,可能收费
// ==/UserScript==
(function() {
'use strict';
const sleep = ms => new Promise(r => setTimeout(r, ms));
class MainApp {
constructor() {
this.controller = null;
this._hookAjax();
this._checkReady();
}
_hookAjax() {
ajaxHooker.hook(req => {
const uri = req.url;
if (uri.includes('vedioValidQuestions/getQuestions')) {
req.response = res => {
try {
const data = JSON.parse(res.responseText);
unsafeWindow.QuestionInfo = data.data;
console.log("QuestionInfo:", unsafeWindow.QuestionInfo);
} catch(e) {}
};
} else if (uri.indexOf('p/play/config') !== -1) {
req.response = res => {
try {
const cfg = JSON.parse(res.responseText);
console.log("play/config:");
console.log(cfg);
unsafeWindow.playConfig = cfg.data;
} catch(e) {}
};
} else if (uri.indexOf('learning/learnVerify/checkCode') !== -1) {
req.abort = true;
req.response = res => {
res.responseText = '{"code":0,"msg":null,"data":{"data":"请勿频繁请求","status":9999}}';
};
} else if (uri.indexOf('learning/learnVerify') !== -1) {
req.abort = true;
}
});
console.log("hooker:", ajaxHooker);
}
_checkReady() {
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', () => this._start());
} else {
this._start();
}
}
_start() {
this.controller = new LessonController("channel-hunau");
}
}
class LessonController {
constructor(commChannel) {
this.commChannel = commChannel;
this.bc = new BroadcastChannel(commChannel);
this.isPro = false;
this.isActive = false;
this.proUrl = null;
this.pauseGuard = null;
this.ui = new PanelUI({
VIPBtnText: "高级功能-已弃用,请前往软件学习"
});
this._init();
}
_init() {
this.ui.setOnVerifyCallback(async (data) => {
const url = await Helper.validateCode(data);
if (url) {
this.proUrl = url;
this.isPro = true;
this.ui.setTip(Helper.vipText);
return true;
}
return false;
});
this.ui.setOnBegin(() => {
if (this.isActive) return;
this.isActive = true;
console.log("运行时:", this.isPro);
this._execute().then(() => {
this.isActive = false;
});
});
this.ui.setOnVIP(async () => {
if (!this.proUrl) {
await this.ui.handleVerify();
}
await this._runPro();
});
this._loadProStatus();
try {
Swal.fire({
title: "提示",
text: Helper.swFireText,
icon: 'info',
timer: 10000, // 关键修改:从5000改为10000(10秒)
confirmButtonText: '确定',
timerProgressBar: true,
willClose: () => {
this.ui.startAutomation();
}
});
} catch (e) {
console.error(e);
this.ui.startAutomation();
}
}
_loadProStatus() {
if (Helper.loadStatus()) {
this.ui.setTip(Helper.vipText);
this.isPro = true;
} else {
this.ui.setTip(Helper.baseText);
this.isPro = false;
}
console.log("VIP:", this.isPro);
}
async _runPro() {
try {
Helper.showUpgradeAlert();
} catch (error) {
console.error(error);
Swal.fire({
title: "高级功能执行失败!",
text: "若一直失败,请联系进行售后处理!",
icon: 'error',
confirmButtonText: '确定',
allowOutsideClick: false
});
}
}
async _execute() {
try {
await this._autoPlay();
} catch (e) {
console.error(e);
Swal.fire({
title: "失败!",
text: `视频基础播放失败!`,
icon: 'error',
confirmButtonColor: "#FF4DAFFF",
confirmButtonText: "确定",
timer: 5000,
timerProgressBar: true
});
}
}
async _autoPlay() {
const vid = document.querySelector('video');
if (!vid) return;
vid.volume = 0;
vid.muted = true;
if (this.pauseGuard) {
vid.removeEventListener('pause', this.pauseGuard);
}
let timer = null;
this.pauseGuard = async () => {
if (vid.ended) return;
if (timer) clearTimeout(timer);
timer = setTimeout(async () => {
console.log("检测到视频暂停,自动恢复播放...");
vid.volume = 0;
vid.muted = true;
try {
await vid.play();
} catch (e) {
console.error("恢复播放失败:", e);
}
}, 500);
};
vid.addEventListener('pause', this.pauseGuard);
vid.addEventListener('ended', () => {
this._goNext();
}, { once: true });
await vid.play();
}
_goNext() {
const items = Array.from(document.querySelectorAll('ul.lis-content li.lis-inside-content'));
if (!items.length) {
console.log("未找到目录列表");
return;
}
const current = items.findIndex(li => li.querySelector('#top_play'));
console.log("当前目录索引:", current);
const start = current + 1;
for (let i = start; i < items.length; i++) {
const li = items[i];
const btn = li.querySelector('button');
const h2 = li.querySelector('h2');
if (!h2) continue;
const btnText = btn ? btn.textContent.trim() : '';
console.log(`目录[${i}] 状态: ${btnText}`);
const onclick = h2.getAttribute('onclick') || '';
const match = onclick.match(/window\.location\.href='([^']+)'/);
if (match) {
const nextUrl = match[1];
const nextTitle = h2.textContent.trim().replace(/\s+/g, ' ');
console.log("跳转下一节:", nextUrl);
Swal.fire({
title: "视频已播放完毕",
html: `即将跳转到下一节:
${nextTitle}`,
icon: 'success',
timer: 5000,
timerProgressBar: true,
confirmButtonText: '立即跳转',
showCancelButton: true,
cancelButtonText: '取消',
}).then((result) => {
if (result.isConfirmed || result.dismiss === Swal.DismissReason.timer) {
window.location.href = nextUrl;
}
});
return;
}
}
console.log("已是最后一节,无下一个目录");
this._finish();
}
_finish() {
if (!this.isPro) {
Swal.fire({
title: "请升级高级版!",
text: `脚本已停止!基础版只能连播几个视频!`,
icon: 'info',
confirmButtonColor: "#FF4DAFFF",
confirmButtonText: "确定",
timer: 0
});
return;
}
this.bc.postMessage('finish');
Swal.fire({
title: "学习完成!",
text: `学习完成,5s后页面自动关闭!`,
icon: 'success',
confirmButtonColor: "#FF4DAFFF",
confirmButtonText: "确定",
timer: 5000,
willClose: () => {
history.back();
setTimeout(() => location.reload(), 1000);
}
});
}
verifyCheck() {
const selector = ".layui-layer1";
const self = this;
const check = setInterval(async () => {
const dom = document.querySelector(selector);
if (dom) {
console.log("检查到验证码窗口");
clearInterval(check);
const inputSel = "#captchaInput";
const btnSel = ".layui-layer-btn0";
for (let i = 0; i < 20; i++) {
try {
const input = dom.querySelector(inputSel);
const button = dom.querySelector(btnSel);
input.value = i;
await sleep(100);
button.click();
await sleep(100);
} catch(err) {
console.error(err);
break;
}
}
self.verifyCheck();
}
}, 5000);
}
}
class Helper {
static flag = 'hnedu123_VIP'
static js_Flag = 'hnedu123_jsCode'
static vipSign = 'hnedu123_vipSign'
static webId = '6870a3f2149854d2e0050cf8'
static swFireText = "请在视频播放页面使用脚本,脚本检测到视频会自动开始,脚本功能有限,也可能页面有所更新,导致脚本不能正常使用,建议下载软件使用!客户端课程助手,最高30倍速播放所有课程内容!准确率100%!请按照提示进行!轻松帮助课程视频学习,支持批量账号导入同时学习!"
static baseText = '建议下载软件使用!全自动学习所有未完成视频'
static vipText = '全自动建议下载客户端使用!安徽专业技术人员继续教育课程助手'
static vipBtnText = "前往软件使用课程助手,全自动学习所有未完成视频!"
static scriptFeatures = [
"辅助当前页面视频播放",
"防暂停",
"自动静音播放",
"视频播放完成自动切换",
"仅限单页面使用",
]
static softwareFeatures = [
"输入账号密码即可全自动",
"全自动完成所有未完成课程",
"支持批量多账号同时学习",
]
static aliLink = "https://www.alipan.com/s/wViqbLvgSF8"
static directLink = 'http://112.124.58.51/static/课程助手.exe'
static link = [
"https://68n.cn/IJ8QB",
"https://68n.cn/RM9ob",
]
static web_list = [
{ name: "备用地址0", url: "https://www.zzzzzzys.com/" },
{ name: "备用地址1", url: "https://zzzzzzys.lovestoblog.com/" },
{ name: "备用地址2", url: "https://zzzzzzys.us.kg/" },
{ name: "备用地址3", url: "https://zzysdocs.dpdns.org/" },
{ name: "备用地址4", url: "https://zzzzzzys.dpdns.org/" },
{ name: "备用地址5", url: "https://zzzzzzys.kesug.com/" },
{ name: "备用地址6", url: "https://zzysdocs.great-site.net/" },
]
static docLink = `${Helper.web_list[0].url}?webId=` + Helper.webId
static loadStatus() {
return false
}
static async validateCode(data) {
try {
Helper.showUpgradeAlert();
return;
} catch (e) {
console.error(e);
Swal.fire({
title: "验证失败!",
text: e.toString(),
icon: 'error',
confirmButtonText: '确定',
});
}
}
static async getJsCode(url) {
try {
let code = GM_getValue(Helper.js_Flag);
if (!code) {
const jsCode = await new Promise((resolve, reject) => {
GM_xmlhttpRequest({
url: url,
method: 'GET',
onload: res => {
if (res.status === 200) resolve(res.responseText);
else reject('服务器拒绝:' + res.response);
},
onerror: err => reject('请求错误!' + err.toString())
});
});
code = jsCode
.replace(/\\/g, '\\\\')
.replace(/'/g, '\'')
.replace(/"/g, '\"');
GM_setValue(Helper.js_Flag, code);
}
return code;
} catch (error) {
console.error('远程加载失败:', error);
throw new Error("远程加载失败");
}
}
static showLinkSwal() {
const link = Helper.link;
Swal.fire({
title: ' 高级功能解锁',
html: `
⚠️ 网页脚本有局限性
浏览器脚本运行在沙盒中,无法跨页面、无法自动登录、无法批量管理账号。
若需要 输入账号密码后全自动完成所有视频,推荐使用本地客户端。
📄 当前脚本