Border Color and Completion Stats

Add green border to fully completed courses and show completion stats on Console

// ==UserScript==
// @name        Border Color and Completion Stats
// @namespace   https://github.com/luigiMinardi
// @match       https://www.boot.dev/tracks/backend*
// @grant       none
// @version     0.0.2
// @author      luigiMinardi
// @license     MIT
// @description Add green border to fully completed courses and show completion stats on Console
// @homepageURL https://greasyfork.org/en/scripts/513899-border-color-and-completion-stats
// ==/UserScript==

let count = document.querySelector("#__nuxt > div > div.static-bgimage > div > div.h-full.flex-1.overflow-auto.align-top.relative > div.flex.flex-col.items-center.justify-start > div > div.max-w-5xl.flex-1 > section > div > div:nth-child(3) > div:nth-child(3)").querySelectorAll("span.mb-1");

let toDo = 0;
let fullToDo = 0;

let total = 0;
let fullTotal = 0;

let completed = 0;
let fullCompleted = 0;

for (const i of count){
  let nArr = i.innerHTML.replaceAll(" ","").split("/");

  toDo += parseInt(nArr[1]);
  toDo -= parseInt(nArr[0]);
  total += parseInt(nArr[1]);
  completed += parseInt(nArr[0]);

  let challenges = i.offsetParent.offsetParent.querySelector("span.flex.justify-end");
  if (challenges) {
    let cArr = challenges.innerHTML.replaceAll(" ", "").split("/");
    fullToDo += parseInt(cArr[1]);
    fullToDo -= parseInt(cArr[0]);
    fullTotal += parseInt(cArr[1]);
    fullCompleted += parseInt(cArr[0]);
    }

  // If content is completed
  if (nArr[0] == nArr[1]) {
    // Check if challenges exist
    if (challenges) {
      let cArr = challenges.innerHTML.replaceAll(" ", "").split("/");
      // If challenges are not completed skip
      if (cArr[0] != cArr[1]) {
        continue
      }
      console.log("should always be equal",cArr[0], cArr[1])
    }

    let courseBox = i.offsetParent.offsetParent.offsetParent;

    // Apply green border on completed courses
    courseBox.style.borderColor = "rgba(92, 173, 106, 0.5)";

    courseBox.addEventListener('mouseover',function(){
      courseBox.style = "";
    })
    courseBox.addEventListener('mouseleave',function(){
      courseBox.style.borderColor = "rgba(92, 173, 106, 0.5)";
    });
  }
}

fullToDo += toDo
fullTotal += total
fullCompleted += completed

console.log("Data:","\n[(W)ith(o)ut (C)hallenges] Still need to do: " + toDo, "\n[(W)ith (C)hallenges] Still need to do: " + fullToDo,"\n[WoC] Completed: " + completed, "\n[WC] Completed:" + fullCompleted,"\n[WoC] Total: " + total, "\n[WC] Total: " + fullTotal);