<script>
    var css = '.clearfix:after {  clear: both;  content: "";  display: block;  height: 0;}/* Responsive Arrow Progress Bar */.container {  font-family: sans-serif;}.arrow-steps .step {  font-size: 14px;  text-align: left;  color: #777;  cursor: default;  margin: 0 2px 0 0;  padding: 10px 2px 10px 20px;  width: auto;  heigth: 20px;  float: left;  position: relative;  background-color: #ddd;}.arrow-steps .step a {  color: #777;  text-decoration: none;}.arrow-steps .step:after,.arrow-steps .step:before {  content: "";  position: absolute;  top: 0;  right: -16px;  width: 0;  height: 20;  border-top: 20px solid transparent;  border-bottom: 20px solid transparent;  border-left: 17px solid #ddd;  z-index: 2;}.arrow-steps .step:before {  right: auto;  left: 0;  border-left: 17px solid #fff;  z-index: 0;}.arrow-steps .step:first-child:before {  border: none;}.arrow-steps .step:last-child:after {  border: none;}.arrow-steps .step:first-child {  border-top-left-radius: 4px;  border-bottom-left-radius: 4px;}.arrow-steps .step:last-child {  border-top-right-radius: 4px;  border-bottom-right-radius: 4px;  padding: 10px 10px 10px 20px;}.arrow-steps .step span {  position: relative;}*.arrow-steps .step.current {  color: #fff;  background-color: #5599e5;}.arrow-steps .step.current a {  color: #fff;  text-decoration: none;}.arrow-steps .step.current:after {  border-left: 17px solid #5599e5;}.arrow-steps .step.done {  color: #fff;  background-color: #2f69aa;}.arrow-steps .step.done a {  color: #fff;  text-decoration: none;}.arrow-steps .step.done:after {  border-left: 17px solid #2f69aa;}',
        head = document.head || document.getElementsByTagName('head')[0],
        style = document.createElement('style');

    head.appendChild(style);

    style.type = 'text/css';
    if (style.styleSheet) {
        // This is required for IE8 and below.
        style.styleSheet.cssText = css;
    } else {
        style.appendChild(document.createTextNode(css));
    }
</script>

<script>
    window.onload = function() {
        myFunction()
    };

    function loadData() {
        var url = 'https://do.ipo.kpi.ua/grade/report/user/index.php?id=5927';
        return fetch(url)
            .then((resp) => resp.text());
    }




    async function myFunction() {
        var step = document.getElementsByClassName('step');
        var filename = 'https://do.ipo.kpi.ua/grade/report/user/index.php?id=5927';

        const data = await loadData(filename);
        const parser = new DOMParser();
        let doc = parser.parseFromString(data, 'text/html');
        let table = doc.querySelector('table');




        for (var i = 0; i < step.length; i++) {
            let stepId = step[i].getAttribute('name');

            if (stepId != null) {
                let activity = document.getElementById(stepId);
                if (activity != null) {
                    let image = activity.getElementsByTagName('img')[1];
                    if (image != undefined) {
                        let src = image.getAttribute('src');
                        if (src != undefined && src.includes("completion-auto-y") || src != undefined && src.includes("completion-auto-pass")) {
                            let Row = table.rows[1 + i];
                            let grageCol = Row.querySelectorAll('td')[0];
                            if (grageCol.innerHTML != "-" || i == 0) {
                                step[i].classList.add("done");
                            } else {
                                step[i].classList.add("current");
                            }


                        }
                    }
                }
            }
        }
        document.getElementById('module-154878').getElementsByClassName('no-overflow')[1].style.overflow = "hidden";
    }
    if (document.getElementById('ototal')) {
        function file_get_contents(filename) {
            fetch(filename).then((resp) => resp.text()).then(data => {
                const parser = new DOMParser();
                let doc = parser.parseFromString(data, 'text/html');

                let table = doc.querySelector('table');
                let lastRow = table.rows[table.rows.length - 1];
                let grageCol = lastRow.querySelectorAll('td')[0];

                document.getElementById('ototal').innerHTML = "Бали: " + grageCol.innerHTML;
            });
        }

        file_get_contents('https://do.ipo.kpi.ua/grade/report/user/index.php?id=5927');
    }
</script>
<script>
    document.addEventListener('DOMContentLoaded', function() {
        const buttonElement = document.querySelector('button.btn.btn-primary');

        if (!buttonElement || buttonElement.textContent !== 'Завершити редагування') {
            const divElements = document.querySelectorAll('div.availabilityinfo.isrestricted');

            divElements.forEach(function(divElement) {
                const spanElement = document.createElement('span');
                spanElement.className = 'availabilityinfo isrestricted';

                const badgeElement = document.createElement('span');
                badgeElement.className = 'badge badge-info';
                badgeElement.textContent = 'Недоступно. Завершіть попередню активність.';
                spanElement.appendChild(badgeElement);
                divElement.parentNode.replaceChild(spanElement, divElement);
            });
        }
    });
</script>
<script defer="">
    const bodyElement = document.querySelector('body');
    const sidePanel = document.querySelector('.d-print-none.moodle-has-zindex');

    if (sidePanel) {
        console.log('Замінюємо клас moodle-has-zindex на closed');
        sidePanel.classList.add('closed');
    }
    if (bodyElement) {
        bodyElement.style.marginLeft = '0';
    }
</script>
<script>
    document.body.style.backgroundColor = "lightblue";
</script>