Greasy Fork is available in English.

Review Skip

Clicks the "Skip" button every time it appears

// ==UserScript==
// @name         Review Skip
// @namespace    https://greasyfork.org/en/users/1291009
// @version      2.1
// @description  Clicks the "Skip" button every time it appears
// @author       BadOrBest
// @license      MIT
// @icon         https://www.google.com/s2/favicons?sz=64&domain=acellus.com
// @match        https://admin192c.acellus.com/student/*
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_info
// @grant        GM_listValues
// @grant        GM_deleteValue
// @grant        GM_disable
// @run-at       document-end
// ==/UserScript==
(function() {
    'use strict';
 
    let isEnabled = false; // Flag to track script enable/disable
    let debounceTimer; // Timer for debouncing continuous clicking
 
    // Function to click the "Skip" button
    function clickSkipButton(skipElement) {
        try {
            if (skipElement) {
                skipElement.click();
            }
        } catch (error) {
            console.error('Error clicking skip button:', error);
        }
    }
 
    // Function to handle mutations
    function handleMutations(mutationsList, observer) {
        for (const mutation of mutationsList) {
            if (mutation.type === 'childList') {
                // Check if a new element with the text "Skip" has been added
                const newSkipElements = Array.from(mutation.addedNodes).filter(node => node.textContent.trim() === 'Skip');
                if (newSkipElements.length > 0) {
                    // Click all new "Skip" elements if enabled
                    if (isEnabled) {
                        newSkipElements.forEach(newSkipElement => clickSkipButton(newSkipElement));
                    }
                }
            }
        }
    }
 
    // Function to continuously click the "Skip" button with debouncing
    function clickSkipButtonContinuously() {
        clearTimeout(debounceTimer);
        debounceTimer = setTimeout(() => {
            // Find all spans containing the text "Skip"
            const skipSpans = Array.from(document.querySelectorAll('span')).filter(span => span.textContent.trim() === 'Skip');
 
            // Click each "Skip" span if enabled
            if (isEnabled) {
                skipSpans.forEach(span => clickSkipButton(span));
            }
        }, 500); // Adjust debounce delay as needed
    }
 
    // Create a MutationObserver to watch for changes in the DOM
    const observer = new MutationObserver(handleMutations);
 
    // Start observing changes in the entire document subtree
    observer.observe(document.documentElement, { childList: true, subtree: true });
 
    // Function to toggle script enable/disable
    function toggleScript() {
        isEnabled = !isEnabled; // Toggle the isEnabled flag
 
        // Update button appearance based on isEnabled state
        if (isEnabled) {
            toggleButton.textContent = 'Review Skip ON';
            toggleButton.classList.remove('script-off');
            toggleButton.classList.add('script-on');
            toggleButton.style.backgroundColor = '#28a745'; // Green color for ON state
        } else {
            toggleButton.textContent = 'Review Skip OFF';
            toggleButton.classList.remove('script-on');
            toggleButton.classList.add('script-off');
            toggleButton.style.backgroundColor = '#dc3545'; // Red color for OFF state
        }

        // Ensure correct initial position of collapsibleButton
        adjustCollapsibleButtonPosition();
    }
 
    // Create the toggle button
    const toggleButton = document.createElement('button');
    toggleButton.textContent = 'Review Skip OFF'; // Initial text
    toggleButton.classList.add('toggle-button', 'script-off'); // Initial class for style
    toggleButton.addEventListener('click', toggleScript);
 
    // Style the toggle button
    toggleButton.style.position = 'fixed';
    toggleButton.style.bottom = '20px';
    toggleButton.style.left = '20px';
    toggleButton.style.padding = '10px 20px';
    toggleButton.style.borderRadius = '30px'; // Make it round
    toggleButton.style.backgroundColor = '#dc3545'; // Red color for OFF state
    toggleButton.style.color = '#fff';
    toggleButton.style.border = 'none';
    toggleButton.style.cursor = 'pointer';
    toggleButton.style.fontFamily = 'Arial, sans-serif'; // Bubble-like font
    toggleButton.style.fontWeight = 'bold'; // Bold text
    toggleButton.style.fontStyle = 'italic'; // Italicized text
    toggleButton.style.fontSize = '14px'; // Adjust font size as needed
    toggleButton.style.zIndex = '9998'; // Ensure it's above other elements
 
    // Ensure button is keyboard accessible
    toggleButton.tabIndex = 0;
    toggleButton.addEventListener('keypress', function(event) {
        if (event.key === 'Enter' || event.key === ' ') {
            toggleScript();
        }
    });
 
    // Append the toggle button to the body of the page
    document.body.appendChild(toggleButton);
 
    // Create the collapsible button (arrow button)
    const collapsibleButton = document.createElement('button');
    collapsibleButton.innerHTML = '▼'; // Upwards arrow initially
    collapsibleButton.classList.add('collapsible-button');
    collapsibleButton.style.position = 'fixed';
    collapsibleButton.style.bottom = '80px'; // Default bottom position when collapsed
    collapsibleButton.style.left = '10px'; // Default left position
    collapsibleButton.style.padding = '5px';
    collapsibleButton.style.backgroundColor = 'transparent'; // No need to set initial background color
    collapsibleButton.style.color = '#fff';
    collapsibleButton.style.border = 'none';
    collapsibleButton.style.cursor = 'pointer';
    collapsibleButton.style.borderRadius = '50%'; // Round shape
    collapsibleButton.style.zIndex = '9999'; // Ensure it's above other elements
 
    // Function to toggle visibility of the main toggle button
    collapsibleButton.addEventListener('click', function() {
        toggleButton.style.display = toggleButton.style.display === 'none' ? 'block' : 'none';
        adjustCollapsibleButtonPosition();
    });
 
    // Append the collapsible button to the body of the page
    document.body.appendChild(collapsibleButton);
 
    // Click the "Skip" button continuously every 1000 milliseconds (1 second)
    setInterval(clickSkipButtonContinuously, 1000);

    // Function to adjust position of collapsible button based on toggleButton's visibility
    function adjustCollapsibleButtonPosition() {
        if (toggleButton.style.display !== 'none') {
            collapsibleButton.innerHTML = '▼'; // Upwards arrow when expanded
            collapsibleButton.style.backgroundColor = 'transparent'; // Set back to transparent when expanded
            // Position collapsible button on top left of toggleButton
            const rect = toggleButton.getBoundingClientRect();
            collapsibleButton.style.top = rect.top + 'px';
            collapsibleButton.style.left = rect.left + 'px';
        } else {
            collapsibleButton.innerHTML = '▲'; // Downwards arrow when collapsed
            collapsibleButton.style.backgroundColor = 'black'; // Change background color when collapsed
            // Position collapsible button on bottom left of the page
            collapsibleButton.style.top = 'auto';
            collapsibleButton.style.bottom = '20px';
            collapsibleButton.style.left = '10px';
        }
    }
 
    // Adjust initial position of collapsible button
    adjustCollapsibleButtonPosition();
})();