UNMUTE KICK ON FIREFOX 100% WORKING FIX!!!

Unmute audio for kick.com on Firefox

目前為 2024-01-16 提交的版本,檢視 最新版本

// ==UserScript==
// @name            UNMUTE KICK ON FIREFOX 100% WORKING FIX!!!
// @namespace       https://greasyfork.org/en/users/1200587-trilla-g
// @match           https://kick.com/*
// @description     Unmute audio for kick.com on Firefox
// @grant           none
// @version         2.0
// @author          Trilla_G
// ==/UserScript==

// Function to change the mute button value to "vjs-vol-3"
const autoChangeVolume = () => {
    const muteButton = document.querySelector('.vjs-mute-control.vjs-control.vjs-button.vjs-vol-0');
    if (muteButton) {
        muteButton.click(); // Automatically click the mute button
        setTimeout(() => {
            muteButton.classList.replace('vjs-vol-0', 'vjs-vol-3');
            console.log('Volume changed to "vjs-vol-3".');
        }, 2000); // 2-second delay before changing the class (adjust as needed)
    }
};

// Initial run of the script
setTimeout(autoChangeVolume, 2000); // 2-second delay before the initial click (adjust as needed)

// Function to observe URL changes without MutationObserver
const observeUrlChanges = () => {
    let currentUrl = window.location.href;

    const checkUrl = () => {
        const newUrl = window.location.href;
        if (newUrl !== currentUrl && newUrl.includes('kick.com')) {
            console.log('URL change detected on kick.com. Retriggering script.');
            currentUrl = newUrl;
            autoChangeVolume();
        }
        setTimeout(checkUrl, 1000); // Check every 1 second (adjust as needed)
    };

    // Initial check
    checkUrl();
};

// Initial observation of URL changes
observeUrlChanges();