// ==UserScript== // @name 校本通-信息技术2.0视频自动播放 // @namespace http://xbtxbtyx.xiaobentong.com/ // @version 0.1 // @description 校本通-信息技术2.0视频自动静音播放,播放完毕自动切换下一个 // @author 星星课 // @match http://xbtxbtyx.xiaobentong.com/autActivity/intoAutoStudy?courseCode=* // @icon http://xbtxbtyx.xiaobentong.com/favicon.ico // @grant none // @downloadURL none // ==/UserScript== function getUrlParam(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象 var r = window.location.search.substr(1).match(reg); //匹配目标参数 if (r != null) return unescape(r[2]); return null; //返回参数值 } function goNext() { var a_tags = $("a[class='flt']"); var next_course = false; for (var i = 0; i < a_tags.length; i += 1) { var a_tag = a_tags[i]; var course_cata_id = getUrlParam("courseCataId"); var href = $(a_tag).attr("href"); // console.log(course_id, href); if (next_course == true) { a_tag.click(); break } if (href.indexOf(course_cata_id) != -1) next_course = true; } } (function () { 'use strict'; setInterval(() => { var play_btn = $("#replaybtn"); var video = $("video").get(0); if (typeof (video) == "undefined") { goNext(); return; }; video.volume = 0; if (play_btn.attr("class") == "ccH5PlayBtn") { console.log("开始播放"); play_btn.click(); } if (play_btn.attr("class") == "adrPlayBtn") { console.log("已播放完毕"); goNext(); }; }, 5e3) })();