Greasy Fork 支持简体中文。

NTP专升本自动刷课

2021/12/16 上午10:19:46

// ==UserScript==
// @name        NTP专升本自动刷课
// @namespace   Violentmonkey Scripts
// @match       http://www.zjnep.com/lms/web/course/*
// @match       http://zjnep.com/lms/web/course/*
// @grant       none
// @version     1.1
// @author      -
// @description 2021/12/16 上午10:19:46
// ==/UserScript==
window.onload = function(){
    console.log("脚本开始执行")
            document.querySelectorAll("video")[0].muted = true;
  function jt(){
      if(document.getElementById("job_mask").getAttribute("style") != "display: block;"){
          console.log("没有触发");
          //自动点击下一章
          //自动点击开始播放
          document.getElementById("job_nextvideo_btn").click();
          document.getElementsByClassName("vjs-big-play-button")[0].click();
      }else{
          console.log("触发啦!");
          clearInterval(time1);
          //开始答题
          let all_radio  = document.getElementsByClassName("radio");
          for(let i =0;i<all_radio.length;i++){
              let find_dom = all_radio[i];
              if(find_dom.getAttribute("class").indexOf("gray") == -1){
                  find_child = find_dom.firstElementChild;
                  
                  if(find_child.getAttribute("flag") == "Y"){
                      console.log(find_child)
                      find_child.click()
                  }
              }
          }
  
          let all_check   = document.getElementsByClassName("check");
          for(let i =0;i<all_check.length;i++){
              let find_dom = all_check[i];
              if(find_dom.getAttribute("class").indexOf("gray") == -1){
                  find_child = find_dom.firstElementChild;
                  if(find_child.getAttribute("flag") == "Y"){
                      console.log(find_child)
                      find_child.click()
                  }
              }
          }
          //提交
          document.getElementById("job_quizsub").click();
          document.getElementById("job_quizfinish").click();
          //继续监听
          time1 = setInterval(jt,3000)
      }
      
  }
  let time1 = setInterval(jt,3000)
  }