// ==UserScript== // @name 优课助手 | 网课辅助工具 // @namespace https://you-ke.top/index/login // @version 1.1 // @description 【😉♂️已完美兼容、智慧树、中国大学mooc、慕课、雨课堂、新国开、超星、学习通、知到、国家开放大学、蓝墨云、职教云、智慧职教、云班课精品课、剩余网站仅支持部分功能✨】、【🎇完美应付考试、测试,一键搜题😎】、【兼容、U校园、学堂在线】、【🎉新增AI搜题、AI问答,AI生图,Ai聊天定制化服务🥳】、【💙强制破除网站不可复制文字💙】、【🐮基于生成式AI(ChatGPT)的答案生成🐮】、【有其他平台支持需要的请加群催更:😄9662889927😄,共同交流进步脚本无任何诸如(手机号,学校信息,等隐私信息)收集💚】 // @author 优课团队 // @match *://*.edu.cn/* // @match *://*.chaoxing.com/* // @match *://*.zhihuishu.com/* // @match *://*.icve.com.cn/* // @match *://*.cnmooc.org/* // @match *://*.xuetangx.com/* // @match *://*.icourse163.org/* // @match *://*.yuketang.cn/* // @match *://*.mooc.cn/* // @match *://study.163.com/* // @match *://www.bilibili.com/video/* // @match *://v.qq.com/* // @icon http://nb.zizizi.top/miaoke.ico // @grant GM_addStyle // @grant GM_setValue // @grant GM_getValue // @license MIT // ==/UserScript== (function() { 'use strict'; // 工具类 class MiaoKeHelper { constructor() { this.version = '1.0'; this.siteName = this.detectSite(); this.init(); } // 检测当前网站 detectSite() { const host = window.location.hostname; if (host.includes('chaoxing.com')) return '超星学习通'; if (host.includes('zhihuishu.com')) return '智慧树'; if (host.includes('icve.com.cn')) return '智慧职教'; if (host.includes('xuetangx.com')) return '学堂在线'; if (host.includes('icourse163.org')) return '中国大学MOOC'; if (host.includes('bilibili.com')) return 'B站视频'; if (host.includes('v.qq.com')) return '腾讯视频'; return '教育平台'; } // 初始化 init() { this.addStyles(); this.createUI(); this.initFeatures(); this.bindEvents(); console.log(`喵课助手已启动 - ${this.siteName}`); } // 添加样式 addStyles() { GM_addStyle(` /* 主容器样式 */ #miaoke-helper-btn { position: fixed; z-index: 9999; right: 20px; top: 100px; width: 50px; height: 50px; border-radius: 50%; background-color: #3498db; color: white; text-align: center; line-height: 50px; font-size: 24px; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,0.2); transition: all 0.3s ease; user-select: none; } #youth-helper-btn:hover { transform: scale(1.1); box-shadow: 0 5px 15px rgba(0,0,0,0.3); } #miaoke-helper-panel { position: fixed; z-index: 9998; right: 80px; top: 100px; width: 320px; background: white; border-radius: 10px; box-shadow: 0 5px 20px rgba(0,0,0,0.2); font-family: Arial, sans-serif; transition: all 0.3s ease; display: none; overflow: hidden; } /* 面板头部 */ .helper-header { padding: 15px; background: linear-gradient(45deg, #3498db, #2980b9); color: white; display: flex; justify-content: space-between; align-items: center; } .helper-title { margin: 0; font-size: 16px; font-weight: bold; } .helper-close { cursor: pointer; font-size: 18px; } /* 功能区 */ .helper-content { padding: 15px; max-height: 400px; overflow-y: auto; } .helper-section { margin-bottom: 20px; } .section-title { font-size: 14px; font-weight: bold; margin-bottom: 10px; color: #333; border-bottom: 1px solid #eee; padding-bottom: 5px; } .feature-btn { display: inline-block; margin: 5px; padding: 8px 12px; background: #f5f5f5; border-radius: 5px; cursor: pointer; font-size: 12px; color: #333; transition: all 0.2s; } .feature-btn:hover { background: #e0e0e0; } .feature-btn.active { background: #3498db; color: white; } /* 设置区域 */ .helper-setting { margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; } .setting-label { font-size: 13px; color: #555; } .setting-input { width: 50px; text-align: center; border: 1px solid #ddd; border-radius: 3px; padding: 3px; } /* 底部 */ .helper-footer { padding: 10px 15px; background: #f5f5f5; text-align: center; font-size: 12px; color: #555; border-top: 1px solid #eee; } .helper-footer a { color: #3498db; text-decoration: none; } .helper-footer a:hover { text-decoration: underline; } /* 笔记面板 */ #note-panel { position: fixed; right: 80px; bottom: 20px; width: 300px; height: 200px; background: white; border-radius: 10px; box-shadow: 0 5px 20px rgba(0,0,0,0.2); z-index: 9997; display: none; overflow: hidden; } .note-header { padding: 10px; background: linear-gradient(45deg, #3498db, #2980b9); color: white; display: flex; justify-content: space-between; align-items: center; font-size: 14px; } .note-content { padding: 10px; height: calc(100% - 80px); } .note-textarea { width: 100%; height: 100%; border: 1px solid #ddd; border-radius: 5px; padding: 5px; resize: none; font-size: 13px; } .note-footer { padding: 5px 10px; display: flex; justify-content: flex-end; } .note-save { padding: 5px 10px; background: #3498db; color: white; border: none; border-radius: 3px; cursor: pointer; font-size: 12px; } /* 阅读模式 */ .reading-mode-active { background-color: #f9f9f9 !important; color: #333 !important; font-size: 16px !important; line-height: 1.6 !important; } .reading-mode-active p, .reading-mode-active div { max-width: 800px !important; margin: 0 auto !important; padding: 10px 20px !important; } /* 拖动功能 */ .draggable { cursor: move; } `); } // 创建用户界面 createUI() { // 主按钮 const btn = document.createElement('div'); btn.id = 'miaoke-helper-btn'; btn.innerHTML = '🐱'; btn.title = '喵课助手'; document.body.appendChild(btn); // 主面板 const panel = document.createElement('div'); panel.id = 'miaoke-helper-panel'; panel.innerHTML = `

