湖南开放大学自动刷课

针对改版后的湖南开放大学,自动刷课脚本。

目前为 2022-06-09 提交的版本。查看 最新版本

// ==UserScript==
// @name         湖南开放大学自动刷课
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  针对改版后的湖南开放大学,自动刷课脚本。
// @author       Aether
// @match        *.hnsydwpx.cn/*
// @grant        none
// @run-at       document-end
// @license MIT
// ==/UserScript==

(function () {
    let hre = location.href;
    if (
      hre == "http://www.hnsydwpx.cn/center.html" ||
      hre == "https://www.hnsydwpx.cn/center.html"
    ) {
        setTimeout(() => {s
            document.querySelector('.center-main').childNodes[3].childNodes[5].childNodes[1].click()
        }, 3000)

        setTimeout(() => {
            try {
                if (document.getElementsByClassName('iframe')[0].contentWindow.document.getElementById('LearnInCompleteCount').innerHTML != '0') {
                    document.getElementsByClassName('iframe')[0].contentWindow.document.getElementById('LearnInCompleteCount').click()
                    document.getElementsByClassName('iframe')[0].contentWindow.document.getElementById('LearnInCompleteArr').childNodes.item(0).getElementsByTagName('button')[0].click()
                }
            } catch(err) {
                window.location.reload();
            }
        }, 5000)
    }

    if (
        hre.match("http://www.hnsydwpx.cn/play.html/*") ||
        hre.match("https://www.hnsydwpx.cn/play.html/*")
    ) {
        setTimeout(() => {
            document.getElementById('courseCatalogue').childNodes.item(3).getElementsByTagName('div')[1].getElementsByTagName('a')[0].click()
        }, 5000)
    }

    if (hre == "http://www.hnsydwpx.cn/getcourseDetails.html" ||
        hre == "https://www.hnsydwpx.cn/getcourseDetails.html"
       ) {
      setInterval(() => {
        var cource_list = document.getElementById('courseCatalogue').querySelector('.list-item').querySelectorAll('.item-list')
        var finished = true
        for(var i = 0; i < cource_list.length; i ++) {
            if (cource_list[i].querySelector('.item-list-progress').innerHTML != '100%') {
                finished = false
                break
            }
        }

        if (finished == true) {
            console.log('pass')
            if(hre == "http://www.hnsydwpx.cn/getcourseDetails.html") {
                window.location.replace('http://www.hnsydwpx.cn/center.html')
            } else {
                window.location.replace('https://www.hnsydwpx.cn/center.html')
            }
            
        }
      }, 5000);
    }
  })();

QingJ © 2025

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