自动刷课v1

自动刷课

  1. // ==UserScript==
  2. // @name 自动刷课v1
  3. // @namespace 一品学堂,进入课程页面即可
  4. // @version 1.7
  5. // @description 自动刷课
  6. // @author 食翔狂魔
  7. // @match *zjdx-kfkc.webtrn.cn/learnspace/learn/learn/templateeight/index.action*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11. (function() {
  12. //'use strict';
  13. setTimeout(() => {
  14. console.log("四秒已过,开始运行。")
  15. window.index = 0;
  16.  
  17. function autoLearn() {
  18. window.vlist = $(".s_point[completestate='0']", $("#mainContent")[0].contentDocument);
  19. window.vlist[window.index].onclick();
  20. var video;
  21. setTimeout(() => {
  22. video = $("video", $("#mainContent")[0].contentDocument.getElementById("mainFrame").contentDocument)[0];
  23. video.volume=0;
  24. console.log("获取video。" + video);
  25. video.play();
  26. setTimeout(() => {
  27. console.log("定时下一视频播放");
  28. video.play();
  29. video.volume=0;
  30. if(window.index < window.vlist.length) {
  31. //window.index++;
  32. $("#mainContent")[0].contentWindow.location.reload()
  33. setTimeout(() => {
  34. autoLearn();
  35. }, 5000)
  36. }
  37. }, ((video.duration - video.currentTime) + 1) * 1000)
  38. }, 5000)
  39. }
  40. autoLearn();
  41. }, 4000);
  42. })();