Greasy Fork is available in English.

欧洲开放大学刷课脚本

None

// ==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()

})();