Review Skip

Clicks the "Skip" button every time it appears

  1. // ==UserScript==
  2. // @name Review Skip
  3. // @namespace https://greasyfork.org/en/users/1291009
  4. // @version 2.5
  5. // @description Clicks the "Skip" button every time it appears
  6. // @author BadOrBest
  7. // @license MIT
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=acellus.com
  9. // @match https://admin192c.acellus.com/student/*
  10. // @grant GM_setValue
  11. // @grant GM_getValue
  12. // @grant GM_info
  13. // @grant GM_listValues
  14. // @grant GM_deleteValue
  15. // @grant GM_disable
  16. // @grant GM.registerMenuCommand
  17. // @run-at document-end
  18. // ==/UserScript==
  19. (function() {
  20. 'use strict';
  21.  
  22. let isEnabled = false; // Flag to track script enable/disable
  23. let debounceTimer; // Timer for debouncing continuous clicking
  24. let reloadOnDisable = GM_getValue('reloadOnDisable', false); // Get the reload option state
  25.  
  26. // Inject CSS for animations
  27. const style = document.createElement('style');
  28. style.innerHTML = `
  29. /* Toggle button animation */
  30. .toggle-button {
  31. transition: background-color 0.3s ease, transform 0.2s ease-in-out, opacity 0.5s ease-in-out;
  32. }
  33.  
  34. /* Toggle button hover animation */
  35. .toggle-button:hover {
  36. transform: scale(1.1);
  37. background-color: #17a2b8; /* Change to a teal color on hover */
  38. }
  39.  
  40. /* Collapse button rotation animation */
  41. .collapsible-button {
  42. transition: transform 0.3s ease-in-out;
  43. }
  44.  
  45. /* Rotation when expanded */
  46. .collapsible-expanded {
  47. transform: rotate(180deg); /* Rotate the arrow when collapsed */
  48. }
  49.  
  50. /* Fade in/out animation for hiding/showing elements */
  51. .fade {
  52. transition: opacity 0.5s ease-in-out;
  53. }
  54. `;
  55. document.head.appendChild(style);
  56.  
  57. // Function to click the "Skip" button
  58. function clickSkipButton(skipElement) {
  59. try {
  60. if (skipElement) {
  61. skipElement.click();
  62. }
  63. } catch (error) {
  64. console.error('Error clicking skip button:', error);
  65. }
  66. }
  67.  
  68. // Function to handle mutations
  69. function handleMutations(mutationsList, observer) {
  70. for (const mutation of mutationsList) {
  71. if (mutation.type === 'childList') {
  72. const newSkipElements = Array.from(mutation.addedNodes).filter(node => node.textContent.trim() === 'Skip');
  73. if (newSkipElements.length > 0) {
  74. if (isEnabled) {
  75. newSkipElements.forEach(newSkipElement => clickSkipButton(newSkipElement));
  76. }
  77. }
  78. }
  79. }
  80. }
  81.  
  82. // Function to continuously click the "Skip" button with debouncing
  83. function clickSkipButtonContinuously() {
  84. clearTimeout(debounceTimer);
  85. debounceTimer = setTimeout(() => {
  86. const skipSpans = Array.from(document.querySelectorAll('span')).filter(span => span.textContent.trim() === 'Skip');
  87. if (isEnabled) {
  88. skipSpans.forEach(span => clickSkipButton(span));
  89. }
  90. }, 500);
  91. }
  92.  
  93. // Create a MutationObserver to watch for changes in the DOM
  94. const observer = new MutationObserver(handleMutations);
  95. observer.observe(document.documentElement, { childList: true, subtree: true });
  96.  
  97. // Function to toggle script enable/disable
  98. function toggleScript() {
  99. isEnabled = !isEnabled;
  100. if (isEnabled) {
  101. toggleButton.textContent = 'Review Skip ON';
  102. toggleButton.classList.remove('script-off');
  103. toggleButton.classList.add('script-on');
  104. toggleButton.style.backgroundColor = '#28a745'; // Green color for ON state
  105. } else {
  106. toggleButton.textContent = 'Review Skip OFF';
  107. toggleButton.classList.remove('script-on');
  108. toggleButton.classList.add('script-off');
  109. toggleButton.style.backgroundColor = '#dc3545'; // Red color for OFF state
  110.  
  111. if (reloadOnDisable) {
  112. location.reload(); // Reload the page if the option is ON
  113. }
  114. }
  115. adjustCollapsibleButtonPosition();
  116. }
  117.  
  118. // Create the toggle button
  119. const toggleButton = document.createElement('button');
  120. toggleButton.textContent = 'Review Skip OFF'; // Initial text
  121. toggleButton.classList.add('toggle-button', 'script-off'); // Initial class for style
  122. toggleButton.addEventListener('click', toggleScript);
  123.  
  124. // Style the toggle button
  125. toggleButton.style.position = 'fixed';
  126. toggleButton.style.bottom = '20px';
  127. toggleButton.style.left = '20px';
  128. toggleButton.style.padding = '10px 20px';
  129. toggleButton.style.borderRadius = '30px'; // Make it round
  130. toggleButton.style.backgroundColor = '#dc3545'; // Red color for OFF state
  131. toggleButton.style.color = '#fff';
  132. toggleButton.style.border = 'none';
  133. toggleButton.style.cursor = 'pointer';
  134. toggleButton.style.fontFamily = 'Arial, sans-serif'; // Bubble-like font
  135. toggleButton.style.fontWeight = 'bold'; // Bold text
  136. toggleButton.style.fontStyle = 'italic'; // Italicized text
  137. toggleButton.style.fontSize = '14px'; // Adjust font size as needed
  138. toggleButton.style.zIndex = '9998'; // Ensure it's above other elements
  139.  
  140. document.body.appendChild(toggleButton);
  141.  
  142. // Create the collapsible button
  143. const collapsibleButton = document.createElement('button');
  144. collapsibleButton.innerHTML = '▲'; // Downwards arrow initially
  145. collapsibleButton.classList.add('collapsible-button');
  146. collapsibleButton.style.position = 'fixed';
  147. collapsibleButton.style.bottom = '80px'; // Default bottom position when collapsed
  148. collapsibleButton.style.left = '10px'; // Default left position
  149. collapsibleButton.style.padding = '5px';
  150. collapsibleButton.style.backgroundColor = 'transparent'; // No need to set initial background color
  151. collapsibleButton.style.color = '#fff';
  152. collapsibleButton.style.border = 'none';
  153. collapsibleButton.style.cursor = 'pointer';
  154. collapsibleButton.style.borderRadius = '50%'; // Round shape
  155. collapsibleButton.style.zIndex = '9999'; // Ensure it's above other elements
  156.  
  157. // Function to toggle visibility of the main toggle button
  158. collapsibleButton.addEventListener('click', function() {
  159. toggleButton.classList.toggle('fade');
  160. toggleButton.style.opacity = toggleButton.style.opacity === '0' ? '1' : '0'; // Fading in/out animation
  161. collapsibleButton.classList.toggle('collapsible-expanded'); // Rotate the arrow
  162. adjustCollapsibleButtonPosition();
  163. });
  164. document.body.appendChild(collapsibleButton);
  165.  
  166. setInterval(clickSkipButtonContinuously, 1000);
  167.  
  168. function adjustCollapsibleButtonPosition() {
  169. if (toggleButton.style.opacity !== '0') {
  170. collapsibleButton.innerHTML = '▼'; // Downwards arrow when expanded
  171. collapsibleButton.style.backgroundColor = 'transparent'; // Set back to transparent when expanded
  172. const rect = toggleButton.getBoundingClientRect();
  173. collapsibleButton.style.top = rect.top + 'px';
  174. collapsibleButton.style.left = rect.left + 'px';
  175. } else {
  176. collapsibleButton.innerHTML = '▼'; // Upwards arrow when collapsed
  177. collapsibleButton.style.backgroundColor = 'black'; // Change background color when collapsed
  178. collapsibleButton.style.top = 'auto';
  179. collapsibleButton.style.bottom = '20px';
  180. collapsibleButton.style.left = '10px';
  181. }
  182. }
  183.  
  184. adjustCollapsibleButtonPosition();
  185.  
  186. // Add Tampermonkey menu commands
  187. GM.registerMenuCommand("Toggle Reloading When OFF (Current: " + (reloadOnDisable ? "ON" : "OFF") + ")", function() {
  188. reloadOnDisable = !reloadOnDisable;
  189. GM_setValue('reloadOnDisable', reloadOnDisable);
  190. alert("Reloading Acellus is now " + (reloadOnDisable ? "ON" : "OFF"));
  191. });
  192. })();