网梯课堂助手————继续教育网课自动挂机脚本

自动挂机网梯课堂

目前为 2020-09-09 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name 网梯课堂助手————继续教育网课自动挂机脚本
  3. // @namespace 1620535041@qq.com
  4. // @version 1.3
  5. // @description 自动挂机网梯课堂
  6. // @author zfp123123
  7. // @match http://*.webtrn.cn/learnspace/learn/learn/*/index.action*
  8. // @run-at document-start
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12. function nextP(){
  13.  
  14. }
  15.  
  16. function findVideo(element){
  17. if(!element) element = [window.document];
  18. for(let item of element){
  19. let document = item.nodeName === 'IFRAME' ? item.contentDocument : item;
  20. let videos = document.querySelectorAll('video');
  21. if(videos.length > 0){
  22. return videos;
  23. } else if (document.querySelectorAll('iframe').length > 0){
  24. let res = findVideo(document.querySelectorAll('iframe'));
  25. if(res) return res;
  26. }
  27. }
  28. }
  29.  
  30. function autoPlay() {
  31. const mainContent = document.getElementsByClassName('contentIframe')[0];
  32. mainContent.addEventListener("load",function(){
  33. const mainFrame = mainContent.contentDocument.getElementById("mainFrame");
  34. mainFrame.addEventListener("load",function(){
  35. const $ = window.jQuery;
  36. //视频重新加载时再执行一次脚本
  37. mainFrame.addEventListener("load",function(){autoPlay();});
  38. if(location.pathname.indexOf('blue') > -1)
  39. {
  40. const menus = [...$(mainContent).contents().find(".vcon").find("li")]; //左侧菜单
  41. const selectMenu = $(mainContent).contents().find(".vcon").find("li.select")[0]; //当前选中的菜单
  42. const selectMenuIndex = menus.findIndex(e=>e===selectMenu); //当前选中菜单的游标
  43.  
  44. const nextBtn = $(mainContent).contents().find(".rtarr")[0]; //标签栏下一个按钮
  45. const tabs = [...$(mainContent).contents().find(".menub")]; //标签栏
  46. const selectTab = $(mainContent).contents().find(".menubu")[0]; //当前选中的标签
  47. const selectTabIndex = tabs.findIndex(e=>e===selectTab); //当前选中标签的游标
  48.  
  49. nextP = function(){
  50. if(tabs.length - selectTabIndex >1){
  51. nextBtn.click();
  52. }else if(menus.length - selectMenuIndex > 1){
  53. menus[selectMenuIndex + 1].click();
  54. $(menus[selectMenuIndex + 1]).find("a").click()
  55. }
  56. }
  57. }else if(location.pathname.indexOf('templatethree') > -1)
  58. {
  59. //TODO
  60. }
  61.  
  62. let interval = setInterval(() => {
  63. let videos = findVideo();
  64. if(videos && videos.length > 0){
  65. for(let v of videos){
  66. v.addEventListener('ended',function(){
  67. videoIntervals.forEach(e=>clearInterval(e));
  68. nextP();
  69. });
  70. videoIntervals.push(setInterval(() => {
  71. if( v.volume !== 0)
  72. v.volume = 0;
  73. if(v.playbackRate !== 1.5)
  74. v.playbackRate = 1.5;
  75. }, 100));
  76. }
  77. clearInterval(interval);
  78. }
  79. }, 100);
  80.  
  81. const studyType = $(mainFrame)[0].contentWindow._maq[11][1];
  82. if(!(studyType !== 'video' || studyType !== 'courseware'))
  83. {
  84. nextP();
  85. }
  86.  
  87. });
  88. });
  89. }
  90.  
  91. var videoIntervals =[];
  92.  
  93. (function() {
  94. 'use strict';
  95. /**
  96. * 关闭30分钟每次的检查
  97. */
  98. document.addEventListener('DOMContentLoaded',function(){
  99. autoPlay();
  100. });
  101. window.addEventListener('load',function(){
  102. var timer = $("#learnTimer").learningTimer(courseId);
  103. $.studyTime({
  104. courseId:courseId,
  105. timeout:1,
  106. periodRemind : false,
  107. randomRemind : false,
  108. clickAuth : false,
  109. numAuth : false,
  110. imageAuth : false,
  111. timer : timer
  112. });
  113. });
  114. })();

QingJ © 2025

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