zjooc在浙学刷课

网页端/安卓端 一键刷课

  1. // ==UserScript==
  2. // @name zjooc在浙学刷课
  3. // @namespace GAEE
  4. // @version 1.2.0
  5. // @description 网页端/安卓端 一键刷课
  6. // @match https://www.zjooc.cn/*
  7. // @grant unsafeWindow
  8. // @license none
  9. // @require https://cdn.staticfile.org/jquery/3.6.0/jquery.min.js
  10. // ==/UserScript==
  11. var APP_Version = "1.2.5";
  12.  
  13. //
  14. // 由于网页脚本维护不便,无法及时更新请见谅。
  15. // 如需获得更好体验请移步介绍页下载安卓脚本
  16. //
  17.  
  18. var startTime = 5000; //刷课间隔时间 //若超过该时间页面还未加载则自动跳过
  19. var IntervalTime = 2000;//监测时长
  20. var Video_muted = true; //开启静音
  21. var Video_speed = 4; //倍速设置 最大16
  22.  
  23. (function() {
  24. 'use strict';
  25. const urls = {'course':'https://www.zjooc.cn/ucenter/student/course/study/[A-Za-z0-9]+/plan/detail/[A-Za-z0-9]+'};
  26.  
  27. var ListStudy_main = [];
  28. var ListStudy_view = [];
  29.  
  30. var ListStudy_main_now;
  31. var ListStudy_view_now;
  32.  
  33. var Interval;
  34. var LN = 0;
  35. var MN = 0;
  36.  
  37.  
  38. var url = unsafeWindow.location.href;
  39. var href = new RegExp(urls.course);
  40. CONSOLE();
  41. LOG(href.test(url));
  42. if(href.test(url)){
  43. unsafeWindow.setTimeout(function(){
  44. LOG("=========== 开始执行脚本 =========");
  45. for(var i=0;i<document.querySelectorAll('.el-submenu__title').length;i++){if(i>0)document.querySelectorAll('.el-submenu__title')[i].click()}
  46. GET_MAIN_LIST();
  47. LOG("------------");
  48. GET_VIEW_LIST();
  49. LOG("------------");
  50. //LOG(ListStudy_main);
  51. //LOG(ListStudy_view);
  52. if(ListStudy_main == ""){
  53. LOG("全部完成");
  54. }else{
  55. ListStudy_main_now.click();
  56. if(ListStudy_view == ""){
  57. LOG("当前小节已完成");
  58. NEXT_MAIN();
  59. }else{
  60. ListStudy_view_now.click();
  61. unsafeWindow.setTimeout(AUTO_COURSE,startTime);
  62. }
  63. }
  64. },startTime);
  65. }
  66.  
  67. function AUTO_COURSE(){
  68. if(Interval){
  69. unsafeWindow.clearInterval(Interval);
  70. }
  71. LOG("============= 开始刷课 ===========");
  72. LOG("当前课时:"+ListStudy_view_now.innerText);
  73. if(document.querySelector('iframe')){
  74. LOG("类型【文档】");
  75. var document_ok = document.querySelector('.contain-bottom').querySelectorAll('button.el-button.el-button--default');
  76. LOG("文档按钮"+document_ok);
  77. if(document_ok){
  78. for(var i=0;i<document_ok.length;i++) document_ok[i].click();
  79. LOG("正在执行文档程序");
  80. }
  81. LOG("============= 结束刷课 ===========");
  82. NEXT_VIEW();
  83. }else{
  84. LOG("类型【视频】");
  85. var video = document.querySelector('video');
  86. LOG("[寻找VIDEO]"+video);
  87. if(video){
  88. video.autoplay = "autoplay";
  89. video.muted = Video_muted;
  90. video.playbackRate = Video_speed;
  91. var p = document.querySelector('video');
  92. if(p)p.click();
  93. Interval = unsafeWindow.setInterval(VIDEO_OK,IntervalTime);
  94. }
  95. }
  96. }
  97.  
  98. function VIDEO_OK(){
  99. try{
  100. var video=document.querySelector('video');
  101. var bar = video.parentNode.children[2];
  102. var processBar = bar.children[7];
  103. var times = processBar.innerText.split('/');
  104. var now = times[0].trim();
  105. var end = times[1].trim();
  106. LOG(times);
  107. if(now==end){
  108. if(Interval){
  109. unsafeWindow.clearInterval(Interval);
  110. }
  111. LOG("============= 结束刷课 ===========");
  112. unsafeWindow.setTimeout(NEXT_VIEW,startTime);
  113. }
  114. }catch(err) {
  115. LOG("[ERROR] "+err);
  116. if(Interval){
  117. unsafeWindow.clearInterval(Interval);
  118. }
  119. unsafeWindow.setTimeout(NEXT_VIEW,startTime);
  120. }
  121. }
  122.  
  123. function NEXT_MAIN(){
  124. MN += 1;
  125. if(MN >= ListStudy_main.length){
  126. LOG("全部完成");
  127. alert("🎉 本课程学习完毕");
  128. }else{
  129. ListStudy_main_now = ListStudy_main[MN];
  130. ListStudy_main_now.click();
  131. LOG("正在切换下一章节");
  132. unsafeWindow.setTimeout(function(){
  133. GET_VIEW_LIST();
  134. if(ListStudy_view == ""){
  135. LOG("当前小节已完成");
  136. NEXT_MAIN();
  137. }else{
  138. ListStudy_view_now.click();
  139. unsafeWindow.setTimeout(function(){AUTO_COURSE()},startTime);
  140. }
  141. },startTime);
  142. }
  143. }
  144.  
  145. function NEXT_VIEW(){
  146. LN += 1;
  147. if(LN >= ListStudy_view.length){
  148. LOG("当前小节已完成");
  149. NEXT_MAIN();
  150. }else{
  151. ListStudy_view_now = ListStudy_view[LN];
  152. ListStudy_view_now.click();
  153. //LOG("当前课时:"+ListStudy_view_now.innerText);
  154. //LOG("下一课时:"+ListStudy_view_now.nextSibling.innerText);
  155. unsafeWindow.setTimeout(AUTO_COURSE,startTime);
  156. }
  157. }
  158.  
  159. function GET_MAIN_LIST(){
  160. ListStudy_main = [];
  161. MN = 0;
  162. LOG("[学习章节]");
  163. LOG("-------------");
  164. //get main list
  165. var main_list = document.querySelector('.base-asider ul[role="menubar"]');
  166. for(var a=0; a<main_list.childElementCount; a++){
  167. var sec_list = main_list.children[a].children[1];
  168. for(var b=0; b<sec_list.childElementCount; b++){
  169. var _e = sec_list.children[b];
  170. //if(_e.getAttribute('tabindex')=='0')//-1 unfinish 0 finish
  171. //{
  172. // LOG("finished");
  173. //}else{
  174. LOG(_e.innerText);
  175. ListStudy_main.push(_e);
  176. //}
  177. }
  178. }
  179. //end
  180. ListStudy_main_now = ListStudy_main[0];
  181. ListStudy_main_now.click();
  182. LOG("-------------");
  183. }
  184.  
  185. function GET_VIEW_LIST(){
  186. ListStudy_view = [];
  187. LN = 0;
  188. LOG("[学习小节]");
  189. LOG("-------------");
  190. var list = document.querySelector('.plan-detailvideo div[role="tablist"]');
  191. for(var i=0; i<list.childElementCount; i++){
  192. var e = list.children[i];
  193. if(e.querySelector('i').classList.contains('complete'))//finished
  194. {
  195. LOG("finished");
  196. }else{
  197. LOG(e.innerText);
  198. ListStudy_view.push(e);
  199. }
  200. }
  201. ListStudy_view_now = ListStudy_view[0];
  202. LOG("-------------");
  203. }
  204.  
  205. function LOG(info){
  206. console.log(info);
  207. $('#console').append('<div class="" style="marginLeft:10px;"><span id="">'+info+'</span></div>');
  208. $('#console').scrollTop(10000000);
  209. }
  210.  
  211. function CONSOLE(){
  212. unsafeWindow.onload = function(){
  213. var box = '<div class="CONSOLE" style="border: 2px dashed rgb(0, 85, 68);width: 330px; position: fixed; top: 0; right: 0; z-index: 99999;background-color: #e8e8e8; overflow-x: auto;"><button id="close_console">隐藏控制台</button><div class="console_box" id="console" style="height:360px;background:#fff;margin:10px auto 0;overflow:auto;"><div class="info"><div class="time"></div></div></div></div>';
  214. $('body').append(box);
  215. document.getElementById("close_console").onclick = function(){
  216. var b = document.getElementById("console");
  217. if(document.getElementById("close_console").innerText == '隐藏控制台'){
  218. b.style.display = "none";
  219. document.getElementById("close_console").innerText = "显示控制台";
  220. }
  221. else{
  222. b.style.display = "";
  223. document.getElementById("close_console").innerText = "隐藏控制台";
  224. }
  225. }
  226. }
  227. }
  228.  
  229. })();

QingJ © 2025

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