wlxx

网络学习代码

目前为 2024-04-10 提交的版本,查看 最新版本

此脚本不应直接安装,它是供其他脚本使用的外部库。如果你需要使用该库,请在脚本元属性加入:// @require https://update.cn-greasyfork.org/scripts/443181/1357867/wlxx.js

  1. function func() {
  2. try{
  3. var i=0;var x1, t1;
  4. const zf1=15,zf2=25,zf3=15,homepage="https://edu.chinahrt.com/151/learning_center/public_course";
  5. setTimeout(function(){
  6. var test = window.location.href;
  7. if(test.match("train2/home")){
  8. //window.alert("1")
  9. document.querySelector(".el-button.srt-el-button.srt-el-button--primary.srt-el-button-h32").click ();
  10. //window.close();
  11. }else if(test.match("grain/course")){
  12. x1 = document.querySelector(".state").innerText;//学习
  13. t1 = window.setInterval(study,10000);//重复执行某个方法
  14. }else if(test.match("train/guide/course")){
  15. setTimeout( Select,5000);//选视频
  16. }else if(test.match("train/pointView")){
  17. //nldxz(); //能力点选择
  18. document.querySelector ('.ability-task-title').click()
  19. setTimeout(function(){ page(0)},10000);
  20. }else if(test.match("train/workspace")){
  21. if(document.querySelectorAll('.score')[3].innerText!=zf1){
  22. page(0);
  23. }else{document.querySelectorAll('.tab-name')[1].click()
  24. setTimeout(function(){
  25. if(document.querySelectorAll('.score')[3].innerText!=zf2){
  26. page(0);
  27. }else{document.querySelectorAll('.tab-name')[2].click()
  28. setTimeout(function(){
  29. if(document.querySelectorAll('.score')[3].innerText!=zf3){
  30. page(0);
  31. }else{window.alert("恭喜您已学完全部课程!")}
  32. },10000)
  33. }
  34. },10000)
  35. }
  36. // }else{window.alert("恭喜您已学完全部课程!")}
  37. }else if(test.match("play_video")){
  38. setTimeout(function(){
  39. window.open(document.querySelector('iframe').src)
  40. window.close();
  41. },10000)
  42. }else if(test.match("/videoPlay/")){
  43. t1 = window.setInterval(GXstudy,10000)//公需科目学习
  44. }else if(test.match("trainplan_detail")){
  45. //选择科目学习页面
  46. setTimeout(function(){
  47. var i=0
  48. var span=document.querySelectorAll("span")
  49. for( i;i<span.length;i++){
  50. if(span[i].textContent.match("学习中")||span[i].textContent.match("未开始")){
  51. if(span[i].textContent.match("学习中心")== null){
  52. // console.log(i)
  53. span[i].click()
  54. break;}
  55. }
  56. }
  57. window.close()
  58. },10000);
  59. }else if(test.match("plan_course")){
  60. //GXSelect()//公需科目选择
  61. setTimeout(function(){
  62. document.querySelectorAll(".n-base-selection-input__content")[0].click()
  63. setTimeout(function(){
  64. document.querySelectorAll(".n-base-select-option__content")[1].click()
  65. setTimeout(function(){
  66. if(document.querySelectorAll(".n-image.n-image--preview-disabled").length<4){
  67. window.alert("恭喜您已学完全部课程!")
  68. }else{document.querySelectorAll(".n-image.n-image--preview-disabled")[1].click()}
  69. setTimeout(function(){location.reload()},10000)
  70. },10000)
  71. },10000)
  72. },10000);
  73. }else if(test.match("v_selected_course")){
  74. setTimeout(function(){
  75. document.querySelectorAll("label")[1].click()
  76. setTimeout(function(){
  77. var list=document.querySelectorAll(".bg.pa.tc")
  78. if(list.length){
  79. list[0].click()
  80. //setTimeout(function(){t1 = window.setInterval(location.reload(),60000)},10000)
  81. setTimeout(function(){window.close()},10000);
  82. }else{window.alert("恭喜您已学完全部课程!")}
  83. },5000)
  84. },10000);
  85. }else if(test.match("public_course")){
  86. //选择未完成年份
  87. setTimeout(function(){
  88. var i=0
  89. var span=document.querySelectorAll("span")
  90. for( i;i<span.length;i++){
  91. if(span[i].textContent.match("学习中")){
  92. if(span[i].textContent.match("学习中心")== null){
  93. break;}
  94. }
  95. }
  96. //console.log(i)
  97. for( i;i<span.length;i++){
  98. if(span[i].textContent.match("去学习")){
  99. break;}
  100. }
  101. //console.log(i)
  102. span[i].click()
  103. setTimeout(function(){location.reload()},10000)
  104. },10000);
  105. }
  106. },10000);
  107. //能力点选择
  108. function nldxz() {
  109. var sw=document.querySelectorAll('.ability-task-title');
  110. if(sw.length!=0){
  111. if(document.querySelector ('.info').innerText.match("3 个 / 3个")==null){
  112. for (i = 0; i < sw.length; i++) {
  113. sw[i].click ();
  114. }
  115. setTimeout(function(){
  116. switch(document.querySelector ('.info').innerText) {
  117. case "0 个 / 3个":
  118. page(0);
  119. break;
  120. case "1 个 / 3个":
  121. page(1);
  122. break;
  123. case "2 个 / 3个":
  124. page(2);
  125. break;
  126. default:
  127. }
  128. },5000);
  129. }else{
  130. document.querySelector ('.g-nav-menu-name').click ();
  131. setTimeout(function(){
  132. location.reload();
  133. },5000);
  134. }
  135. }else{
  136. var nldqd=document.querySelectorAll ('span');
  137. while (nldqd[i].innerText.indexOf('确定(3)') == -1){
  138. i++;
  139. }
  140. nldqd[i].click ();
  141. setTimeout(function(){
  142. location.reload();
  143. },5000);
  144. }
  145. }
  146. //切换窗口
  147. function page(x) {
  148. document.querySelectorAll ('.task-title')[x].click ();
  149. window.close();
  150. }
  151. //选择视频
  152. function Select() {
  153. window.clearInterval(t1);
  154. var div = document.querySelectorAll(".item-infos.default")
  155. if(div.length!=0){
  156. document.querySelector(".img").click ();
  157. window.close();
  158. }else{
  159. document.querySelector ('.ivu-page-next').click ();
  160. setTimeout( Select,5000);
  161. }
  162. }
  163. //能力点学习
  164. function study() {
  165. if(i<7){
  166. i++;
  167. var str1 =document.querySelector('.vcp-controls-panel.show');
  168. var str2 =document.querySelector ('.alarmClock-wrapper');
  169. //var str3 =document.querySelectorAll(".question-name");
  170. if(str1!=null){
  171. document.querySelector ('.vcp-playtoggle').click ();
  172. }
  173. if(str2.style.display==""){
  174. str2.click ();
  175. }
  176. //if(str3.length!=0){
  177. //document.querySelectorAll(".ivu-btn.ivu-btn-primary")[1].click ();
  178. //}
  179. if(document.querySelector(".scoring-wrapper").style.display!="none"){
  180. var mousemove = new Event('mousemove');
  181. var x=document.querySelectorAll(".rate-item")
  182. x=x[x.length-1];
  183. x.dispatchEvent(mousemove);
  184. x.click();
  185. setTimeout(function(){
  186. document.querySelectorAll('.ivu-btn.ivu-btn-primary')[2].click();
  187. },3000);
  188. }
  189. }else{
  190. i=0;
  191. var x2 = document.querySelector(".state").innerText;
  192. console.log(x2);
  193. if(x2!=x1){
  194. x1=x2;
  195. }else{
  196. window.clearInterval(t1);//你已学完本课,结束本课学习。
  197. document.querySelector ('.g-nav-menu-name').click ();//换课
  198. }
  199. }
  200. }
  201. function GXstudy() {
  202. var video=document.querySelectorAll('video')
  203. if(video.length==0){
  204. location.reload();
  205. }else{
  206. if(attrset.ifCanDrag){
  207. window.open(homepage)//打开学习首页
  208. window.close();
  209. }else{
  210. if(attrset.currentTime==attrset.duration){
  211. setTimeout(function(){
  212. window.open(homepage)//打开学习首页
  213. window.close();
  214. },3000);
  215. }else if(player.V.paused){
  216. player.V.play()
  217. }else if(player.V.currentTime<player.V.duration*0.8){
  218. //console.log("1")
  219. attrset.maxTime=player.V.duration*0.89;
  220. $.ajax({
  221. url: "/videoPlay/takeRecord",
  222. data: {
  223. studyCode: attrset.studyCode,
  224. recordUrl: attrset.recordUrl,
  225. updateRedisMap: attrset.updateRedisMap,
  226. recordId: attrset.recordId,
  227. sectionId: attrset.sectionId,
  228. signId: attrset.signId,
  229. time: attrset.maxTime,
  230. businessId: attrset.businessId
  231. },
  232. dataType: "json",
  233. type: "post",
  234. success: function (data) {
  235. if (console && console.log) {
  236. console.log(data);
  237. }
  238. }
  239. })
  240. location.reload();
  241. }
  242. }
  243. }
  244. }
  245. //公需科目选择
  246. function GXSelect() {
  247. document.querySelectorAll(".n-base-selection-input__content")[0].click()
  248. setTimeout(function(){document.querySelectorAll(".n-base-select-option__content")[1].click()},10000)
  249. var list=document.querySelectorAll(".titlecolor.text")
  250. var s=document.querySelectorAll(".button.fr.mt10.border-public.tc.f12.titlecolor")
  251. for (var i = 0; i < list.length+1; i++) {
  252. if(i == list.length){
  253. list=document.querySelectorAll(".f12")
  254. for (i = 0; i < list.length+1; i++) {
  255. if(list[i].textContent.match("选课列表")){
  256. list[i].click()
  257. setTimeout(function(){location.reload()},10000)
  258. break;
  259. }
  260. }
  261. }
  262. else{
  263. if(s[i].text.match("未学习")){
  264. list[i].click()
  265. break;
  266. }
  267. }
  268. }
  269. }
  270. }
  271. catch(err) {
  272. var t = window.setInterval(location.reload(),10000);
  273. }
  274. }