国家开发大学刷课

可以复制答案、刷课的强大插件

  1. // ==UserScript==
  2. // @name 国家开发大学刷课
  3. // @namespace http://tampermonkey.net/
  4. // @version 20230406.01
  5. // @description 可以复制答案、刷课的强大插件
  6. // @author xxx
  7. // @match https://*.ouchn.cn/*
  8. // @license GPL
  9.  
  10. // ==/UserScript==
  11.  
  12. //检测url变化
  13. window.onload = function() {
  14. if(document.addEventListener){
  15. document.addEventListener('DOMContentLoaded',answerCopy(),false)
  16. }
  17. nextButtonClick()
  18. window.onhashchange = function () {
  19. console.log('URL发生变化了');
  20. setTimeout(function(){
  21. init();
  22. },7500);
  23. };
  24. // 初始化函数
  25. function init() {
  26. playVideo()
  27.  
  28. }
  29. function previewcheck() {
  30. var viewbutton = $("a[previewer*='{uploads: uploads, currentFile: upload, activity: activity, canAddNote: true}']")[0];
  31. if(viewbutton != undefined) {
  32. viewbutton.click();
  33. setTimeout(function(){
  34. if ($("a[close-popup*='file-previewer-with-note']")[0] != undefined) { $("a[close-popup*='file-previewer-with-note']")[0].click() }
  35. },3000);
  36. }
  37. }
  38. //复制答案
  39. function answerCopy() {
  40.  
  41. setTimeout(function(){
  42. var url = window.location.pathname;
  43. if(url.indexOf("exam") >= 0 ) { //判断url对象文件名中是否包含post
  44. //已答题
  45. if( $("input[checked*='checked']")[0] != undefined ) {
  46. $("input[checked*='checked']").parent().parent().css('background-color', 'red');
  47. } else if ($("label[class*='answered-option']")[0] != undefined) {
  48. //注册(不可用)点击事件
  49. // 单线程问题? 所有需要用延时
  50. // $("label[style*='red']").css('background-color', '');
  51. $("label").css('background-color', '');
  52. //打上颜色
  53. $("label[class*='answered-option']").css('background-color', 'red');
  54. $('label').unbind('click').click(function() { //表示阻止向父元素冒泡
  55. setTimeout(function() {
  56. //清除所有颜色
  57. // $("label[style*='red']").css('background-color', '');
  58. $("label").css('background-color', '');
  59. //打上颜色
  60. $("label[class*='answered-option']").css('background-color', 'red');
  61. },50)
  62. })
  63. // $('input.ng-valid').unbind('click').click(function() { //表示阻止向父元素冒泡
  64. // alert('xxxx')
  65. // })
  66. }
  67. //未答题
  68. // $("label[style*='red']").css('background-color', '');
  69. // //现场选择
  70. // $("label[class*='answered-option']").css('background-color', 'red');
  71. // $("lable").click(function(){
  72. // $("label[class*='answered-option']").toggleClass('background-color', 'red');
  73. // });
  74. }
  75. },3000);
  76. }
  77.  
  78.  
  79. //视屏倍速播放
  80. function playVideo() {
  81. var clock = setInterval( function() {
  82. //界定快进范围
  83. // console.log('快进中')
  84. videoButtonCheck();
  85. }, 10000);
  86. var video = document.getElementsByTagName("video");
  87. if(video.length>0){ //是视频的话就播放
  88. video[0].currentTime = 0;
  89. document.querySelector('.mvp-fonts-play').click();
  90. console.log('视屏开始播放')
  91. setTimeout(function(){
  92. document.querySelectorAll('.mvp-play-rate')[0].click()
  93. //开始倍速播放
  94. speedControl()
  95. },5500);
  96. video[0].addEventListener('pause', function () {
  97. //视屏播放结束、进入下一课时。
  98. document.querySelector('.mvp-fonts-play').click();
  99. }, false);
  100. video[0].addEventListener('ended', function () {
  101. //视屏播放结束、进入下一课时。
  102. console.log('视屏结束!');
  103. clearInterval(clock);
  104. nextButtonClick();
  105. }, false);
  106. } else {
  107. //没有发现视屏、5秒后将进入下一刻。
  108. console.log('没视频判断到我将点击下一课!');
  109. //预览检测
  110. clearInterval(clock);
  111. previewcheck()
  112. scrollContent()
  113. nextButtonClick()
  114. }
  115. }
  116. //点击下一课程
  117. function nextButtonClick() {
  118. setTimeout(function(){
  119. document.querySelector('.next').click();
  120. },5500);
  121. }
  122. //点击上一课
  123. function previousButtonClick() {
  124. setTimeout(function(){
  125. document.querySelector('.pre').click();
  126. },2500);
  127. }
  128.  
  129. // 下拉滚动条
  130. function scrollContent() {
  131. // 开始操作滚动条
  132. //下行
  133. $("html,body,.___content").animate({ scrollTop: 394 }, 1000)
  134. //上行
  135. $("html,body,.___content").animate({ scrollTop: 0 }, 1000)
  136. }
  137. function speedControl() {
  138. // 倍速播放 5倍速
  139. // video[0].playbackRate = 5;
  140. //利用setInterval的快进播放
  141. // var video = document.getElementsByTagName("video");
  142. var video = document.getElementsByTagName("video");
  143. var clock = setInterval( function() {
  144. //界定快进范围
  145. // console.log('快进中')
  146. if (video[0].currentTime < video[0].duration-10 ) {
  147. video[0].currentTime+=5;
  148. } else {
  149. clearInterval(clock);
  150. console.log('已清除')
  151. }
  152. }, 150)
  153.  
  154.  
  155. }
  156. //80%按钮检测
  157. function videoButtonCheck() {
  158. if($('div.reveal-modal-bg')[0].style.cssText == 'display: block;') {
  159. $('div.popup-footer').find('button')[0].click();
  160. //返回上一个视频
  161. previousButtonClick();
  162. }
  163. }
  164. }

QingJ © 2025

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