wlxx

网络学习代码

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

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