Skip to content
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.

Commit

Permalink
added initial tapermonkey script and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Drumm3r committed Jan 24, 2022
0 parents commit 5a2c95a
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# GatherTownToggle

A tapermonkey script to toggle microphone and camera with just a key press.

Press "m" to toggle your microphone.
Press "c" to toggle your camera.

That's it!
38 changes: 38 additions & 0 deletions tapermonkeyScript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// ==UserScript==
// @name gather.town microphone and camera toggle
// @namespace https://schoenenborn.info/
// @version 1.0.0
// @description A script which adds the possibility to toggle your camera and microphone with a simple key press
// @author Daniel Schönenborn
// @match https://gather.town/app/*
// @icon https://www.google.com/s2/favicons?domain=gather.town
// @grant none
// ==/UserScript==

(function () {
'use strict';

document.addEventListener("keydown", function (keydownEvent) {
if (keydownEvent.code === "KeyM") {
let microphoneToggleButton = document.querySelector('[title="Enable microphone"]');

if (microphoneToggleButton === null) {
microphoneToggleButton = document.querySelector('[title="Disable microphone"]');
}

microphoneToggleButton.click();
return;
}

if (keydownEvent.code === "KeyC") {
let cameraToggleButton = document.querySelector('[title="Enable video"]');

if (cameraToggleButton === null) {
cameraToggleButton = document.querySelector('[title="Disable video"]');
}

cameraToggleButton.click();
return;
}
});
})();

0 comments on commit 5a2c95a

Please sign in to comment.