超星学习通辅助||视频/答题自动切换

用于辅助超星学习通插件,使得能够进行自动切换视频,观看完视频自动切换答题

  1. // ==UserScript==
  2. // @name 超星学习通辅助||视频/答题自动切换
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description 用于辅助超星学习通插件,使得能够进行自动切换视频,观看完视频自动切换答题
  6. // @author chic1018
  7. // @match *://*.chaoxing.com/*
  8. // ==/UserScript==
  9.  
  10. !function(){
  11. 'use strict';
  12. function loop(){
  13. setTimeout(()=>{
  14. if (window.self !== window.top){
  15. return;
  16. }
  17. let videoElem;
  18. videoElem = document.querySelector('#iframe').contentDocument.querySelector('iframe').contentDocument.querySelector('#video_html5_api');
  19. if (!videoElem){
  20. return;
  21. }
  22. let videoLi = document.querySelectorAll('.posCatalog_name');
  23. let videoCu = document.querySelector('.posCatalog_active span');
  24. let videoNext;
  25. for (let i=0,len=videoLi.length;i < len;i++){
  26. if (videoLi[i] == videoCu){
  27. videoNext = videoLi[i+1];
  28. break;
  29. }
  30. }
  31. function AnsQues(){
  32. let check = setInterval(()=>{
  33. try{
  34. let text = document.querySelector('iframe').contentDocument.querySelector('iframe').contentDocument.querySelector('iframe').contentDocument.querySelector('body > div:last-child').innerText;
  35. if (text.slice(0,5) === '答题已完成'){
  36. clearInterval(check);
  37. document.querySelector('iframe').contentDocument.querySelector('iframe').contentDocument.querySelector('iframe').contentDocument.querySelector('.Btn_blue_1').click()
  38. setTimeout(()=>{
  39. document.querySelector('iframe').contentDocument.querySelector('iframe').contentDocument.querySelector('iframe').contentDocument.querySelector('#confirmSubWin .bluebtn').click()
  40. setTimeout(()=>{
  41. videoNext.click();
  42. if (videoNext != videoLi[videoLi.length-1]){
  43. loop();
  44. }
  45. },2000)
  46. },50)
  47. return;
  48. }
  49. else if (text.match('题目待完善')){
  50. clearInterval(check);
  51. videoNext.click();
  52. if (videoNext != videoLi[videoLi.length-1]){
  53. loop();
  54. }
  55. return;
  56. }
  57. }
  58. catch{
  59. }
  60. },2000)
  61. }
  62. let jobLeft;
  63. try {
  64. jobLeft = document.querySelector('.posCatalog_active input').value;
  65. }
  66. catch {
  67. videoNext.click();
  68. if (videoNext != videoLi[videoLi.length-1]){
  69. loop();
  70. }
  71. return;
  72. }
  73. if (jobLeft == 2){
  74. videoElem.onended = ()=>{
  75. document.querySelector('#dct2').click();
  76. setTimeout(AnsQues,2000);
  77. }
  78. }
  79. else if (jobLeft == 1){
  80. if (!document.querySelector('#iframe').contentDocument.querySelector('.ans-job-finished')){
  81. videoElem.onended = videoNext.click();
  82. }
  83. else {
  84. document.querySelector('#dct2').click();
  85. setTimeout(AnsQues,2000);
  86. }
  87. }
  88. },5000);
  89. }
  90. loop();
  91. }();

QingJ © 2025

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