河南省教育人才学会网络学院刷课脚本分享
河南省教育人才学会
# 脚本介绍
该油猴脚本用于 河南省教育人才学会网络学院 的辅助看课,使用JavaScript编写,适配网址:https://www.haetjxjy.com/defaultpc.html
脚本功能如下:
1.自动解除视频播放限制
2.智能检测并自动播放暂停的课程视频
3.防止页面切换导致的学习进度中断
4.屏蔽不必要的弹窗提示
5.优化视频播放体验
脚本安装地址:
暂时下架
如果不会安装脚本,请按照下面安装教程来操作。
# 代学服务
提示
如需代学,请联系客服,支持闲鱼交易。

微信联系: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';
console.log('河南省教育人才学会网络学院刷课脚本已启动');
let config = {
autoPlayInterval: 2000,
checkVideoInterval: 1000,
speed: 1.0,
verbose: true
};
let videoMonitorTimer = null;
let isInitialized = false;
function log(message) {
if (config.verbose) {
console.log('[河南教育人才脚本]', message);
}
}
function hijackEventListeners() {
const originalAddEventListener = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function(type, listener, options) {
const blockedTypes = [
'visibilitychange',
'blur',
'focusout',
'pagehide',
'beforeunload'
];
if (blockedTypes.includes(type)) {
log('已拦截事件类型: ' + type);
return;
}
return originalAddEventListener.call(this, type, listener, options);
};
log('事件监听器劫持完成');
}
function overrideDocumentVisibility() {
try {
Object.defineProperty(document, 'hidden', {
get: function() { return false; },
configurable: true
});
Object.defineProperty(document, 'visibilityState', {
get: function() { return 'visible'; },
configurable: true
});
Object.defineProperty(document, 'hasFocus', {
value: function() { return true; },
configurable: true
});
log('文档可见性属性已覆盖');
} catch (error) {
log('属性覆盖失败: ' + error.message);
}
}
function preventWindowBlur() {
window.onblur = null;
window.onfocusout = null;
window.onpagehide = null;
window.addEventListener('blur', function(e) {
e.stopPropagation();
e.stopImmediatePropagation();
return false;
}, true);
window.addEventListener('focusout', function(e) {
e.stopPropagation();
e.stopImmediatePropagation();
return false;
}, true);
log('窗口失焦防护已设置');
}
function findAndPlayVideos() {
const videoSelectors = [
'video',
'iframe video',
'.video-player video',
'#video-container video',
'[class*="video"] video',
'[id*="video"] video'
];
let foundVideo = false;
videoSelectors.forEach(selector => {
const videos = document.querySelectorAll(selector);
videos.forEach((video, index) => {
foundVideo = true;
if (video.paused) {
video.play().then(() => {
log('视频 ' + (index + 1) + ' 已自动播放');
}).catch(err => {
log('视频播放失败: ' + err.message);
});
}
if (video.muted) {
video.muted = false;
}
if (video.playbackRate !== config.speed) {
video.playbackRate = config.speed;
}
video.setAttribute('autoplay', 'true');
video.setAttribute('playsinline', 'true');
});
});
return foundVideo;
}
function closePopups() {
const popupSelectors = [
'.modal',
'.popup',
'.dialog',
'.alert',
'[class*="modal"]',
'[id*="modal"]',
'.el-dialog',
'.ant-modal'
];
popupSelectors.forEach(selector => {
const popups = document.querySelectorAll(selector);
popups.forEach(popup => {
const closeBtn = popup.querySelector(
'.close, .close-btn, [class*="close"], button'
);
if (closeBtn) {
closeBtn.click();
log('已关闭弹窗');
} else {
popup.style.display = 'none';
popup.style.visibility = 'hidden';
}
});
});
}
function setupVideoObserver() {
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.addedNodes.length > 0) {
const hasVideo = Array.from(mutation.addedNodes).some(node => {
return node.tagName === 'VIDEO' ||
(node.querySelectorAll && node.querySelectorAll('video').length > 0);
});
if (hasVideo) {
log('检测到新视频元素');
findAndPlayVideos();
}
}
});
});
observer.observe(document.body, {
childList: true,
subtree: true
});
log('DOM观察器已启动');
}
function autoClickNext() {
const nextSelectors = [
'.next-btn',
'.next-lesson',
'[class*="next"]',
'button:contains("下一课")',
'button:contains("下一")'
];
nextSelectors.forEach(selector => {
const nextBtn = document.querySelector(selector);
if (nextBtn && nextBtn.offsetParent !== null) {
log('找到下一课按钮');
}
});
}
function simulateUserActivity() {
const events = ['mousemove', 'keydown', 'click', 'scroll'];
setInterval(() => {
const randomEvent = events[Math.floor(Math.random() * events.length)];
const event = new Event(randomEvent, { bubbles: true });
document.dispatchEvent(event);
}, 30000);
log('用户活动模拟已启动');
}
function initializeScript() {
if (isInitialized) {
return;
}
log('开始初始化脚本...');
hijackEventListeners();
overrideDocumentVisibility();
preventWindowBlur();
setupVideoObserver();
simulateUserActivity();
setInterval(() => {
findAndPlayVideos();
closePopups();
autoClickNext();
}, config.autoPlayInterval);
isInitialized = true;
log('脚本初始化完成!');
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initializeScript);
} else {
initializeScript();
}
window.addEventListener('load', function() {
setTimeout(initializeScript, 1000);
});
})();