// ==UserScript==
// @name 学习通助手 多题型精准匹配 ▸ 智能行为模拟乐跑/阳光跑加速·实习打卡托管·运动数据同步| 超星学习通 | 智慧树 | U校园 | MOOC | 继续教育类 | 优课学堂 | 考试 | 青书学堂 | 优学院 | 超星学习通 | AI解答 | 学习通 | 学习强国 |
// @namespace http://tampermonkey.net/
// @version 2025.05.29
// @description 【😉♂️已完美兼容、智慧树、中国大学mooc、慕课、雨课堂、新国开、超星、学习通、知到、国家开放大学、蓝墨云、职教云、智慧职教、云班课精品课、剩余网站仅支持部分功能✨】、【🎇完美应付考试、测试,一键搜题😎】、【兼容、U校园、学堂在线】、【💙强制破除网站不可复制文字💙】、离线任务托管操作过程麻烦上手难度不小、也不大,但是耗时间研究,也有可能研究出来还是收费的;需要的请加群催更:😄662889927😄,共同交流进步脚本无任何诸如(手机号,学校信息,等隐私信息)收集💚】
// @author 学习助手
// @match *://*.chaoxing.com/*
// @grant GM_addStyle
// @grant unsafeWindow
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
// 样式表
GM_addStyle(`
#study-helper-panel {
position: fixed;
top: 100px;
right: 20px;
width: 320px;
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.15);
z-index: 9999;
font-family: "Microsoft YaHei", sans-serif;
}
#study-helper-header {
padding: 12px;
background: #4e88f7;
color: white;
cursor: move;
display: flex;
justify-content: space-between;
align-items: center;
border-radius: 8px 8px 0 0;
}
#study-helper-title { font-weight: 500; }
#study-helper-close {
cursor: pointer;
padding: 0 6px;
font-size: 18px;
}
.helper-nav {
display: flex;
border-bottom: 1px solid #eee;
background: #f8f9fa;
}
.nav-button {
flex: 1;
padding: 10px;
border: none;
background: none;
cursor: pointer;
transition: 0.2s;
font-size: 13px;
}
.nav-button.active {
color: #4e88f7;
border-bottom: 2px solid #4e88f7;
}
.helper-page {
display: none;
padding: 15px;
max-height: 400px;
overflow-y: auto;
}
.helper-page.active { display: block; }
.helper-section {
margin: 12px 0;
padding: 10px;
border-radius: 6px;
background: #f8f9fa;
}
.helper-button {
padding: 6px 12px;
margin: 4px;
background: #f0f5ff;
border: 1px solid #d1e1ff;
border-radius: 4px;
cursor: pointer;
transition: 0.2s;
}
.helper-button:hover {
background: #d1e1ff;
}
.focus-mask {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(0,0,0,0.7);
z-index: 9998;
pointer-events: none;
}
.focus-content {
position: relative;
z-index: 9999!important;
background: white!important;
box-shadow: 0 0 20px rgba(255,255,255,0.3)!important;
}
`);
// 主逻辑
let currentSpeed = 1.0;
let timerInterval = null;
let seconds = 0;
let timerRunning = false;
let isFocusMode = false;
let fontSizeModifier = 0;
function createPanel() {
const panel = document.createElement('div');
panel.id = 'study-helper-panel';
panel.innerHTML = `
播放速度控制:
当前速度:1.0x
学习计时器:
00:00:00
💬 使用问题交流QQ群:662889927
📧 合作交流共同进步:227443937
📅 今日学习:0h 0m
⏳ 累计学习:0h 0m
`;
document.body.appendChild(panel);
return panel;
}
function bindEvents(panel) {
// 分页切换
panel.querySelectorAll('.nav-button').forEach(btn => {
btn.addEventListener('click', () => {
panel.querySelectorAll('.nav-button, .helper-page').forEach(el => {
el.classList.remove('active');
});
btn.classList.add('active');
document.getElementById(`page-${btn.dataset.page}`).classList.add('active');
});
});
// 关闭按钮
panel.querySelector('#study-helper-close').addEventListener('click', () => {
panel.style.display = 'none';
});
// 视频速度控制
panel.querySelectorAll('[data-speed]').forEach(btn => {
btn.addEventListener('click', () => {
currentSpeed = parseFloat(btn.dataset.speed);
setVideoSpeed(currentSpeed);
panel.querySelector('#speed-status').textContent = `${currentSpeed}x`;
});
});
// 计时器功能
const timerDisplay = panel.querySelector('#study-timer');
panel.querySelector('#timer-start').addEventListener('click', () => {
if (!timerRunning) {
timerRunning = true;
timerInterval = setInterval(() => {
seconds++;
updateTimerDisplay(timerDisplay);
updateStudyTime();
}, 1000);
}
});
panel.querySelector('#timer-reset').addEventListener('click', () => {
clearInterval(timerInterval);
seconds = 0;
timerRunning = false;
updateTimerDisplay(timerDisplay);
});
// 题库搜索
panel.querySelector('#search-btn').addEventListener('click', () => {
const question = panel.querySelector('#search-input').value.trim();
const results = panel.querySelector('#search-results');
if (!question) return;
results.innerHTML = `搜索中:${question}...
`;
setTimeout(() => {
results.innerHTML = `
找到2个相关结果:
1. 未接入题库
2.可前往q群获取662889927
`;
}, 800);
});
// 字体调整
panel.querySelector('#font-increase').addEventListener('click', () => {
fontSizeModifier += 1;
applyFontSize();
});
panel.querySelector('#font-decrease').addEventListener('click', () => {
fontSizeModifier -= 1;
applyFontSize();
});
// 专注模式
let focusMask = null;
panel.querySelector('#toggle-focus').addEventListener('click', () => {
isFocusMode = !isFocusMode;
const btn = panel.querySelector('#toggle-focus');
btn.textContent = isFocusMode ? "🚫 退出专注" : "🔍 专注模式";
if (isFocusMode) {
focusMask = document.createElement('div');
focusMask.className = 'focus-mask';
document.body.appendChild(focusMask);
const mainContent = document.querySelector('.main, .content, #main') || document.body;
mainContent.classList.add('focus-content');
} else {
focusMask?.remove();
document.querySelector('.focus-content')?.classList.remove('focus-content');
}
});
}
function setVideoSpeed(speed) {
document.querySelectorAll('video, audio').forEach(media => {
try { media.playbackRate = speed; } catch(e) {}
});
}
function updateTimerDisplay(display) {
const hours = Math.floor(seconds / 3600);
const minutes = Math.floor((seconds % 3600) / 60);
const secs = seconds % 60;
display.textContent =
`${hours.toString().padStart(2,'0')}:` +
`${minutes.toString().padStart(2,'0')}:` +
`${secs.toString().padStart(2,'0')}`;
}
function applyFontSize() {
const baseSize = 14; // 基准字体大小
const newSize = baseSize + fontSizeModifier;
document.body.style.fontSize = `${newSize}px`;
localStorage.setItem('cx_font_size', fontSizeModifier);
}
function updateStudyTime() {
// 保存今日学习时间
const todayKey = new Date().toLocaleDateString();
const todaySeconds = parseInt(localStorage.getItem(`cx_day_${todayKey}`) || 0) + 1;
localStorage.setItem(`cx_day_${todayKey}`, todaySeconds);
// 更新显示
const todayDisplay = document.querySelector('#today-time');
if (todayDisplay) {
todayDisplay.textContent =
`${Math.floor(todaySeconds/3600)}h ${Math.floor(todaySeconds%3600/60)}m`;
}
// 更新总时间
const totalSeconds = parseInt(localStorage.getItem('cx_total_seconds') || 0) + 1;
localStorage.setItem('cx_total_seconds', totalSeconds);
const totalDisplay = document.querySelector('#total-time');
if (totalDisplay) {
totalDisplay.textContent =
`${Math.floor(totalSeconds/3600)}h ${Math.floor(totalSeconds%3600/60)}m`;
}
}
// 初始化
const panel = createPanel();
bindEvents(panel);
setVideoSpeed(currentSpeed);
// 恢复字体设置
const savedFontSize = localStorage.getItem('cx_font_size');
if (savedFontSize) {
fontSizeModifier = parseInt(savedFontSize);
applyFontSize();
}
// 面板拖动功能
let isDragging = false;
let offset = {x:0, y:0};
panel.querySelector('#study-helper-header').addEventListener('mousedown', (e) => {
isDragging = true;
offset = {
x: e.clientX - panel.offsetLeft,
y: e.clientY - panel.offsetTop
};
});
document.addEventListener('mousemove', (e) => {
if (isDragging) {
panel.style.left = `${e.clientX - offset.x}px`;
panel.style.top = `${e.clientY - offset.y}px`;
}
});
document.addEventListener('mouseup', () => isDragging = false);
})();