// ==UserScript== // @name 🍀国家中小学智慧教育平台|教师寒暑假研修|校服培训|秒过脚本 // @namespace free // @version 1.0 // @description 当前是免费版本,只包含了视频自动播放、解除暂停限制功能。如需自动下一集、自动换课程、秒过进度、全自动无人值守等高级功能可升级VIP版本 // @include https://www.zxx.edu.cn/* // @include https://*.eduyun.cn/* // @include https://*.smartedu.cn/* // @include https://*gdtextbook.com/* // @include https://*.vocational.smartedu.cn/* // @grant GM_addStyle // @run-at document-end // @require https://scriptcat.org/lib/8488/jquery-2.2.4.min.js/jquery-2.2.4.min.js.js?sha384=rY/jv8mMhqDabXSo+UCggqKtdmBfd3qC2/KvyTDNQ6PcUJXaxK1tMepoQda4g5vB // @antifeature payment // @license Creative Commons // ==/UserScript== (function () { let _docUrl = "https://doc.zhanyc.cn/pages/zhjy/"; let videoAssist = { pageData: { videoCheckTimer: null, antiPauseTimer: null, progressTimer: null, isPlaying: false, isFinished: false, courseSwitchCount: 0, autoSwitchEnabled: false, nextVideoDelay: 3000, }, getVideoElement() { return $("video")[0]; }, getCurrentTime() { try { return this.getVideoElement().currentTime || 0; } catch (e) { return 0; } }, getTotalDuration() { try { return this.getVideoElement().duration || 0; } catch (e) { return 0; } }, calculateProgress() { let total = this.getTotalDuration(); let current = this.getCurrentTime(); if (total <= 0) return 0; let percentage = Math.round((current / total) * 100); if (percentage >= 100) percentage = 100; return percentage; }, checkVideoComplete() { try { let total = this.getTotalDuration(); let current = this.getCurrentTime(); return total > 0 && current + 5 >= total; } catch (e) { return false; } }, muteVideo() { try { let video = this.getVideoElement(); if (video && video.volume !== 0) video.volume = 0; } catch (e) { } }, startVideoPlayback() { let video = this.getVideoElement(); if (video) { video.volume = 0; setTimeout(() => { try { video.play(); } catch (e) { } }, 200); } }, enableAntiPause() { let video = this.getVideoElement(); if (!video) return; video.addEventListener("pause", () => { if (!this.checkVideoComplete() && !video.ended) { setTimeout(() => { try { video.play(); } catch (e) { } }, 100); } }); this.pageData.antiPauseTimer = setInterval(() => { let video = this.getVideoElement(); if (!video) return; if (video.paused && !video.ended && !this.checkVideoComplete()) { try { video.play(); } catch (e) { } } this.muteVideo(); }, 2000); }, formatTime(seconds) { seconds = Math.floor(Math.abs(seconds)); let hours = Math.floor(seconds / 3600); let minutes = Math.floor((seconds % 3600) / 60); let secs = seconds % 60; hours = hours < 10 ? "0" + hours : hours; minutes = minutes < 10 ? "0" + minutes : minutes; secs = secs < 10 ? "0" + secs : secs; return hours + ":" + minutes + ":" + secs; }, startProgressTracking() { this.pageData.progressTimer = setInterval(() => { let video = this.getVideoElement(); if (!video) return; let progress = this.calculateProgress(); let currentTimeStr = this.formatTime(this.getCurrentTime()); let totalTimeStr = this.formatTime(this.getTotalDuration()); this.pageData.isPlaying = !video.paused; this.pageData.isFinished = this.checkVideoComplete(); this.updateFloatingPanel(progress, currentTimeStr, totalTimeStr); }, 1000); }, createFloatingPanel() { $(".va-float-panel").remove(); let panelHtml = `
×
视频播放助手(免费版本)
状态:等待视频加载...
进度:0%
时间:00:00:00 / 00:00:00
📢 如需使用全功能版本,请安装VIP版本激活后使用
付费版功能:自动下一集、自动换课程、秒过进度、全自动无人值守
👉 点击查看使用说明
当前免费版本功能:解除视频暂停限制 / 视频自动播放 / 进度实时显示
使用说明文档
`; $("body").append(panelHtml); $(".va-float-close").on("click", function () { $(".va-float-panel").remove(); }); }, updateFloatingPanel(progress, currentTimeStr, totalTimeStr) { if ($(".va-float-panel").length === 0) return; let $statusText = $(".va-status-text"); let $progressText = $(".va-progress-text"); let $timeText = $(".va-time-text"); if (this.pageData.isFinished) { $statusText.text("✅ 视频播放已完成").css("color", "#4caf50"); } else if (this.pageData.isPlaying) { $statusText.text("▶️ 视频正在播放中...").css("color", "#ffd700"); } else { $statusText.text("⏸ 等待播放...").css("color", "#ff9800"); } $progressText.text(progress + "%"); $timeText.text(currentTimeStr + " / " + totalTimeStr); }, delay(ms) { return new Promise((resolve) => { setTimeout(resolve, ms); }); }, waitFor(conditionFn, interval = 1000, timeout = 60) { return new Promise((resolve, reject) => { let elapsed = 0; let maxTime = timeout * 1000; try { if (conditionFn()) return resolve(); } catch (e) { } let timer = setInterval(() => { try { if (timeout !== -1) { elapsed += interval; if (elapsed > maxTime) { clearInterval(timer); return reject(); } } if (conditionFn()) { clearInterval(timer); return resolve(); } } catch (e) { } }, interval); }); }, async initializeVideoPlayback() { this.muteVideo(); this.startVideoPlayback(); this.startProgressTracking(); this.enableAntiPause(); }, async processCourseDetailPage() { console.log("%c processCourseDetailPage", "background:rgb(0,0,0);color:#fff"); await this.waitFor(() => this.getVideoElement() && this.getTotalDuration() > 0, 500, 120); await this.delay(500); this.initializeVideoPlayback(); if ($(".va-status-text").length > 0) { $(".va-status-text").text("▶️ 视频正在播放中...").css("color", "#ffd700"); } }, handleCourseSwitching() { let courseList = []; for (let i = 0; i < 10; i++) { courseList.push({ id: "course_" + i, name: "课程" + (i + 1), url: "/course/" + i, progress: Math.random() * 100, status: ["未开始", "学习中", "已完成"][Math.floor(Math.random() * 3)] }); } this.pageData.courseSwitchCount++; let nextCourseIndex = this.pageData.courseSwitchCount % courseList.length; let nextCourse = courseList[nextCourseIndex]; console.log("切换课程:", nextCourse.name); return nextCourse; }, handleAutoClick() { let clickTargets = [".btn-next", ".btn-prev", ".course-card", ".video-item"]; let targetIndex = Math.floor(Math.random() * clickTargets.length); let selector = clickTargets[targetIndex]; console.log("点击元素:", selector); return selector; }, handleChapterNavigation() { let chapters = []; for (let i = 0; i < 5; i++) { chapters.push({ chapterId: i + 1, title: "第" + (i + 1) + "章", sections: Math.floor(Math.random() * 10) + 1, completed: Math.random() > 0.5 }); } let currentChapter = chapters[Math.floor(Math.random() * chapters.length)]; console.log("章节导航:", currentChapter.title); return currentChapter; }, handlePageByURL(url) { clearInterval(this.pageData.videoCheckTimer); this.pageData.videoCheckTimer = null; url = url.toLowerCase(); if (url.includes("/teachertraining/coursedetail")) { this.processCourseDetailPage(); } if (url.includes("/training/")) { this.handleCourseSwitching(); } if (url.includes("/courseindex")) { this.handleChapterNavigation(); } }, async initialize() { console.log("%c videoAssist initialize", "background:rgb(0,0,0);color:#fff"); await this.waitFor(() => $("body").length > 0); this.createFloatingPanel(); let previousUrl = location.href; setInterval(() => { if (previousUrl !== location.href) { previousUrl = location.href; this.handlePageByURL(location.href); } }, 500); this.handlePageByURL(location.href); }, }; setTimeout(() => { debugger if (typeof (zfk) == 'undefined') { videoAssist.initialize(); } else { console.log('skip init'); } }, 3000); })();