网梯课堂助手————继续教育网课自动挂机脚本
网梯课堂助手————继续教育网课自动挂机脚本
自动挂机网梯课堂
- 功能
自动下一P,跳过作业、PPT、DOC等
屏蔽每30分钟的检查
1.5倍速挂视频
- 常见问题
屏蔽每30分钟的检查无效怎么办?
在油猴管理面板中找到本脚本,打开脚本设置,将位置改为1,运行时期改为document-start
自动下一P无效怎么办?
因为不同学校的网梯课堂使用的教学模板有一定的差异,没法做到通用的适配。
// ==UserScript==
// @name 网梯课堂助手————继续教育网课自动挂机脚本
// @namespace 1620535041@qq.com
// @version 1.6
// @description 自动挂机网梯课堂
// @homepage https://www.zhaofupeng.com/
// @author zfp123123
// @match *://*.webtrn.cn/learnspace/learn/learn/*/index.action*
// @run-at document-start
// @require https://greasyfork.org/scripts/18715-hooks/code/Hooks.js?version=661566
// @grant none
// @license MIT
// ==/UserScript==
function nextP(){
}
function findVideo(element){
if(!element) element = [window.document];
for(let item of element){
let document = item.nodeName === 'IFRAME' ? item.contentDocument : item;
let videos = document.querySelectorAll('video');
if(videos.length > 0){
return videos;
} else if (document.querySelectorAll('iframe').length > 0){
let res = findVideo(document.querySelectorAll('iframe'));
if(res) return res;
}
}
}
function autoPlay() {
const mainContent = document.getElementsByClassName('contentIframe')[0];
mainContent.addEventListener("load",function(){
const mainFrame = mainContent.contentDocument.getElementById("mainFrame");
mainFrame.addEventListener("load",function(){
const $ = window.jQuery;
//视频重新加载时再执行一次脚本
mainFrame.addEventListener("load",function(){autoPlay();});
if(location.pathname.indexOf('blue') > -1)
{
const menus = [...$(mainContent).contents().find(".vcon").find("li")]; //左侧菜单
const selectMenu = $(mainContent).contents().find(".vcon").find("li.select")[0]; //当前选中的菜单
const selectMenuIndex = menus.findIndex(e=>e===selectMenu); //当前选中菜单的游标
const nextBtn = $(mainContent).contents().find(".rtarr")[0]; //标签栏下一个按钮
const tabs = [...$(mainContent).contents().find(".menub")]; //标签栏
const selectTab = $(mainContent).contents().find(".menubu")[0]; //当前选中的标签
const selectTabIndex = tabs.findIndex(e=>e===selectTab); //当前选中标签的游标
nextP = function(){
if(tabs.length - selectTabIndex >1){
nextBtn.click();
}else if(menus.length - selectMenuIndex > 1){
menus[selectMenuIndex + 1].click();
$(menus[selectMenuIndex + 1]).find("a").click()
}
}
}else if(location.pathname.indexOf('templatethree') > -1 ||
location.pathname.indexOf('templateeight') > -1)
{
const menus = [...$(mainContent).contents().find(".s_point").filter("[itemtype='video']")];
const selectMenu = $(mainContent).contents().find(".s_pointerct")[0];
const selectMenuIndex = menus.indexOf(selectMenu);
nextP = function(){
if(menus.length - selectMenuIndex > 1){
menus[selectMenuIndex + 1].click();
}
}
}
let interval = setInterval(() => {
let videos = findVideo();
if(videos && videos.length > 0){
for(let v of videos){
v.addEventListener('ended',function(){
videoIntervals.forEach(e=>clearInterval(e));
nextP();
});
videoIntervals.push(setInterval(() => {
if( v.volume !== 0)
v.volume = 0;
if(v.playbackRate !== 1.5)
v.playbackRate = 1.5;
}, 100));
}
clearInterval(interval);
}
}, 100);
const studyType = $(mainFrame)[0].contentWindow._maq[11][1];
if(!(studyType !== 'video' || studyType !== 'courseware'))
{
nextP();
}
});
});
}
var videoIntervals =[];
(function() {
'use strict';
/**
* 关闭30分钟每次的检查
*/
Hooks.set(window, "jQuery", function ( target, propertyName, ignored, jQuery ) {
Hooks.method(jQuery, "studyTime", function ( target, methodName, method, thisArg, args ) {
args[0].clickAuth = false;
args[0].periodRemind = false;
args[0].randomRemind = false;
console.log('已关闭30分钟每次的检查');
return Hooks.Reply.method( arguments );
});
return Hooks.Reply.set( arguments );
});
document.addEventListener('DOMContentLoaded',function(){
autoPlay();
});
})();
打赏采用二维码方式。
