// ==UserScript== // @name 联大自动刷课【最终精准防验证版】 // @version 21.1 // @description 1.15倍速(精准适配计时器)+ 防身份核验 + 防弹窗 + 基准跳转+ 自动下一集 // @author yyf // @match *://*.jxjypt.cn/* // @grant none // @run-at document-end // ==/UserScript== (function() { 'use strict'; console.log('✅ 联大最终精准版启动(1.15倍速,防验证)'); let hasJumped = false; let currentBaseSection = null; const PLAYBACK_RATE = 1.15; // 🔧 1.15倍速:最稳,不超平台限制 const JUMP_DELAY = 2000; // 2秒延迟 // ============================================== // 1. 模拟人工:彻底防止“无操作检测” // ============================================== function simulateHumanActivity() { window.focus(); // 切桌面也保持焦点 document.dispatchEvent(new MouseEvent('mousemove', { clientX: 300 + Math.random()*50, clientY: 300 + Math.random()*50, bubbles: true })); // 随机触发一次键盘事件(彻底骗过后台) document.dispatchEvent(new KeyboardEvent('keydown', { key: ' ', bubbles: true })); setTimeout(() => document.body.click(), 200); } setInterval(simulateHumanActivity, 15000); // 15秒一次,更稳 // ============================================== // 2. 自动关闭:AI助手弹窗/验证框/红色提示 // ============================================== function autoCloseVerify() { // 专门识别你截图的“AI助教进入对话”红色框 const aiPopup = document.querySelector('.alipay-layer-close, .layui-layer-close, [class*="dialog"] button'); if (aiPopup) { aiPopup.click(); console.log('✅ 自动关闭AI/验证弹窗'); return; } // 普通确定/继续按钮 const btn = document.querySelector('button:contains("确定"), button:contains("继续"), button:contains("我知道了")'); if (btn) btn.click(); } setInterval(autoCloseVerify, 800); // ============================================== // 3. 监听点击:更新基准节 // ============================================== document.addEventListener('click', (e) => { const target = e.target.closest('dd'); if (target && target.textContent.includes('节') && target.querySelector('i')) { currentBaseSection = target; hasJumped = false; console.log(`🔄 基准节:${currentBaseSection.textContent.trim()}`); } }, true); // ============================================== // 4. 核心:等待视频就绪 + 1.15倍速 // ============================================== async function autoPlaySync() { const video = document.querySelector('video'); if (!video) return; // 等待视频完全加载 if (video.readyState < 4) { await new Promise(resolve => { const check = () => video.readyState >= 4 ? resolve() : requestAnimationFrame(check); check(); }); } // 自动播放 if (video.paused) { try { await video.play(); } catch (e) {} } // 强制锁定1.15倍速 if (video.playbackRate !== PLAYBACK_RATE) { video.playbackRate = PLAYBACK_RATE; console.log(`▶ 锁定${PLAYBACK_RATE}倍速`); } video.muted = true; } // ============================================== // 5. 核心逻辑:等待视频结束 + 2秒延迟跳转 // ============================================== function checkAndJump() { const video = document.querySelector('video'); if (!video || !video.duration) return; autoPlaySync(); // 99%进度触发跳转(给平台计时器留足最后几秒) const progress = video.currentTime / video.duration; if (progress < 0.99) { hasJumped = false; return; } if (hasJumped) return; console.log(`⏳ 视频结束,${JUMP_DELAY/1000}秒后跳转...`); hasJumped = true; setTimeout(() => { const allSections = Array.from(document.querySelectorAll('dd')) .filter(dd => dd.textContent.includes('节') && dd.querySelector('i')); if (allSections.length === 0) return; // 找当前基准节 let currentIdx = -1; if (currentBaseSection) { currentIdx = allSections.findIndex(sec => sec === currentBaseSection); } if (currentIdx === -1) { allSections.forEach((sec, idx) => { const icon = sec.querySelector('i, img'); if (icon && (icon.src?.includes('green') || sec.style.color === 'green')) { currentIdx = idx; currentBaseSection = sec; } }); } if (currentIdx === -1) currentIdx = 0; const nextIdx = currentIdx + 1; if (nextIdx >= allSections.length) return; const nextSec = allSections[nextIdx]; console.log(`👉 跳转到:${nextSec.textContent.trim()}`); nextSec.click(); currentBaseSection = nextSec; setTimeout(() => { hasJumped = false; autoPlaySync(); }, 2000); }, JUMP_DELAY); } window.addEventListener('load', () => setTimeout(autoPlaySync, 1500)); setInterval(checkAndJump, 1000); })();