Learning Bot for "Microsoft build cloud skills challenge"

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

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

})();