⚒ Wizardebop "Auto Unpause v2" ⏯️

Unpause Acellus.com While In Another Tab etc!

// ==UserScript==
// @name         ⚒ Wizardebop "Auto Unpause v2" ⏯️
// @author       Type Stuff
// @description  Unpause Acellus.com While In Another Tab etc!
// @version      2.32
// @match        https://admin192a.acellus.com/student/*
// @match        https://admin192c.acellus.com/student/*
// @license      
// @run-at       document-start
// @grant        none
// @namespace    https://greasyfork.org/users/1394549
// @icon         https://img.freepik.com/free-vector/halloween-witch-hat-isolated-illustration_18591-83719.jpg
// ==/UserScript==

(function() {
    'use strict';

    // Override the document.hidden and document.visibilityState properties so they always indicate visibility.
    Object.defineProperty(document, 'hidden', {
        get: function() {
            return false;
        },
        configurable: false
    });

    Object.defineProperty(document, 'visibilityState', {
        get: function() {
            return 'visible';
        },
        configurable: false
    });

    // Prevent any visibilitychange events from triggering their default behavior.
    document.addEventListener('visibilitychange', function(e) {
        e.stopImmediatePropagation();
    }, true);

    // Optional: Override the addEventListener function to block new visibilitychange listeners
    const originalAddEventListener = document.addEventListener;
    document.addEventListener = function(type, listener, options) {
        if (type === 'visibilitychange') {
            // Block adding new listeners for visibility changes.
            console.log('Blocked visibilitychange listener:', listener);
            return;
        }
        return originalAddEventListener.call(document, type, listener, options);
    };

})();