// ==UserScript== // @name 北京市继续医学教育全员必修课培训刷课脚本 // @namespace https://jiaobenmiao.com/ // @version 1.0 // @description 该油猴脚本用于北京市继续医学教育全员必修课培训的辅助看课,脚本功能如下:在课程目录自动学习未学习的课程,自动播放视频,视频结束后播放下一视频 // @author 脚本喵 // @match https://bjsqypx.haoyisheng.com/* // @icon https://jiaobenmiao.com/img/logo2.jpg // @license MIT // @grant GM_setValue // @grant GM_getValue // ==/UserScript== (function () { 'use strict'; setTimeout(function () { if (location.href.indexOf("?course_id=") != -1 && document.querySelectorAll(".table_checkbox").length > 0) { let courseIndexPageUrl = location.href GM_setValue("courseIndexPageUrl", courseIndexPageUrl) nextVideo() } }, 2500) function nextVideo() { for (let i = 0; i < document.querySelectorAll("tbody tr").length; i++) { let trEle = document.querySelectorAll("tbody tr")[i] if (trEle.innerText.indexOf("未学习") != -1) { trEle.querySelector("a").click() break } } } setTimeout(function () { if (document.querySelectorAll("video").length > 0) { var video = document.querySelectorAll("video")[0] if (video.paused && !video.ended) { video.play() } setInterval(function () { if (video.ended) { location.href = GM_getValue("courseIndexPageUrl") } }, 5000) } }, 2500) })();