自动学习

自动切换,自动模拟鼠标移动--- 开放大学

目前为 2022-02-18 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name 自动学习
  3. // @namespace http://play.hnzjpx.net/
  4. // @version 0.1
  5. // @description 自动切换,自动模拟鼠标移动--- 开放大学
  6. // @author MEN
  7. // @match http://play.hnzjpx.net/**
  8. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // 483 -496
  17. var url_after = "http://play.hnzjpx.net/player/"
  18. var url_bfter = "/play?package_id=80"
  19. var id =483
  20. var tag =1
  21.  
  22.  
  23. //换一段视频
  24. function next_() {
  25. console.log("执行换视频事件!!!")
  26. var win_url = window.location.href
  27. id = win_url.substring(url_after.length,33)
  28. id = parseInt(id)+1
  29. win_url = "h"+win_url.substring(1,30)+id+win_url.substring(33,52)
  30. console.log("下一页地址:"+win_url)
  31. if(id != 497){
  32. window.location.href=win_url
  33. }
  34. }
  35.  
  36. //触发鼠标点击事件
  37. function mouse_(){
  38. console.log("执行鼠标事件")
  39. var evt = document.createEvent("MouseEvents");
  40. evt.initMouseEvent("mousemove", false, false);
  41. document.dispatchEvent(evt);
  42. }
  43.  
  44. function sleep(millisecond) {
  45. return new Promise(resolve => {
  46. setTimeout(() => {
  47. resolve()
  48. }, millisecond)
  49. })
  50. }
  51.  
  52. //监听当前播放状态
  53.  
  54. function video_() {
  55. console.log("执行播放监听事件"+tag)
  56. if(tag === 0){
  57. document.getElementById(document.getElementById("video").childNodes[0].childNodes[0].id).addEventListener("ended",next_())
  58. }
  59.  
  60. document.getElementById(document.getElementById("video").childNodes[0].childNodes[0].id).addEventListener("ended",function (){
  61. console.log("播放可能结束,执行切换下一页事件")
  62. tag = 0;
  63. })
  64. mouse_();
  65. }
  66. setInterval(video_,30000)
  67.  
  68. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址