Greasy Fork is available in English.

Mute Peacock Ads

Mutes ads on Peacock

// ==UserScript==
// @name         Mute Peacock Ads
// @namespace    mute-peacock-ads
// @description  Mutes ads on Peacock
// @version      0.2
// @match        https://www.peacocktv.com/*
// @icon         https://www.google.com/s2/favicons?domain=peacocktv.com
// ==/UserScript==

setInterval(function(){
    var adCountdown = document.querySelector('.ad-countdown__remaining-time')
    var muteButton = document.querySelector('button.playback-button[aria-label="Mute Sound"]')
    var unmuteButton = document.querySelector('button.playback-button[aria-label="Unmute Sound"]')

    if(adCountdown === null & unmuteButton != null){
        unmuteButton.click()
    }
    if(adCountdown != null & muteButton != null){
        muteButton.click()
    }
}, 1000)