Skip to content

Improve how muting the chat is handled

Abajur requested to merge Abajur/pomf.tv-templates:merge into main

Previously the chat looked for the presence of a cookie to decide if the chat was muted. This meant that muting was a global action: muting one chat mutes every other chat.

Now muting or unmuting does two things: it updates the cookie and a local variable. The chat looks at the local variable when deciding if the chat is muted. This means that muting is a local action with some additional global state.

So, as before, when you open a new chat window the mute setting will be as you left it last time and it is possible to open two chats and mute only one of them.


It is necessary to modify the onSoundControlClick() to make this work. However, this repository only has a minified version of this function. I am pretty sure that the original needs to be modified as well, so here it is:

function onSoundControlClick() {
    let control = $('#chat-sound-control');
    if (control.hasClass('checked')) {
        chatmuted = true;
        setCookie('chatmuted', '1', 365);
        control[0].innerHTML = '<span class="icon"><i class="fas fa-volume-up" aria-hidden="true"></i></span>Mute Chat';
    } else {
        chatmuted = false;
        deleteCookie('chatmuted');
        control[0].innerHTML = '<span class="icon"><i class="fas fa-volume-mute" aria-hidden="true"></i></span>Unmute Chat';
    }
    control.toggleClass('checked');
}

Merge request reports

Loading