Edmentum Skip Tutorials

Automatically unlocks all sections in an Edmentum tutorial.

  1. // ==UserScript==
  2. // @name Edmentum Skip Tutorials
  3. // @namespace https://github.com/Kellenn
  4. // @version 0.2
  5. // @description Automatically unlocks all sections in an Edmentum tutorial.
  6. // @author Kellen
  7. // @match https://*.app.edmentum.com/courseware-delivery/*
  8. // ==/UserScript==
  9.  
  10. const MAX_ATTEMPTS = 8;
  11.  
  12. function enableButtons(sections) {
  13. for (let child of sections.children) {
  14. let button = child.children[0];
  15.  
  16. if (!button || button.className.includes("toc-current")) {
  17. continue;
  18. }
  19. button.className = "toc-section toc-visited";
  20. button.removeAttribute("disabled");
  21. }
  22. }
  23.  
  24. function findSections(delay, attempt) {
  25. if (attempt >= MAX_ATTEMPTS) {
  26. console.log("[Edementum Skip Tutorials]: Failed to locate the '.tutorial-toc-sections' class after " + attempt + " attempts.")
  27. return;
  28. }
  29. const sections = document.querySelector(".tutorial-toc-sections");
  30.  
  31. if (!sections) {
  32. setTimeout(() => findSections(delay * ++attempt, attempt), delay);
  33. } else {
  34. enableButtons(sections)
  35. }
  36. }
  37.  
  38. findSections(500, 1);