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://f1.apps.elf.edmentum.com/courseware-delivery/*
  8. // ==/UserScript==
  9. const MAX_ATTEMPTS = 8;
  10. function enableButtons(sections) {
  11. for (let child of sections.children) {
  12. let button = child.children[0];
  13. if (!button || button.className.includes("toc-current")) {
  14. continue;
  15. }
  16. button.className = "toc-section toc-visited";
  17. button.removeAttribute("disabled");
  18. }
  19. }
  20. function findSections(delay, attempt) {
  21. if (attempt >= MAX_ATTEMPTS) {
  22. console.log("[Edementum Skip Tutorials]: Failed to locate the '.tutorial-toc-sections' class after " + attempt + " attempts.")
  23. return;
  24. }
  25. const sections = document.querySelector(".tutorial-toc-sections");
  26. if (!sections) {
  27. setTimeout(() => findSections(delay * ++attempt, attempt), delay);
  28. } else {
  29. enableButtons(sections)
  30. }
  31. }
  32. findSections(500, 1);