深圳市教师教育网刷课脚本分享
深圳市教师教育网
# 脚本介绍
该油猴脚本用于 深圳市教师教育网 的辅助看课,使用JavaScript编写,适配网址:https://www.0755tt.com/
脚本功能如下:
- 视频自动播放
- 解除视频倍速限制
- 自动完成答题环节
- 自动跳过广告
- 防止页面挂机检测
脚本安装地址:
暂时下架
如果不会安装脚本,请按照下面安装教程来操作。
# 代学服务
提示
如需代学,请联系客服,支持闲鱼交易。

微信联系:yizhituziang

QQ联系:2422270452
- img: /img/weixin.jpg
name: 微信联系:yizhituziang
- img: /img/qq.jpg
name: QQ联系:2422270452
# 安装教程
# 1.安装浏览器扩展插件
首先需要给我们的浏览器安装上脚本猫插件,这是运行所有用户脚本的基础,如果浏览器已经安装过了脚本猫或者油猴插件,那么可以跳过这一步。推荐使用edge浏览器,安装插件更方便。
浏览器打开网址:https://docs.scriptcat.org/ (opens new window)
这里用edge浏览器作为示范,点击 "添加到Edge浏览器"

接着点击 "获取"

在右上角弹出的窗口,点击 "添加扩展"

等待几秒钟,会提示已经安装好脚本猫插件了。

