// ==UserScript== // @name 教师研修助手 // @namespace http://tampermonkey.net/ // @version 1.0 // @description 教师研修网,定时检测视频是否暂停播放并自动继续播放,定时检测视频是否停止播放并切换当前课程下的下一个视频 // @author Ccc // @icon http://i.yanxiu.com/favicon.ico // @match *://i.yanxiu.com/uft/course/* // @require https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; var playButton = document.getElementsByClassName('vjs-control-bar')[0].childNodes[0]; setInterval(function() { //检测视频是否暂停播放并自动继续播放 if (playButton && playButton.title === 'Play') { playButton.click() } //检查是否播放完毕,完毕则切换下一个视频 if (playButton && playButton.title === 'Replay') { var videos = document.getElementsByClassName('doc_tit video'); var currentVideo = document.getElementsByClassName('doc_tit video click video_focus'); var currentIndex = 0; var video; var index; for(var i= 0;i< videos.length;i++) { if(videos[i].getAttribute("href") === currentVideo[0].getAttribute("href")) { currentIndex = i; break; } } currentIndex++; currentIndex = currentIndex < videos.length ? currentIndex : 0; videos[currentIndex].click(); } }, 5000); })();