// ==UserScript==
// @name Mixer Options - Chat and Mute
// @description Make sure the main streamer's chat is focused and mute concurrent streams
// @version 1.0
// @namespace http://www.linuxmint.ro/
// @author Nicolae Crefelean
// @license CC BY 4.0
// @match https://mixer.com/*
// @grant none
// @downloadURL none
// ==/UserScript==
(function() {
'use strict';
document.querySelector("nav button").insertAdjacentHTML("afterend", "");
document.querySelector("nav button").insertAdjacentHTML("afterend", "");
setInterval(function() {
// switch to the hoster's chat if it isn't focused
var tabs = document.querySelector("b-channel-chat-tabs bui-tab-bar");
if (tabs !== null && !tabs.children[0].classList.contains('selected') && chatSwitch()) {
tabs.children[0].click();
}
// mute the stream's sound
if (autoMute()) {
var mute = document.querySelectorAll("button[aria-label='Mute']");
if (mute.length > 0) {
mute.forEach(function(e) {
e.click();
});
}
}
}, 500);
function chatSwitch() {
return document.querySelector("#myChatSwitch").checked;
}
function autoMute() {
return document.querySelector("#myAutoMute").checked;
}
})();