// ==UserScript== // @name 自动学习 // @namespace http://play.hnzjpx.net/ // @version 0.15 // @description 自动切换,自动模拟鼠标移动--- 开放大学 // @author MEN // @match http://play.hnzjpx.net/** // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; // 483 -496 var tag =1 //换一段视频 function next_() { console.log("执行换视频事件!!!") window.location.href = window.location.href.replace(/[0-9][0-9][0-9]/,parseInt(window.location.href.match(/[0-9][0-9][0-9]/))+1); } //触发鼠标点击事件 function mouse_(){ console.log("执行鼠标事件") var evt = document.createEvent("MouseEvents"); evt.initMouseEvent("mousemove", false, false); document.dispatchEvent(evt); } //监听当前播放状态 function video_() { console.log("执行播放监听事件"+tag) if(tag === 0){ document.getElementById(document.getElementById("video").childNodes[0].childNodes[0].id).addEventListener("ended",next_()) } document.getElementById(document.getElementById("video").childNodes[0].childNodes[0].id).addEventListener("ended",function (){ console.log("播放可能结束,执行切换下一页事件") tag = 0; }) mouse_(); } setInterval(video_,30000) })();