Learning Bot for "Microsoft build cloud skills challenge"

Automatically complete each learning module for "Microsoft build cloud skills challenge"

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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         Learning Bot for "Microsoft build cloud skills challenge"
// @namespace    https://www.microsoft.com/cloudskillschallenge/build/registration/2022
// @version      0.1
// @description  Automatically complete each learning module for "Microsoft build cloud skills challenge"
// @author       You
// @match        https://docs.microsoft.com/*/learn/modules/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=microsoft.com
// @grant        none
// @license      MIT
// ==/UserScript==
(function() {
    'use strict';

    window.setInterval(() => {
        window.scrollTo(0, document.body.scrollHeight);
        let startBtn = document.querySelectorAll('[data-bi-name="start"]');
        if (startBtn.length) {
            startBtn[0].click();
        }

        let nextBtn = document.querySelectorAll('[data-bi-name="continue"]');
        if (nextBtn.length) {
            nextBtn[0].click();
        }

        let modalNextBtn = document.querySelectorAll('.modal-card [data-bi-name="continue"]');
        if (modalNextBtn.length) {
            modalNextBtn[0].click();
        }

        let questions = document.getElementsByClassName('quiz-question');
        for (let q of questions) {
            q.querySelector('label').click();
        }

        let checkBtn = document.querySelectorAll('[data-bi-name="check-answers"]')
        if (checkBtn.length) {
            checkBtn[0].click()
        }

        let achievementBtn = document.querySelectorAll('[data-bi-name="unlock-achievement"]');
        if (achievementBtn.length) {
            achievementBtn[0].click();
        }

        let completedBtn = document.querySelectorAll('[data-bi-name="learn-completion-continue"]');
        if (completedBtn.length) {
            completedBtn[0].click();
        }

        return
    }, 1000);

})();