欧洲开放大学刷课脚本

None

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         欧洲开放大学刷课脚本
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  None
// @author       You
// @license      Yeatom
// @match        https://academyeurope.eu/lp-courses/mba-diploma-program/master-of-business-administration/lessons/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    function run(func, ms) {
        return new Promise((resolve, reject) => {
            try {
                const timerId = setTimeout(() => {
                    const result = func();
                    clearTimeout(timerId);
                    resolve(result);
                }, ms);
            } catch (error) {
                reject(error);
            }
        });
    }

    function clickComplete() {
        document.getElementsByClassName('lp-button button button-complete-item button-complete-lesson lp-btn-complete-item')[0].click()
    }

    function clickYes() {
        document.getElementsByClassName('lp-button btn-yes')[0].click()
    }

    async function main() {
        await run(clickComplete, 4500)
        await run(clickYes, 1500)
    }

    main()

})();