喵课助手 - ${this.siteName}

×
学习辅助功能
阅读模式
笔记工具
速度调节
自动下一章
喵课资源推荐
邀请码: 0000 必填
网课自动化解决方案: 访问
更多学习工具: 查看
`; document.body.appendChild(panel); // 笔记面板 const notePanel = document.createElement('div'); notePanel.id = 'note-panel'; notePanel.innerHTML = `
学习笔记 ×
`; document.body.appendChild(notePanel); } // 初始化功能 initFeatures() { // 获取保存的笔记 const savedNote = GM_getValue('miaoke_helper_note_' + window.location.href, ''); if (savedNote) { document.querySelector('.note-textarea').value = savedNote; } // 获取保存的设置 const savedSpeed = GM_getValue('miaoke_helper_speed', 1.5); document.getElementById('play-speed').value = savedSpeed; } // 绑定事件 bindEvents() { const self = this; // 主按钮点击 document.getElementById('miaoke-helper-btn').addEventListener('click', function() { const panel = document.getElementById('miaoke-helper-panel'); panel.style.display = panel.style.display === 'none' || panel.style.display === '' ? 'block' : 'none'; }); // 关闭按钮 document.querySelectorAll('.helper-close').forEach(function(el) { el.addEventListener('click', function() { this.closest('#youth-helper-panel, #note-panel').style.display = 'none'; }); }); // 阅读模式 document.getElementById('reading-mode').addEventListener('click', function() { this.classList.toggle('active'); document.body.classList.toggle('reading-mode-active'); }); // 笔记工具 document.getElementById('take-notes').addEventListener('click', function() { document.getElementById('note-panel').style.display = 'block'; }); // 保存笔记 document.querySelector('.note-save').addEventListener('click', function() { const noteContent = document.querySelector('.note-textarea').value; GM_setValue('miaoke_helper_note_' + window.location.href, noteContent); alert('笔记已保存!'); }); // 速度调节 document.getElementById('speed-control').addEventListener('click', function() { this.classList.toggle('active'); const speedSettings = document.getElementById('speed-settings'); speedSettings.style.display = speedSettings.style.display === 'none' ? 'block' : 'none'; }); // 应用速度 document.getElementById('apply-speed').addEventListener('click', function() { const speedValue = parseFloat(document.getElementById('play-speed').value); GM_setValue('miaoke_helper_speed', speedValue); self.applyVideoSpeed(speedValue); alert(`已将视频速度设为 ${speedValue}x`); }); // 自动下一章 document.getElementById('auto-next').addEventListener('click', function() { this.classList.toggle('active'); if (this.classList.contains('active')) { self.enableAutoNext(); alert('已开启自动下一章功能'); } else { self.disableAutoNext(); alert('已关闭自动下一章功能'); } }); // 拖动功能 this.enableDrag(document.querySelectorAll('.draggable')); } // 设置视频速度 applyVideoSpeed(speed) { const videos = document.querySelectorAll('video'); videos.forEach(video => { video.playbackRate = speed; }); // 持续应用速度(防止视频网站重置) if (this.speedInterval) { clearInterval(this.speedInterval); } this.speedInterval = setInterval(() => { const videos = document.querySelectorAll('video'); videos.forEach(video => { if (video.playbackRate !== speed) { video.playbackRate = speed; } }); }, 1000); } // 启用自动下一章 enableAutoNext() { if (this.autoNextInterval) { clearInterval(this.autoNextInterval); } this.autoNextInterval = setInterval(() => { const videos = document.querySelectorAll('video'); videos.forEach(video => { if (video.ended) { this.findAndClickNextButton(); } }); }, 2000); } // 禁用自动下一章 disableAutoNext() { if (this.autoNextInterval) { clearInterval(this.autoNextInterval); this.autoNextInterval = null; } } // 寻找并点击下一章按钮 findAndClickNextButton() { // 针对不同平台查找下一章按钮 let nextBtn = null; // 超星学习通 if (this.siteName === '超星学习通') { nextBtn = document.querySelector('.ans-job-icon[title="下一章"]') || document.querySelector('.nextChapter'); } // 智慧树 else if (this.siteName === '智慧树') { nextBtn = document.querySelector('.next-page-btn') || document.querySelector('.next-btn'); } // 智慧职教 else if (this.siteName === '智慧职教') { nextBtn = document.querySelector('.next_lesson') || document.querySelector('.next-lesson'); } // 其他平台的通用选择器 else { const possibleSelectors = [ '.next', '.next-btn', '.next-lesson', '.nextChapter', '[title="下一章"]', '[title="下一节"]', '[title="下一讲"]', 'a:contains("下一章")', 'a:contains("下一节")' ]; for (let selector of possibleSelectors) { nextBtn = document.querySelector(selector); if (nextBtn) break; } } if (nextBtn) { nextBtn.click(); console.log('已自动跳转至下一章'); } } // 启用拖动功能 enableDrag(elements) { elements.forEach(el => { el.addEventListener('mousedown', (e) => { const target = el.closest('#miaoke-helper-panel, #note-panel, #miaoke-helper-btn'); if (!target) return; // 初始位置 const initialX = e.clientX; const initialY = e.clientY; const startLeft = target.offsetLeft; const startTop = target.offsetTop; // 移动处理函数 const moveHandler = (e) => { const dx = e.clientX - initialX; const dy = e.clientY - initialY; target.style.left = startLeft + dx + 'px'; target.style.top = startTop + dy + 'px'; }; // 释放处理函数 const upHandler = () => { document.removeEventListener('mousemove', moveHandler); document.removeEventListener('mouseup', upHandler); }; document.addEventListener('mousemove', moveHandler); document.addEventListener('mouseup', upHandler); }); }); } } // 页面加载完成后初始化 window.addEventListener('load', () => { // 延迟一点时间确保页面元素都已加载 setTimeout(() => { window.miaokeHelper = new MiaoKeHelper(); }, 1500); }); })();