// ==UserScript== // @name 国家食品药品安全专业技术人员培训网|使用说明:http://doc.zhanyc.cn/pages/gjsya/ // @namespace free // @version 1.0 // @description 当前是免费版本,只包含了解除视频暂停限制和评估答题功能。如需自动下一集、自动换课程、考试答题等高级功能可升级付费版本|接各类脚本开发、代挂任务,微信:zhanyc_cn 个人网站:http://doc.zhanyc.cn // @include *://*.gwypx.com.cn/* // @include *://*.nmpaied.com/* // @grant GM_addStyle // @run-at document-end // @require http://libs.baidu.com/jquery/2.0.0/jquery.min.js // @antifeature payment // @license Creative Commons // ==/UserScript== (function () { let docUrl = "http://doc.zhanyc.cn/pages/gjsya/"; let yxk = { pageData: { videoTimer: null, videoEl: null, }, async init() { console.log("%c [免费版] init", "background:rgb(0,0,0);color:#fff"); yxk.addStyle(); yxk.showFloatPanel(); yxk.runByUrl(location.href); }, async runByUrl(url) { if (url.includes("/model/media.htm") || url.includes("/video_play?")) { yxk.page_video(); } else if ( url.includes("/pc/index.htm") && url.includes("assess_list") || url.includes("/pc/#/assess_list?") ) { yxk.page_assess_list(); } }, async page_video() { console.log("%c [免费版] page_video", "background:rgb(0,0,0);color:#fff"); await yxk.waitFor(() => $("video").length > 0, 1000, 60); await yxk.sleep(1000); yxk.setupVideoPanel(); yxk.pageData.videoTimer = setInterval(async () => { try { let video = yxk.getVideo(); if (!video) return; video.volume = 0; let curTime = video.currentTime; let totalTime = video.duration; let title = `进度:${curTime.toFixed(0)}/${totalTime.toFixed(0)}`; $("title").text(title); yxk.updateVideoProgress(curTime, totalTime); // 处理"是否继续学习"弹窗 let $continueBtn = yxk.findElByText($(".el-dialog__body"), "是否继续学习?"); if ($continueBtn != null) { $continueBtn.next().find("button").click(); } // 处理"实时在线学习"弹窗 let $onlineTips = yxk.findElByText( ".layui-layer-content p", "您好,本平台要求实时在线学习,点击按钮,继续学习课程。" ); if ($onlineTips != null) { $onlineTips.parents(".layui-layer").find(".layui-layer-btn0")[0].click(); } // 检查播放是否完成 if (totalTime > 0 && curTime + 5 >= totalTime) { yxk.updateFloatContent('