Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #66 from kherchel/fix/keybinds
Browse files Browse the repository at this point in the history
Fix mute and deafen keybinds disconnecting from the call
  • Loading branch information
maltejur authored Oct 25, 2022
2 parents 7c8f72b + 68473d0 commit 9faabe1
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions assets/userscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,21 @@ setInterval(() => {
el.appendChild(div);
}

const muteBtn = document.getElementsByClassName(
const buttonContainer = document.getElementsByClassName("container-YkUktl")[0];
if (!buttonContainer) {
console.log('dsa: Cannot locate Mute/Deafen/Settings button container, please report this on GitHub');
}

const muteBtn = buttonContainer ? buttonContainer.getElementsByClassName(
"button-12Fmur enabled-9OeuTA button-f2h6uQ lookBlank-21BCro colorBrand-I6CyqQ grow-2sR_-F"
)[0];
window.discordScreenaudioToggleMute = () => muteBtn.click();
const deafenBtn = document.getElementsByClassName(
)[0] : null;
window.discordScreenaudioToggleMute = () => muteBtn && muteBtn.click();

const deafenBtn = buttonContainer ? buttonContainer.getElementsByClassName(
"button-12Fmur enabled-9OeuTA button-f2h6uQ lookBlank-21BCro colorBrand-I6CyqQ grow-2sR_-F"
)[1];
window.discordScreenaudioToggleDeafen = () => deafenBtn.click();
)[1] : null;

window.discordScreenaudioToggleDeafen = () => deafenBtn && deafenBtn.click();

if (window.discordScreenaudioResolutionString) {
for (const el of document.getElementsByClassName(
Expand Down

0 comments on commit 9faabe1

Please sign in to comment.