This repository has been archived by the owner on Apr 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added initial tapermonkey script and readme
- Loading branch information
0 parents
commit 5a2c95a
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
}); | ||
})(); |