// ==UserScript==
// @name TOD🚀全平台网课助手【学习通 U校园ai 知到 英华 仓辉 雨课堂 职教云】【学起 青书 柠檬 睿学 慕享 出头科技 慕华】【国开 广开 上海开放大学】等平台 客服微信:WKWK796 自动刷课
// @namespace https://github.com/wkwk796
// @version 2.7.1
// @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
// @downloadURL none
// ==/UserScript==
(function() {
'use strict';
// 设置默认配置
const defaultConfig = {
autoPlay: true,
autoMute: true,
autoNext: true,
showContact: true
};
// 初始化配置
let config = {
autoPlay: GM_getValue('autoPlay', defaultConfig.autoPlay),
autoMute: GM_getValue('autoMute', defaultConfig.autoMute),
autoNext: GM_getValue('autoNext', defaultConfig.autoNext),
showContact: GM_getValue('showContact', defaultConfig.showContact)
};
// 保存配置
function saveConfig() {
GM_setValue('autoPlay', config.autoPlay);
GM_setValue('autoMute', config.autoMute);
GM_setValue('autoNext', config.autoNext);
GM_setValue('showContact', config.showContact);
}
// 切换配置项
function toggleConfig(key) {
config[key] = !config[key];
saveConfig();
console.log(`学习通脚本: ${key} 已${config[key] ? '开启' : '关闭'}`);
}
// 创建控制面板
function createControlPanel() {
// 检查是否已存在控制面板
if (document.getElementById('chaoxing-auto-play-panel')) {
return;
}
const panel = document.createElement('div');
panel.id = 'chaoxing-auto-play-panel';
panel.innerHTML = `
`;
// 添加样式
GM_addStyle(`
#chaoxing-auto-play-panel {
position: fixed;
top: 50px;
right: 50px;
width: 300px;
background: #fff;
border: 1px solid #ddd;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
z-index: 9999;
font-family: Arial, sans-serif;
}
.chaoxing-panel-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px;
background: #f5f5f5;
border-bottom: 1px solid #ddd;
border-radius: 8px 8px 0 0;
}
.chaoxing-panel-header h3 {
margin: 0;
font-size: 16px;
color: #333;
}
#chaoxing-close-panel {
background: none;
border: none;
font-size: 20px;
cursor: pointer;
color: #666;
}
.chaoxing-panel-body {
padding: 15px;
}
.chaoxing-control-item {
margin-bottom: 12px;
}
.chaoxing-control-item label {
display: flex;
align-items: center;
cursor: pointer;
font-size: 14px;
}
.chaoxing-control-item input[type="checkbox"] {
margin-right: 8px;
}
.chaoxing-contact-info {
margin: 15px 0;
padding: 10px;
background: #f0f9ff;
border: 1px solid #b3e5fc;
border-radius: 4px;
text-align: center;
}
.chaoxing-contact-info p {
margin: 0;
font-size: 14px;
color: #0277bd;
}
.chaoxing-panel-footer {
display: flex;
justify-content: center;
margin-top: 15px;
}
#chaoxing-toggle-contact {
padding: 6px 12px;
background: #2196f3;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 12px;
}
#chaoxing-toggle-contact:hover {
background: #1976d2;
}
`);
// 添加到页面
document.body.appendChild(panel);
// 绑定事件
document.getElementById('chaoxing-close-panel').addEventListener('click', () => {
panel.style.display = 'none';
});
document.getElementById('chaoxing-auto-play').addEventListener('change', (e) => {
config.autoPlay = e.target.checked;
saveConfig();
});
document.getElementById('chaoxing-auto-mute').addEventListener('change', (e) => {
config.autoMute = e.target.checked;
saveConfig();
});
document.getElementById('chaoxing-auto-next').addEventListener('change', (e) => {
config.autoNext = e.target.checked;
saveConfig();
});
document.getElementById('chaoxing-toggle-contact').addEventListener('click', () => {
toggleConfig('showContact');
// 重新创建面板以更新联系方式显示
document.body.removeChild(panel);
createControlPanel();
});
}
// 自动播放和静音功能
function handleVideo() {
// 查找所有视频元素
const videos = document.querySelectorAll('video');
videos.forEach(video => {
if (config.autoMute && !video.muted) {
video.muted = true;
}
if (config.autoPlay && video.paused) {
video.play().catch(err => {
console.log('学习通脚本: 自动播放失败,可能需要用户交互:', err);
// 尝试模拟用户交互后播放
setTimeout(() => {
video.click();
}, 1000);
});
}
});
// 检查是否需要点击播放按钮
if (config.autoPlay) {
// 学习通常见的播放按钮选择器
const playButtons = document.querySelectorAll('.vjs-big-play-button, .video-cover, .startbutton');
playButtons.forEach(button => {
// 确保按钮可见且未被点击过
if (button.style.display !== 'none' && !button.classList.contains('clicked')) {
setTimeout(() => {
button.click();
button.classList.add('clicked');
}, 500);
}
});
}
}
// 检测视频结束并自动播放下一节
function setupVideoEndDetection() {
const videos = document.querySelectorAll('video');
videos.forEach(video => {
video.addEventListener('ended', () => {
if (config.autoNext) {
// 尝试点击下一节按钮
const nextButtons = document.querySelectorAll('.nextbtn, .nextChapter, .next-button');
nextButtons.forEach(button => {
if (button.offsetParent !== null) { // 确保按钮可见
setTimeout(() => {
button.click();
console.log('学习通脚本: 视频播放完毕,已自动播放下一节');
}, 1000);
}
});
}
});
});
}
// 检查是否在视频页面
function isVideoPage() {
const videoElements = document.querySelectorAll('video, .video-player, .vjs-video');
return videoElements.length > 0 ||
urlPatterns.some(pattern => pattern.test(window.location.href.toLowerCase()));
}
// 定时检查并处理视频
function startMonitoring() {
if (isVideoPage()) {
handleVideo();
setupVideoEndDetection();
}
// 每3秒检查一次
setTimeout(startMonitoring, 3000);
}
// 注册油猴菜单命令
GM_registerMenuCommand("显示/隐藏控制面板", () => {
const panel = document.getElementById('chaoxing-auto-play-panel');
if (panel) {
panel.style.display = panel.style.display === 'none' ? 'block' : 'none';
} else {
createControlPanel();
}
});
// 页面加载完成后执行
window.addEventListener('load', () => {
// 延迟创建控制面板,确保页面完全加载
setTimeout(() => {
createControlPanel();
startMonitoring();
}, 2000);
});
// 监听页面变化(SPA应用可能动态加载内容)
const observer = new MutationObserver(mutations => {
if (mutations.some(m => m.addedNodes.length > 0)) {
handleVideo();
setupVideoEndDetection();
}
});
observer.observe(document.body, {
childList: true,
subtree: true
});
})();