PROGRESS LEARNING DARK-MODE

Newer USATESTPREP DarkMode

  1. // ==UserScript==
  2. // @name PROGRESS LEARNING DARK-MODE
  3. // @namespace http://tampermonkey.net/
  4. // @version v1.7
  5. // @description Newer USATESTPREP DarkMode
  6. // @author Cracko298
  7. // @license Apache 2.0
  8. // @match https://app.progresslearning.com/*/assignment/activity/*
  9. // @match https://app.progresslearning.com/*/assignments
  10. // @match https://app.progresslearning.com/*/profile#!
  11. // @match https://app.progresslearning.com/*/profile
  12. // @icon https://lh5.googleusercontent.com/M7L1UR97DlbTsMpGPPcr6pWpj2mxbgt7rNQyFySkzaguUZmyuvU9mButw8UhN1uZFVqPvirrY3cd3997ntBhXzs=w1280
  13. // @grant none
  14. // ==/UserScript==
  15.  
  16. (function() {
  17. 'use strict';
  18.  
  19. function sleep(time) {
  20. return new Promise((resolve) => setTimeout(resolve, time));
  21. }
  22.  
  23. function tempAlert(msg, duration) {
  24. sleep(900).then(() => {
  25. var el = document.createElement("div");
  26. el.setAttribute("style", "position:absolute;top:2.5%;left:20%;background-color:white");
  27. el.innerHTML = msg;
  28. setTimeout(function(){
  29. el.parentNode.removeChild(el);
  30. }, duration);
  31. document.body.appendChild(el);
  32. });
  33. }
  34.  
  35. tempAlert("Created By: Cracko298", 3000);
  36.  
  37. function temps(msg, duration) {
  38. sleep(900).then(() => {
  39. var el = document.createElement("div");
  40. el.setAttribute("style", "position:absolute;top:7.5%;left:20%;background-color:white");
  41. el.innerHTML = msg;
  42. setTimeout(function(){
  43. el.parentNode.removeChild(el);
  44. }, duration);
  45. document.body.appendChild(el);
  46. });
  47. }
  48.  
  49. temps("GitHub Page: https://github.com/Cracko298", 3000)
  50.  
  51. function replaceClassNames(element) {
  52. element.classList.replace('bg-white', 'bg-black');
  53. element.classList.replace('bg-gray-50', 'bg-black');
  54. element.classList.replace('bg-gray-200', 'bg-black');
  55. element.classList.replace('text-gray-700', 'text-white');
  56. element.classList.replace('bg-gray-100', 'bg-black');
  57. element.classList.replace('text-gray-800', 'text-white');
  58. element.classList.replace('bg-primary-violet', 'bg-black');
  59. element.classList.replace('bg-gray-700','bg-black');
  60. element.classList.replace('border-blues','border-black');
  61. element.classList.replace('text-black-333','text-white');
  62. element.classList.add('lrn-author-item-toolbar-shown', 'bg-black');
  63. element.classList.add('text-white');
  64. element.classList.add('bg-black', 'has-top-left-region', 'has-top-right-region', 'has-bottom-region', 'has-items-region', 'has-menu-region', 'has-visible-bottom-region');
  65. var parentElement = document.querySelector('.app-layout');
  66. var subElements = parentElement.querySelectorAll('*');
  67. subElements.forEach(function(subElement) {
  68. subElement.style.color = 'white'; // Set the text color to white
  69. subElement.style.backgroundColor = 'transparent'; // Reset the background color if needed
  70. // Reset any other styles that you don't want to modify
  71.  
  72. });
  73.  
  74. // Add class "text-white" to element with the text "Graded Work"
  75. if (element.textContent === 'Graded Work') {
  76. element.classList.add('text-white');
  77. }
  78. }
  79.  
  80. function checkAndReplace() {
  81. const elements = document.querySelectorAll('.lrn_question, .text-black-333, .border-blues, .bg-white, .bg-gray-50, .bg-gray-200, .text-gray-700, .bg-gray-100, .text-gray-800, .app-layout, .bg-primary-violet, .bg-gray-700, .lrn-author-item-content-wrapper');
  82. elements.forEach(replaceClassNames);
  83. }
  84.  
  85. const observer = new MutationObserver(checkAndReplace);
  86. observer.observe(document.documentElement, { childList: true, subtree: true });
  87.  
  88. checkAndReplace();
  89. })();