Greasy Fork

Greasy Fork is available in English.

麦能网刷课脚本

2021/12/13 下午8:37:23

当前为 2021-12-14 提交的版本,查看 最新版本

// ==UserScript==
// @name        麦能网刷课脚本
// @namespace   com.kk.icu
// @match       http://edu.jobingedu.com/lms/web/course/*
// @grant       none
// @version     1.2
// @author      KK([email protected])
// @description 2021/12/13 下午8:37:23
// ==/UserScript==
(function() {
    'use strict';
    //获取当前页面
    const a = $('<a>', { href: window.location.search })[0].baseURI
    const b = a.substr(a.lastIndexOf('/')+1, 5);
    let flag = false
    if(b != 'index') {
      setTimeout(function(){
        setTimeout(function() {
          let video_list = document.querySelector("#mulu_1")
          
          let atPresent = document.querySelector(".view_c_title")
          let last = video_list.children[video_list.children.length -1].children[1].children[0].title
          let video = document.querySelector("video");
          
          if(video != null) {
              if(video.currentTime < video.duration) {
                video.currentTime = video.duration
              }
          }
          console.log(atPresent.textContent)
          console.log(last)
          if(atPresent.textContent == last && flag) {
            let first = video_list.children[0].children[1].children[0].href
            window.location.href = first
          }
          if(atPresent.textContent == last) {
            flag = false
            window.location.href = "http://edu.jobingedu.com/lms/web/course/index"
          }else {
            setTimeout(function() {
              let button = document.querySelector("#job_nextvideo_btn");
              button.click()
            }, 1500)
          }
        }, 1000)
      }, 1000)
    }else {
      const courselist = document.querySelector('#course_list')
      let map = new Map()
      for (let i = 0; i < courselist.children.length -1; i++) {
        const course = courselist.children[i]
        const key = course.children[0].children[1].children[2].children[0].href
        const value = course.children[0].children[0].children[0].children[0].textContent
        map.set(key, value)
      }
      for (const item of map) {
        if(item[1] == "100%"){
          continue
        }
        flag = true
        window.location.href = item[0]
        
      }
    }
})();