您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
云学堂视频播放 文档浏览
当前为
// ==UserScript== // @name 云学堂全自动刷视频 yunxuetang.cn // @namespace zhou__jianlei // @version 0.15.3 // @description 云学堂视频播放 文档浏览 // @author zhou__jianlei // @icon https://picobd.yxt.com/orgs/yxt_malladmin/mvcpic/image/201811/71672740d9524c53ac3d60b6a4123bca.png // @match http*://*.yunxuetang.cn/plan/*.html // @match http*://*.yunxuetang.cn/kng/*/document/* // @match http*://*.yunxuetang.cn/kng/*/video/* // @match http*://*.yunxuetang.cn/kng/plan/package/* // @match http*://*.yunxuetang.cn/kng/view/package/* // @match http*://*.yunxuetang.cn/kng/course/package/video/* // @match http*://*.yunxuetang.cn/kng/course/package/document/* // @match http*://*.yunxuetang.cn/sty/index.htm // @match http*://*.yunxuetang.cn/exam/test/examquestionpreview.htm* // @match http*://*.yunxuetang.cn/exam/exampreview.htm* // @match http*://*.yunxuetang.cn/exam/test/userexam.htm* // @match http*://*.yunxuetang.cn/exam/viewexamresult.htm* // @match http*://*.yunxuetang.cn/kng/*.htm* // @grant GM_xmlhttpRequest // @grant unsafeWindow // @require https://cdn.bootcdn.net/ajax/libs/blueimp-md5/2.18.0/js/md5.min.js // ==/UserScript== (function () { const path = window.location.pathname; const href = window.location.href; const date = new Date(); //变量名 常量 视频播放暂停次数 const NUMBER_OF_VIDEO_PLAYBACK_PAUSES = 'numberOfVideoPlaybackPauses'; // 考试自动提交key const AUTO_SUBMIT_KEY = "auto_submit"; // 课程包URL地址 key const COURSE_PACKAGE_URL_ADDRESS_KEY = "kng_href_key"; //自动提交考试 true initAutoSubmit(); // 初始化考试自动提交 function initAutoSubmit() { localStorage.setItem(AUTO_SUBMIT_KEY, false) } //任务列表页 if (path.match(/^\/plan.*/g)) { console.log('学习任务列表页...'); $('.w-150').each(function (index, item) { let text = $(item).children('.text-grey').eq(1).text(); console.log('任务' + (index + 1) + ', 播放进度:' + text); if (text.includes('%') && text !== '100%') { console.log('点击这个未播放完成的'); window.setTimeout(function () { let str = $(item).parents('.hand').eq(0).attr('onclick') + ''; let arr = str.split("'"); console.info(arr[1]); window.open(arr[1], '_self'); }, 10 * 1000); return false; } }); } else if (path.match(/^\/kng\/.*\/document.*/g) || path.match(/^\/kng\/course\/package\/document.*/g)) { //文档页 console.log('文档页准备就绪...'); window.setInterval(function () { //检测在线 detectionOnline(); //防作弊 checkMoreOpen(); //完成度检测 detectionComplete(); }, 30 * 1000); } else if (path.match(/^\/kng\/.*\/video.*/g) || path.match(/^\/kng\/course\/package\/video.*/g)) { //视频页 console.log('视频页准备就绪...'); //每30秒检测一次 window.setInterval(function () { //检测在线 detectionOnline(); //防作弊 checkMoreOpen(); //检测播放状态 detectPlaybackStatus(); //完成度检测 detectionComplete(); }, 30 * 1000); } else if (path.match(/^\/kng\/\w*\/package.*/g)) { console.log('课程包明细页...'); let progress = $('#lblStudySchedule').text(); if (progress == '100') { let kng_href = getKngUrl(); layer.msg('已学习完成3秒后返回列表页:' + kng_href); window.setTimeout(function () { window.open(kng_href, '_self'); }, 3 * 1000) } else { // 3秒后点击开始学习按钮 layer.msg('3秒后开始学习'); window.setTimeout(function () { $('#btnStartStudy').click(); }, 3 * 1000) } } else if (path.match(/^\/kng\/.*/g)) { updateKngUrl(); $('.el-kng-bottom-detail').each( function (index, item) { let text = $(item).parent().children('div').eq(0).children('span').text(); console.log(text) if (text == '') { console.log(index + ' 点击这个未学习的'); let attr = $(item).children('div').eq(0).children('.text-normal').attr('onclick') + ''; window.setTimeout(function () { if (attr) { let arr = attr.split("'"); console.info('RUL链接: ' + arr[1]); window.open(arr[1], '_self'); } }, 1000 * 10); return false; } } ) } else if (path.match(/^\/sty.*/g)) { layer.msg('学习任务签到'); window.setTimeout(function () { signdata(); }, 1000 * 3); } else if (path.match(/^\/exam\/exampreview.*/g)) { console.log('开始考试页面...'); // let checkbox = '<input type="checkbox" name="auto_submit" id="auto_submit">'; // $("#btnTest").parent().append(checkbox); //获取考试是否自动提交 if (isAutoSubmit()) { if ($('#btnTest').val() == '开始考试') { layer.msg('自动提交,5秒后进入考试'); window.setTimeout(function () { goExam(); }, 1000 * 5); } else { let kng_href = getKngUrl(); layer.msg('已完成30秒后返回列表页:' + kng_href); window.setTimeout(function () { window.open(kng_href, '_self'); }, 30 * 1000) } } } else if (path.match(/^\/exam\/test\/userexam.*/g)) { console.log('考试页面...'); //获取考试是否自动提交 if (isAutoSubmit()) { layer.msg('3秒后 自动提交'); window.setTimeout(function () { //点击提交 $('#btnSubmit').click(); }, 1000 * 3); //获取id为myConfirm 的class中是否有hide 如果有的话就是显示弹窗 3秒后点击id为btnMyConfirm 的按钮 if ($("#myConfirm").hasClass("hide")) { console.log("点击id为btnMyConfirm 的按钮"); window.setTimeout(function () { $("#btnMyConfirm").click(); }, 1000 * 8); } } } else if (path.match(/^\/exam\/viewexamresult.*/g)) { console.log('考试结果页'); if (isAutoSubmit()) { // let kng_href = localStorage.getItem('kng_href_key') // layer.msg('已完成3秒后返回列表页:' + kng_href); window.setTimeout(function () { // window.open(kng_href,'_self'); //关闭当前页 window.close(); }, 3 * 1000) } } // 更新课程包地址 function updateKngUrl() { let kng_href = window.location.href; console.log('课程包地址:' + kng_href); localStorage.setItem(COURSE_PACKAGE_URL_ADDRESS_KEY, kng_href); } // 获取课程包地址 function getKngUrl() { return localStorage.getItem(COURSE_PACKAGE_URL_ADDRESS_KEY); } // 获取是否自动提交考试 function isAutoSubmit() { return localStorage.getItem(AUTO_SUBMIT_KEY); } // 修改开始自动提交 function setAutoSubmit(val) { localStorage.setItem(AUTO_SUBMIT_KEY, val === true ? true : false); } //检测多开弹窗 function checkMoreOpen() { console.debug('检测多开弹窗'); //不知道这个还有没有用 if ($("#dvSingleTrack").length) { console.log("防止多开作弊 弹窗"); StartCurStudy(); } //确认文档弹窗是这个了 if ($("#dvHeartTip").length) { console.log("文档页面 正在学习 弹窗"); learnKng(); } } //在线检测 function detectionOnline() { const date = new Date(); var dom = document.getElementById("dvWarningView"); console.info(date.toLocaleString() + ' 检测是否有弹窗...'); if (dom) { console.debug('弹窗出来了'); const cont = dom.getElementsByClassName("playgooncontent")[0].innerText; if (cont.indexOf("请不要走开喔") != -1) { document.getElementsByClassName("btnok")[1].click(); } else { //没遇到过这种情况 不能处理了 返回上一级 console.error('没遇到过这种情况 不能处理了, 弹窗内容:' + cont); window.setTimeout(function () { //刷新当前页吧 window.location.reload(); }, 5 * 1000) } } } //检测完成(进度100%) function detectionComplete() { const percentage = $('#ScheduleText').text(); console.log('进度百分比: ' + percentage); if (percentage == '100%') { // 根据这个 <span id="divGoBack" style="display: none;" class="iconfont hand icon-fanhui d-in-block font-size-16" onclick="GoBack();"></span> 获取style的display的属性值 if (document.getElementById("divGoBack").style.display == 'none') { console.log("返回前一页"); window.history.back(); } else { console.log("返回上一级"); GoBack(); } } } //检测播放状态 function detectPlaybackStatus() { let numberOfVideoPlaybackPauses = getVideoPauseTimes(); console.info('视频暂停次数:' + numberOfVideoPlaybackPauses) const date = new Date(); console.info(date.toLocaleString() + ' 检测播放状态...') if (myPlayer.getState() == 'playing') { myPlayer.setPlaybackRate(2); initVideoPauseTimes(); console.log("播放中...啥也不操作了"); } else if (myPlayer.getState() == 'paused') { //暂停 console.log("暂停啦!!!"); videoPauseTimesInc(); if (numberOfVideoPlaybackPauses > 5) { console.log("暂停次数过多,自动刷新页面"); initVideoPauseTimes(); window.location.reload(); } myPlayer.play(); console.log("开始播放~"); } else if (myPlayer.getState() == 'complete') { console.log($('#lblTitle').text() + "播放完成!!!"); //返回上一级 GoBack(); } } //初始化视频暂停次数 function initVideoPauseTimes() { localStorage.setItem(NUMBER_OF_VIDEO_PLAYBACK_PAUSES, 0) } //获取视频暂停次数 function getVideoPauseTimes() { return localStorage.getItem(NUMBER_OF_VIDEO_PLAYBACK_PAUSES) || 0 } //视频暂停次数自增 function videoPauseTimesInc() { localStorage.setItem(NUMBER_OF_VIDEO_PLAYBACK_PAUSES, getVideoPauseTimes() + 1) } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址