Greasy Fork is available in English.
🐯全网免费仅做一款脚本🐯】、【🚀已完美兼容、智慧树、中国大学mooc、慕课、雨课堂、新国开、超星、学习通、知到、国家开放大学、蓝墨云、职教云、智慧职教、云班课精品课、山东专技、西财在线剩余网站仅支持部分功能🚀】【半兼容、绎通云、U校园、学堂在线】、【😎完美应付测试,全自动答题,一键完成所有资源学习(视频挨个刷时长不存在滴)、视频倍速😎】、
// ==UserScript==
// @name TOD🚀全平台网课助手【学习通 U校园ai 知到 英华 仓辉 雨课堂 职教云】【学起 青书 柠檬 睿学 慕享 出头科技 慕华】【国开 广开 上海开放大学】等平台 客服微信:WKWK796 自动刷课
// @namespace https://github.com/wkwk796
// @version 1.1.2
// @description 🐯全网免费仅做一款脚本🐯】、【🚀已完美兼容、智慧树、中国大学mooc、慕课、雨课堂、新国开、超星、学习通、知到、国家开放大学、蓝墨云、职教云、智慧职教、云班课精品课、山东专技、西财在线剩余网站仅支持部分功能🚀】【半兼容、绎通云、U校园、学堂在线】、【😎完美应付测试,全自动答题,一键完成所有资源学习(视频挨个刷时长不存在滴)、视频倍速😎】、
// @author Wkwk796
// @match *://*.chaoxing.com/*
// @match *://*.zhihuishu.com/*
// @match *://*.chaoxing.com/*
// @match *://mooc1.chaoxing.com/nodedetailcontroller/*
// @match *://*.chaoxing.com/mooc-ans/work/doHomeWorkNew*
// @match *://*.chaoxing.com/work/doHomeWorkNew*
// @match *://*.edu.cn/work/doHomeWorkNew*
// @match *://*.asklib.com/*
// @match *://*.chaoxing.com/*
// @match *://*.hlju.edu.cn/*
// @match *://lms.ouchn.cn/*
// @match *://xczxzdbf.moodle.qwbx.ouchn.cn/*
// @match *://tongyi.aliyun.com/qianwen/*
// @match *://chatglm.cn/*
// @match *://*.zhihuishu.com/*
// @match *://course.ougd.cn/*
// @match *://moodle.syxy.ouchn.cn/*
// @match *://moodle.qwbx.ouchn.cn/*
// @match *://elearning.bjou.edu.cn/*
// @match *://whkpc.hnqtyq.cn:5678/*
// @match *://study.ouchn.cn/*
// @match *://www.51xinwei.com/*
// @match *://*.w-ling.cn/*
// @match *://xuexi.jsou.cn/*
// @match *://*.edu-edu.com/*
// @match *://xuexi.jsou.cn/*
// @match *://spoc-exam.icve.com.cn/*
// @match *://*.icve.com.cn/*
// @match *://zice.cnzx.info/*
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_info
// @grant GM_addStyle
// @grant unsafeWindow
// @grant none
// @license MIT
// @icon https://static.zhihuishu.com/static/img/favicon.ico
// ==/UserScript==
(function() {
'use strict';
// ==================== 配置区域 ====================
const CONFIG = {
// 自动播放延迟(毫秒)
playDelay: 2000,
// 检测间隔(毫秒)
checkInterval: 1000,
// 自动静音
autoMute: true,
// 自动播放
autoPlay: true,
// 自动下一章
autoNext: true,
// 播放速度(1 表示正常速度)
playbackRate: 1,
// 联系方式
contact: 'wkwk796',
// 显示控制面板
showPanel: true,
// 显示通知
showNotifications: true
};
// ==================== 全局变量 ====================
let isRunning = false;
let checkTimer = null;
let controlPanel = null;
let currentVideo = null;
// ==================== 样式定义 ====================
const STYLES = `
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
@keyframes slideIn {
from { transform: translateX(100%); opacity: 0; }
to { transform: translateX(0); opacity: 1; }
}
.study-panel-container {
position: fixed !important;
top: 20px !important;
right: 20px !important;
z-index: 999999 !important;
font-family: 'Microsoft YaHei', Arial, sans-serif !important;
animation: slideIn 0.3s ease-out !important;
}
.study-panel-toggle {
width: 50px !important;
height: 50px !important;
border-radius: 50% !important;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
border: none !important;
color: white !important;
font-size: 24px !important;
cursor: pointer !important;
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
transition: all 0.3s ease !important;
display: flex !important;
align-items: center !important;
justify-content: center !important;
}
.study-panel-toggle:hover {
transform: scale(1.1) !important;
box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6) !important;
}
.study-panel-main {
width: 320px !important;
background: white !important;
border-radius: 16px !important;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
overflow: hidden !important;
margin-top: 15px !important;
display: none !important;
}
.study-panel-main.visible {
display: block !important;
}
.study-panel-header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
padding: 15px 20px !important;
color: white !important;
}
.study-panel-title {
font-size: 18px !important;
font-weight: 600 !important;
margin: 0 !important;
display: flex !important;
align-items: center !important;
gap: 8px !important;
}
.study-panel-subtitle {
font-size: 12px !important;
opacity: 0.9 !important;
margin-top: 4px !important;
}
.study-panel-body {
padding: 15px 20px !important;
}
.study-panel-status {
display: flex !important;
align-items: center !important;
gap: 10px !important;
padding: 10px !important;
background: #f8f9fa !important;
border-radius: 8px !important;
margin-bottom: 15px !important;
}
.study-panel-status-dot {
width: 10px !important;
height: 10px !important;
border-radius: 50% !important;
background: #6c757d !important;
}
.study-panel-status-dot.active {
background: #28a745 !important;
animation: pulse 1.5s infinite !important;
}
.study-panel-status-text {
font-size: 14px !important;
color: #495057 !important;
}
.study-panel-controls {
display: flex !important;
flex-direction: column !important;
gap: 10px !important;
}
.study-panel-btn {
width: 100% !important;
padding: 10px 15px !important;
border: none !important;
border-radius: 8px !important;
font-size: 14px !important;
font-weight: 500 !important;
cursor: pointer !important;
transition: all 0.2s ease !important;
display: flex !important;
align-items: center !important;
justify-content: center !important;
gap: 8px !important;
}
.study-panel-btn.primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
color: white !important;
}
.study-panel-btn.primary:hover {
transform: translateY(-2px) !important;
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
}
.study-panel-btn.secondary {
background: #6c757d !important;
color: white !important;
}
.study-panel-btn.secondary:hover {
background: #5a6268 !important;
}
.study-panel-btn.danger {
background: #dc3545 !important;
color: white !important;
}
.study-panel-btn.danger:hover {
background: #c82333 !important;
}
.study-panel-contact {
margin-top: 15px !important;
padding: 12px !important;
background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
border-radius: 8px !important;
text-align: center !important;
}
.study-panel-contact-label {
font-size: 12px !important;
color: #6c757d !important;
margin-bottom: 4px !important;
}
.study-panel-contact-value {
font-size: 16px !important;
font-weight: 600 !important;
color: #667eea !important;
font-family: 'Courier New', monospace !important;
letter-spacing: 1px !important;
}
.study-panel-speed-control {
margin-top: 15px !important;
}
.study-panel-speed-label {
font-size: 13px !important;
color: #495057 !important;
margin-bottom: 8px !important;
display: flex !important;
justify-content: space-between !important;
align-items: center !important;
}
.study-panel-speed-slider {
width: 100% !important;
height: 6px !important;
border-radius: 3px !important;
background: #dee2e6 !important;
outline: none !important;
-webkit-appearance: none !important;
}
.study-panel-speed-slider::-webkit-slider-thumb {
-webkit-appearance: none !important;
width: 18px !important;
height: 18px !important;
border-radius: 50% !important;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
cursor: pointer !important;
box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3) !important;
}
.study-panel-log {
margin-top: 15px !important;
max-height: 100px !important;
overflow-y: auto !important;
padding: 10px !important;
background: #1e1e1e !important;
border-radius: 8px !important;
}
.study-panel-log-item {
font-size: 11px !important;
color: #d4d4d4 !important;
padding: 2px 0 !important;
border-bottom: 1px solid #333 !important;
}
.study-panel-log-item:last-child {
border-bottom: none !important;
}
.study-panel-log-time {
color: #667eea !important;
margin-right: 8px !important;
}
.study-panel-footer {
padding: 10px 20px !important;
background: #f8f9fa !important;
text-align: center !important;
font-size: 11px !important;
color: #6c757d !important;
}
`;
// ==================== 工具函数 ====================
function log(message) {
const time = new Date().toLocaleTimeString('zh-CN');
console.log(`[学习通脚本 ${time}] ${message}`);
if (controlPanel) {
addLog(message);
}
}
function notify(message) {
if (CONFIG.showNotifications) {
GM_notification({
text: message,
title: '学习通脚本',
timeout: 3000
});
}
}
function formatTime(seconds) {
const hours = Math.floor(seconds / 3600);
const minutes = Math.floor((seconds % 3600) / 60);
const secs = Math.floor(seconds % 60);
if (hours > 0) {
return `${hours}:${String(minutes).padStart(2, '0')}:${String(secs).padStart(2, '0')}`;
}
return `${String(minutes).padStart(2, '0')}:${String(secs).padStart(2, '0')}`;
}
function getCurrentTime() {
return new Date().toLocaleTimeString('zh-CN');
}
// ==================== 日志功能 ====================
function addLog(message) {
const logContainer = document.getElementById('study-log');
if (logContainer) {
const logItem = document.createElement('div');
logItem.className = 'study-panel-log-item';
logItem.innerHTML = `<span class="study-panel-log-time">[${getCurrentTime()}]</span>${message}`;
logContainer.insertBefore(logItem, logContainer.firstChild);
// 只保留最近20条日志
while (logContainer.children.length > 20) {
logContainer.removeChild(logContainer.lastChild);
}
}
}
// ==================== 视频检测与控制 ====================
function findVideoElement() {
// 尝试多种选择器
const selectors = [
'video',
'audio',
'#video_html5_api',
'iframe',
'.ans-attach-online',
'.ans-attach-obj',
'.videonew-player',
'.xt_video_player',
'iframe[src*="video"]',
'iframe[src*="play"]'
];
for (const selector of selectors) {
const elements = document.querySelectorAll(selector);
for (const el of elements) {
if (el.tagName === 'VIDEO' || el.tagName === 'AUDIO') {
log(`找到${el.tagName}元素: ${selector}`);
return el;
}
if (el.tagName === 'IFRAME') {
try {
const iframeDoc = el.contentDocument || el.contentWindow.document;
const video = iframeDoc.querySelector('video');
if (video) {
log(`在iframe中找到video元素`);
return video;
}
} catch (e) {
// 跨域限制
}
}
}
}
// 备用方案:深度搜索
const allElements = document.querySelectorAll('*');
for (const el of allElements) {
if (el.tagName === 'VIDEO') {
log(`深度搜索找到video元素`);
return el;
}
}
return null;
}
function handleVideo(video) {
if (!video) return;
currentVideo = video;
// 静音
if (CONFIG.autoMute) {
video.muted = true;
video.volume = 0;
log('已静音');
}
// 设置播放速度
video.playbackRate = CONFIG.playbackRate;
if (CONFIG.playbackRate !== 1) {
log(`播放速度: ${CONFIG.playbackRate}x`);
}
// 自动播放
if (CONFIG.autoPlay) {
video.play().then(() => {
log('开始播放');
updateStatus(true);
}).catch(err => {
log(`播放失败: ${err.message}`);
// 尝试再次播放
setTimeout(() => {
video.play().catch(e => log(`重试失败: ${e.message}`));
}, 1000);
});
}
// 监听播放结束
video.addEventListener('ended', () => {
log('视频播放完成');
updateStatus(false);
notify('视频播放完成,准备下一章');
if (CONFIG.autoNext) {
setTimeout(() => {
clickNextChapter();
}, CONFIG.playDelay);
}
});
// 监听暂停事件(自动恢复播放)
video.addEventListener('pause', () => {
if (isRunning && !video.ended) {
log('检测到暂停,自动恢复播放');
setTimeout(() => {
if (!video.ended && video.paused) {
video.play().catch(e => log(`恢复播放失败: ${e.message}`));
}
}, 500);
}
});
// 更新进度显示
video.addEventListener('timeupdate', () => {
updateProgress(video);
});
}
function clickNextChapter() {
// 尝试多种下一章按钮选择器
const nextSelectors = [
'.next',
'.next-btn',
'.btn-next',
'[class*="next"]',
'[class*="Next"]',
'.orientationright',
'.nodeItem.right',
'.catalog_points_sa',
'.catalog_points_em',
'a[href*="next"]',
'.ncells',
'.f14',
'span[title*="下一"]',
'.roundpointStudent, .roundpoint',
'.jobUnfinish',
'.job',
'.catalog_s',
'.catalog_area',
'.catalog_tit'
];
for (const selector of nextSelectors) {
const elements = document.querySelectorAll(selector);
for (const el of elements) {
// 检查是否包含下一章相关文字
const text = el.textContent || el.innerText || '';
if (text.includes('下') || text.includes('next') || text.includes('Next') ||
el.className.includes('next') || el.className.includes('Next') ||
el.className.includes('right')) {
log(`点击下一章: ${selector}`);
el.click();
notify('正在跳转下一章');
// 等待页面加载后重新开始检测
setTimeout(() => {
if (isRunning) {
checkAndPlay();
}
}, 3000);
return true;
}
}
}
// 备用方案:尝试点击右侧列表项
const listItems = document.querySelectorAll('.ncells, .ncell, li');
for (const item of listItems) {
const text = item.textContent || item.innerText || '';
if (text.includes('视频') || text.includes('任务') || text.includes('课件')) {
// 检查是否已完成
if (!item.classList.contains('job') && !item.classList.contains('jobDone')) {
log('尝试点击列表项');
item.click();
notify('正在跳转');
setTimeout(() => {
if (isRunning) {
checkAndPlay();
}
}, 3000);
return true;
}
}
}
log('未找到下一章按钮');
notify('所有章节已完成或未找到下一章');
return false;
}
// ==================== 控制面板 ====================
function createControlPanel() {
if (controlPanel) return;
const container = document.createElement('div');
container.className = 'study-panel-container';
container.innerHTML = `
<button class="study-panel-toggle" id="study-toggle-btn" title="学习通脚本">📚</button>
<div class="study-panel-main" id="study-panel">
<div class="study-panel-header">
<h3 class="study-panel-title">📚 学习通自动播放</h3>
<div class="study-panel-subtitle">智能静音播放助手</div>
</div>
<div class="study-panel-body">
<div class="study-panel-status">
<div class="study-panel-status-dot" id="status-dot"></div>
<span class="study-panel-status-text" id="status-text">未运行</span>
</div>
<div class="study-panel-controls">
<button class="study-panel-btn primary" id="start-btn">
<span>▶</span> 开始自动播放
</button>
<button class="study-panel-btn danger" id="stop-btn" style="display:none;">
<span>⏹</span> 停止
</button>
<button class="study-panel-btn secondary" id="mute-btn">
<span>🔇</span> 切换静音
</button>
<button class="study-panel-btn secondary" id="next-btn">
<span>⏭</span> 下一章
</button>
</div>
<div class="study-panel-speed-control">
<div class="study-panel-speed-label">
<span>播放速度</span>
<span id="speed-value">1.0x</span>
</div>
<input type="range" class="study-panel-speed-slider" id="speed-slider"
min="0.5" max="3" step="0.25" value="1">
</div>
<div class="study-panel-contact">
<div class="study-panel-contact-label">👤 联系方式</div>
<div class="study-panel-contact-value">${CONFIG.contact}</div>
</div>
<div class="study-panel-log" id="study-log">
<div class="study-panel-log-item">
<span class="study-panel-log-time">[${getCurrentTime()}]</span>
脚本已加载,等待启动...
</div>
</div>
</div>
<div class="study-panel-footer">
版本 2026.1 | by wkwk796
</div>
</div>
`;
document.body.appendChild(container);
controlPanel = container;
// 绑定事件
setupPanelEvents();
log('控制面板已创建');
}
function setupPanelEvents() {
const toggleBtn = document.getElementById('study-toggle-btn');
const panel = document.getElementById('study-panel');
const startBtn = document.getElementById('start-btn');
const stopBtn = document.getElementById('stop-btn');
const muteBtn = document.getElementById('mute-btn');
const nextBtn = document.getElementById('next-btn');
const speedSlider = document.getElementById('speed-slider');
const speedValue = document.getElementById('speed-value');
// 切换面板显示
toggleBtn.addEventListener('click', () => {
panel.classList.toggle('visible');
});
// 开始按钮
startBtn.addEventListener('click', () => {
start();
});
// 停止按钮
stopBtn.addEventListener('click', () => {
stop();
});
// 静音切换
muteBtn.addEventListener('click', () => {
CONFIG.autoMute = !CONFIG.autoMute;
if (currentVideo) {
currentVideo.muted = CONFIG.autoMute;
currentVideo.volume = CONFIG.autoMute ? 0 : 1;
}
muteBtn.innerHTML = CONFIG.autoMute ? '<span>🔇</span> 切换静音' : '<span>🔊</span> 切换静音';
log(`静音: ${CONFIG.autoMute ? '开' : '关'}`);
});
// 下一章
nextBtn.addEventListener('click', () => {
clickNextChapter();
});
// 速度滑块
speedSlider.addEventListener('input', (e) => {
const speed = parseFloat(e.target.value);
CONFIG.playbackRate = speed;
speedValue.textContent = `${speed.toFixed(2)}x`;
if (currentVideo) {
currentVideo.playbackRate = speed;
}
log(`播放速度: ${speed}x`);
});
}
function updateStatus(active) {
const dot = document.getElementById('status-dot');
const text = document.getElementById('status-text');
if (dot && text) {
if (active) {
dot.classList.add('active');
text.textContent = '正在播放';
} else {
dot.classList.remove('active');
text.textContent = isRunning ? '等待视频' : '未运行';
}
}
}
function updateProgress(video) {
const statusText = document.getElementById('status-text');
if (statusText && isRunning) {
const current = video.currentTime || 0;
const duration = video.duration || 0;
const percentage = duration > 0 ? ((current / duration) * 100).toFixed(1) : 0;
statusText.textContent = `播放中 ${formatTime(current)}/${formatTime(duration)} (${percentage}%)`;
}
}
// ==================== 主控制逻辑 ====================
function checkAndPlay() {
if (!isRunning) return;
const video = findVideoElement();
if (video) {
if (currentVideo !== video) {
log('检测到新视频');
}
handleVideo(video);
updateStatus(true);
} else {
updateStatus(false);
log('未检测到视频元素,继续等待...');
}
}
function start() {
if (isRunning) return;
isRunning = true;
log('脚本启动');
notify('自动播放已启动');
// 切换按钮状态
const startBtn = document.getElementById('start-btn');
const stopBtn = document.getElementById('stop-btn');
if (startBtn) startBtn.style.display = 'none';
if (stopBtn) stopBtn.style.display = 'flex';
updateStatus(false);
// 开始定时检测
checkAndPlay(); // 立即检测一次
checkTimer = setInterval(checkAndPlay, CONFIG.checkInterval);
log('定时检测已启动');
}
function stop() {
isRunning = false;
log('脚本停止');
notify('自动播放已停止');
// 清除定时器
if (checkTimer) {
clearInterval(checkTimer);
checkTimer = null;
}
// 切换按钮状态
const startBtn = document.getElementById('start-btn');
const stopBtn = document.getElementById('stop-btn');
if (startBtn) startBtn.style.display = 'flex';
if (stopBtn) stopBtn.style.display = 'none';
updateStatus(false);
log('定时检测已停止');
}
// ==================== 注入样式 ====================
function injectStyles() {
const styleEl = document.createElement('style');
styleEl.textContent = STYLES;
document.head.appendChild(styleEl);
GM_addStyle(''); // 确保GM_addStyle可用
}
// ==================== 注册菜单命令 ====================
function registerMenuCommands() {
if (typeof GM_registerMenuCommand === 'function') {
GM_registerMenuCommand('▶ 开始自动播放', start);
GM_registerMenuCommand('⏹ 停止自动播放', stop);
GM_registerMenuCommand('📋 显示控制面板', () => {
const panel = document.getElementById('study-panel');
if (panel) {
panel.classList.toggle('visible');
}
});
}
}
// ==================== 初始化 ====================
function init() {
log('脚本初始化中...');
// 注入样式
injectStyles();
// 等待DOM加载完成
const waitForDOM = setInterval(() => {
if (document.body) {
clearInterval(waitForDOM);
// 创建控制面板
createControlPanel();
// 注册菜单命令
registerMenuCommands();
// 自动启动(可选)
setTimeout(() => {
start();
}, CONFIG.playDelay);
log('脚本初始化完成');
notify('学习通自动播放脚本已加载');
}
}, 500);
}
// 启动脚本
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
// 页面变化时重新检测(SPA应用)
let lastUrl = location.href;
new MutationObserver(() => {
const url = location.href;
if (url !== lastUrl) {
lastUrl = url;
log('URL变化,重新检测视频');
currentVideo = null;
if (isRunning) {
setTimeout(checkAndPlay, CONFIG.playDelay);
}
}
}).observe(document, { subtree: true, childList: true });
})();