Mute Freevee Ads

Mutes ads on Freevee

// ==UserScript==
// @name         Mute Freevee Ads
// @namespace    mute-freevee-ads
// @version      0.3
// @license      Doesn't matter
// @description  Mutes ads on Freevee
// @match        https://www.amazon.com/*
// ==/UserScript==

(() => {
    const observer = new MutationObserver(function(mutations_list) {
        const checkNodes = (nodes, value) => {
            nodes.forEach((node) => {
                console.log('checking node', value, node)
                if(node.classList.contains('atvwebplayersdk-ad-timer')){
                    document.querySelectorAll('video').forEach((video) => {
                        video.muted = value
                    })
                }
            })
        }

        mutations_list.forEach((mutation) => {
            checkNodes(mutation.addedNodes, true)
            checkNodes(mutation.removedNodes, false)
        })
    })

    observer.observe(document, { subtree: true, childList: true });
})()