# 2.安装刷课脚本
打开脚本安装地址后,在页面点击 "安装脚本" 按钮,接着在弹出的窗口点击 "安装" ,之后就会提示"安装成功"。
# 3.体验脚本功能
安装脚本后,需要重新进入学习站点,如果之前已经打开课程学习页面,那么需要刷新页面后脚本才会生效。
# 核心代码
(function() {
'use strict';
const SCRIPT_NAME = '深圳市教师教育网刷课脚本';
const VERSION = '2.0.0';
const DEBUG = true;
function debug(...args) {
if (DEBUG) {
console.log(`[${SCRIPT_NAME}]`, ...args);
}
}
debug(`${SCRIPT_NAME} v${VERSION} 已加载`);
const originalCreateElement = document.createElement;
let videoElements = [];
let adDetected = false;
function init() {
bypassVisibilityDetection();
monitorVideoElements();
autoAnswerQuestions();
skipAds();
simulateUserActivity();
setupKeyboardShortcuts();
overrideVideoControls();
}
function bypassVisibilityDetection() {
const originalAddEventListener = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function(type, listener, options) {
if (type === 'visibilitychange' || type === 'pagehide' || type === 'blur') {
debug(`拦截了 ${type} 事件`);
return;
}
return originalAddEventListener.call(this, type, listener, options);
};
Object.defineProperty(document, 'hidden', {
value: false,
writable: false,
configurable: false
});
Object.defineProperty(document, 'visibilityState', {
value: 'visible',
writable: false,
configurable: false
});
window.onblur = null;
window.onfocus = () => debug('窗口获得焦点');
debug('页面可见性检测已绕过');
}
function monitorVideoElements() {
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
mutation.addedNodes.forEach((node) => {
if (node.tagName === 'VIDEO') {
processVideo(node);
} else if (node.querySelectorAll) {
const videos = node.querySelectorAll('video');
videos.forEach(video => processVideo(video));
}
});
});
});
observer.observe(document.body, {
childList: true,
subtree: true
});
document.querySelectorAll('video').forEach(video => processVideo(video));
}
function processVideo(video) {
if (videoElements.includes(video)) return;
videoElements.push(video);
debug('发现新的视频元素');
video.muted = false;
video.volume = 1;
Object.defineProperty(video, 'playbackRate', {
configurable: true,
get: () => 2.0,
set: () => {}
});
video.addEventListener('pause', (e) => {
if (!adDetected) {
debug('视频被暂停,尝试恢复');
setTimeout(() => video.play(), 100);
}
});
video.addEventListener('ended', () => {
debug('视频播放结束,切换下一课');
goToNextLesson();
});
video.addEventListener('waiting', () => {
debug('视频缓冲中...');
});
if (video.paused) {
video.play().catch(err => debug('自动播放失败:', err));
}
setInterval(() => {
if (video.paused && !video.ended && !adDetected) {
video.play().catch(err => {});
}
}, 1000);
}
function autoAnswerQuestions() {
setInterval(() => {
const quizElements = document.querySelectorAll('.quiz, .question, .test');
quizElements.forEach(quiz => {
const options = quiz.querySelectorAll('input[type="radio"], input[type="checkbox"], button.option');
if (options.length > 0) {
debug('发现题目,自动选择答案');
const randomOption = options[Math.floor(Math.random() * options.length)];
if (randomOption.tagName === 'INPUT') {
randomOption.checked = true;
} else {
randomOption.click();
}
const submitBtn = quiz.querySelector('button[type="submit"], .submit-btn, .confirm-btn');
if (submitBtn) {
setTimeout(() => submitBtn.click(), 500);
}
}
});
}, 2000);
}
function skipAds() {
setInterval(() => {
const adSelectors = [
'.ad-container',
'.advertisement',
'.video-ad',
'.ad-overlay',
'.skip-ad',
'[class*="ad"]',
'[id*="ad"]'
];
adSelectors.forEach(selector => {
const ads = document.querySelectorAll(selector);
ads.forEach(ad => {
if (ad.offsetParent !== null) {
adDetected = true;
debug('检测到广告,尝试跳过');
const skipBtn = ad.querySelector('.skip-btn, [class*="skip"], button');
if (skipBtn) {
skipBtn.click();
}
ad.style.display = 'none';
ad.remove();
setTimeout(() => adDetected = false, 2000);
}
});
});
}, 500);
}
function simulateUserActivity() {
const activities = [
() => {
window.scrollBy(0, Math.random() * 10 - 5);
},
() => {
const x = Math.random() * window.innerWidth;
const y = Math.random() * window.innerHeight;
const event = new MouseEvent('mousemove', {
clientX: x,
clientY: y,
bubbles: true
});
document.dispatchEvent(event);
},
() => {
const event = new KeyboardEvent('keydown', {
key: 'Shift',
bubbles: true
});
document.dispatchEvent(event);
}
];
setInterval(() => {
const randomActivity = activities[Math.floor(Math.random() * activities.length)];
randomActivity();
debug('模拟用户活动');
}, 45000);
}
function goToNextLesson() {
const nextSelectors = [
'.next-lesson',
'.next-chapter',
'#next-btn',
'a[class*="next"]',
'button[class*="next"]'
];
for (const selector of nextSelectors) {
const nextBtn = document.querySelector(selector);
if (nextBtn && !nextBtn.disabled) {
debug('点击下一课按钮');
nextBtn.click();
return;
}
}
const lessons = document.querySelectorAll('.lesson-list li, .chapter-list li');
for (let i = 0; i < lessons.length; i++) {
if (lessons[i].classList.contains('active') || lessons[i].classList.contains('current')) {
if (lessons[i + 1]) {
debug('自动切换到下一课');
lessons[i + 1].click();
return;
}
}
}
}
function setupKeyboardShortcuts() {
document.addEventListener('keydown', (e) => {
if (e.ctrlKey && e.key === ' ') {
e.preventDefault();
const video = document.querySelector('video');
if (video) {
video.paused ? video.play() : video.pause();
}
}
if (e.ctrlKey && e.key === 'ArrowRight') {
e.preventDefault();
goToNextLesson();
}
});
}
function overrideVideoControls() {
const originalSetAttribute = Element.prototype.setAttribute;
Element.prototype.setAttribute = function(name, value) {
if (this.tagName === 'VIDEO' && (name === 'controls' || name === 'disablepictureinpicture')) {
debug(`拦截了视频 ${name} 属性设置`);
return;
}
return originalSetAttribute.call(this, name, value);
};
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
})();