Make any Acellus Video Unpaused (Flawed)

Unpauses the video when changing tabs on Acellus ;)

目前為 2024-04-26 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Make any Acellus Video Unpaused (Flawed)
// @namespace    https://gf.qytechs.cn/en/users/1291009
// @version      1.0
// @description  Unpauses the video when changing tabs on Acellus ;)
// @author       BadOrBest
// @license      MIT
// @icon         https://www.google.com/s2/favicons?sz=64&domain=acellus.com
// @match        https://admin192c.acellus.com/student/*
// @grant        none
// @grant        GM_addStyle
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_deleteValue
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    // Function to unpause media elements
    function unpauseMedia() {
        // Select all video, audio, and Plyr elements
        var mediaElements = document.querySelectorAll('video, audio, .plyr');

        // Loop through each media element and unpause it
        mediaElements.forEach(function(mediaElement) {
            // Check if the media is paused
            if (mediaElement.paused) {
                // Unpause the media
                mediaElement.play();
            }
        });
    }

    // Function to set aggressive unpause interval
    function setUnpauseInterval() {
        // Clear any existing interval
        clearInterval(window.unpauseInterval);

        // Set new interval
        window.unpauseInterval = setInterval(unpauseMedia, 1000); // Change the interval as needed
    }

    // Set aggressive unpause interval initially
    setUnpauseInterval();

    // Event listener for tab visibility change
    document.addEventListener('visibilitychange', function() {
        // If tab is visible, reset the interval
        if (!document.hidden) {
            setUnpauseInterval();
        }
    });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址