// ==UserScript==
// @name 国家中小学智慧教育平台-课程助手
// @namespace http://tampermonkey.net/zzzzzzys_国家中小学智慧教育平台-课程助手
// @version 1.0.2
// @copyright zzzzzzys.All Rights Reserved.
// @description 国家中小学智慧教育平台-课程助手(https://basic.smartedu.cn/),脚本功能有限,可自动静音播放视频,防暂停。更全自动方法,请查看文档介绍!客户端支持202X教师研修项目!目前仅支持基础教育!输入账号密码,秒学到要求学时!现已支持自动获取积分!获取所有积分要求中的积分(已移除获得证书的几个项目),其他积分都能获得!每次运行轻松获取100积分以上!也支持师范生免试认定,快速达到40学时。
// @author zzzzzzys
// @match https://basic.smartedu.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 wait = ms => new Promise(r => setTimeout(r, ms));
// 主控制器
class Bootstrapper {
constructor() {
this.lessonMgr = null;
this._hookAjax();
this._checkDocumentState();
}
_hookAjax() {
const that = this;
ajaxHooker.hook(function(request) {
const targetUrl = request.url;
// 问题拦截
if (targetUrl.indexOf('vedioValidQuestions/getQuestions') !== -1) {
request.response = function(response) {
try {
const parsed = JSON.parse(response.responseText);
unsafeWindow.QuestionInfo = parsed.data;
console.log("QuestionInfo:", unsafeWindow.QuestionInfo);
} catch(e) {
console.error("Parse question info failed:", e);
}
};
}
// 配置拦截
else if (targetUrl.indexOf('p/play/config') !== -1) {
request.response = response => {
try {
const cfg = JSON.parse(response.responseText);
console.log("play/config:");
console.log(cfg);
unsafeWindow.playConfig = cfg.data;
} catch(err) {
console.error("Config parse error", err);
}
};
}
// 验证码检查拦截
else if (targetUrl.indexOf('learning/learnVerify/checkCode') !== -1) {
request.abort = true;
request.response = res => {
res.responseText = '{"code":0,"msg":null,"data":{"data":"请勿频繁请求","status":9999}}';
};
}
// 学习验证拦截
else if (targetUrl.indexOf('learning/learnVerify') !== -1) {
request.abort = true;
}
});
console.log("Ajax interceptor initialized:", ajaxHooker);
}
_checkDocumentState() {
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', () => this._launch());
} else {
this._launch();
}
}
_launch() {
this.lessonMgr = new LessonManager("channel-hunau");
}
}
// 课程管理核心
class LessonManager {
constructor(channelId) {
this.channelId = channelId;
this.bc = new BroadcastChannel(channelId);
this.isVip = false;
this.busy = false;
this.premiumUrl = null;
this.stopHandler = null;
this.ui = new ControlUI({
VIPBtnText: "高级功能-已弃用,请前往软件学习"
});
this._setup();
}
async _setup() {
// 绑定验证回调
this.ui.callbacks.verify = async (data) => {
const result = await ToolBox.validateCode(data);
if (result) {
this.premiumUrl = result;
this.isVip = true;
this.ui.updateHint(ToolBox.vipText);
return true;
}
return false;
};
// 绑定启动回调
this.ui.callbacks.start = () => {
if (this.busy) return;
this.busy = true;
console.log("Executing, VIP status:", this.isVip);
this._execute().finally(() => {
this.busy = false;
});
};
// 绑定高级功能回调
this.ui.callbacks.premium = async () => {
if (!this.premiumUrl) {
await this.ui.triggerVerify();
}
await this._runPremiumFeatures();
};
this._loadVipState();
// 启动提示 - **关键修改:timer从5000改为10000**
try {
Swal.fire({
title: "提示",
text: ToolBox.swFireText,
icon: 'info',
timer: 10000, // 修改:从5000增加到10000(10秒)
confirmButtonText: '确定',
timerProgressBar: true,
willClose: () => {
this.ui.triggerStart();
}
});
} catch (err) {
console.error(err);
this.ui.triggerStart();
}
}
_loadVipState() {
if (ToolBox.loadStatus()) {
this.isVip = true;
this.ui.updateHint(ToolBox.vipText);
} else {
this.isVip = false;
this.ui.updateHint(ToolBox.baseText);
}
console.log("VIP:", this.isVip);
}
async _runPremiumFeatures() {
try {
ToolBox.showUpgradeAlert();
} catch (error) {
console.error(error);
Swal.fire({
title: "高级功能执行失败!",
text: "若一直失败,请联系进行售后处理!",
icon: 'error',
confirmButtonText: '确定',
allowOutsideClick: false
});
}
}
async _handlePlayback() {
const vid = document.querySelector('video');
if (!vid) return;
vid.volume = 0;
vid.muted = true;
// 移除旧监听器
if (this.stopHandler) {
vid.removeEventListener('pause', this.stopHandler);
}
let debounce = null;
this.stopHandler = async () => {
if (vid.ended) return;
if (debounce) clearTimeout(debounce);
debounce = setTimeout(async () => {
console.log("Video paused, auto-resuming...");
vid.volume = 0;
vid.muted = true;
try {
await vid.play();
} catch (e) {
console.error("Resume failed:", e);
}
}, 500);
};
vid.addEventListener('pause', this.stopHandler);
vid.addEventListener('ended', () => {
this._jumpNext();
}, { once: true });
await vid.play();
}
_jumpNext() {
const chapters = Array.from(document.querySelectorAll('ul.lis-content li.lis-inside-content'));
if (!chapters.length) {
console.log("No catalog found");
return;
}
const currentPos = chapters.findIndex(li => li.querySelector('#top_play'));
console.log("Current index:", currentPos);
const searchFrom = currentPos === -1 ? 0 : currentPos + 1;
for (let idx = searchFrom; idx < chapters.length; idx++) {
const item = chapters[idx];
const btn = item.querySelector('button');
const titleEl = item.querySelector('h2');
if (!titleEl) continue;
const status = btn ? btn.textContent.trim() : '';
console.log(`Chapter[${idx}] status: ${status}`);
const clickAttr = titleEl.getAttribute('onclick') || '';
const urlMatch = clickAttr.match(/window\.location\.href='([^']+)'/);
if (urlMatch) {
const nextUrl = urlMatch[1];
const nextName = titleEl.textContent.trim().replace(/\s+/g, ' ');
console.log("Next chapter:", nextUrl);
Swal.fire({
title: "视频已播放完毕",
html: `即将跳转到下一节:
${nextName}`,
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("Last chapter reached");
this._complete();
}
async _execute() {
try {
await this._handlePlayback();
} catch (e) {
console.error(e);
Swal.fire({
title: "失败!",
text: `视频基础播放失败!`,
icon: 'error',
confirmButtonColor: "#FF4DAFFF",
confirmButtonText: "确定",
timer: 5000,
timerProgressBar: true
});
}
}
_broadcast(msg) {
this.bc.postMessage(msg);
}
_complete() {
if (!this.isVip) {
Swal.fire({
title: "请升级高级版!",
text: `脚本已停止!基础版只能连播几个视频!`,
icon: 'info',
confirmButtonColor: "#FF4DAFFF",
confirmButtonText: "确定",
timer: 0
});
return;
}
this._broadcast('finish');
Swal.fire({
title: "学习完成!",
text: `学习完成,5s后页面自动关闭!`,
icon: 'success',
confirmButtonColor: "#FF4DAFFF",
confirmButtonText: "确定",
timer: 5000,
willClose: () => {
history.back();
setTimeout(() => location.reload(), 1000);
}
});
}
// 验证码自动尝试(保留功能)
captchaSolver() {
const dlgSelector = ".layui-layer1";
const self = this;
const check = setInterval(async () => {
const layer = document.querySelector(dlgSelector);
if (layer) {
console.log("Captcha dialog detected");
clearInterval(check);
const inpSel = "#captchaInput";
const btnSel = ".layui-layer-btn0";
for (let i = 0; i < 20; i++) {
try {
const input = layer.querySelector(inpSel);
const btn = layer.querySelector(btnSel);
if (!input || !btn) break;
input.value = i;
await wait(100);
btn.click();
await wait(100);
} catch(err) {
console.error(err);
break;
}
}
self.captchaSolver();
}
}, 5000);
}
}
// 工具类 - 所有配置和静态方法
class ToolBox {
static flag = 'hnedu123_VIP'
static js_Flag = 'hnedu123_jsCode'
static vipSign = 'hnedu123_vipSign'
static webId = '68809edc4b92476e9720044a'
static swFireText = "请在视频播放页面使用脚本,脚本检测到视频会自动开始,脚本功能有限,也可能页面有所更新,导致脚本不能正常使用,建议下载软件使用!全自动完成本年度寒/暑假教师研修学时,支持批量多账号同时学习,支持快速获取积分,每次运行轻松获取100积分以上,支持师范生免试快速40学时"
static baseText = '建议下载软件使用!全自动学习所有未完成视频'
static vipText = '全自动建议下载客户端使用!国家中小学智慧教育平台-课程助手'
static vipBtnText = "前往软件使用课程助手,全自动学习所有未完成视频!"
static scriptFeatures = [
"辅助当前页面视频播放",
"防暂停",
"自动静音播放",
"视频播放完成自动切换",
"仅限单页面使用",
]
static softwareFeatures = [
"输入账号密码即可全自动",
"全自动完成本年度寒/暑假教师研修学时",
"支持批量多账号同时学习",
"支持快速获取积分,每次运行轻松获取100积分以上",
"支持师范生免试快速40学时",
]
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 = `${ToolBox.web_list[0].url}?webId=` + ToolBox.webId
static loadStatus() {
return false
}
static async validateCode(data) {
try {
ToolBox.showUpgradeAlert();
return;
} catch (e) {
console.error(e);
Swal.fire({
title: "验证失败!",
text: e.toString(),
icon: 'error',
confirmButtonText: '确定',
});
}
}
static async fetchRemoteScript(url) {
try {
let cached = GM_getValue(ToolBox.js_Flag);
if (cached) return cached;
const code = await new Promise((resolve, reject) => {
GM_xmlhttpRequest({
url: url,
method: 'GET',
onload: res => {
if (res.status === 200) resolve(res.responseText);
else reject('Server rejected');
},
onerror: err => reject(err)
});
});
const escaped = code
.replace(/\\/g, '\\\\')
.replace(/'/g, '\'')
.replace(/"/g, '\"');
GM_setValue(ToolBox.js_Flag, escaped);
return escaped;
} catch (error) {
console.error('Remote load failed:', error);
throw new Error("远程加载失败");
}
}
static renderPurchaseModal() {
const links = ToolBox.link;
Swal.fire({
title: ' 高级功能解锁',
html: `
⚠️ 网页脚本有局限性
浏览器脚本运行在沙盒中,无法跨页面、无法自动登录、无法批量管理账号。
若需要 输入账号密码后全自动完成寒暑假研修,获得积分,师范生免试学时,推荐使用本地客户端。
📄 当前脚本