Newer
Older
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// @website https://code.fbi.h-da.de/istddmue2/bbb-echotest-autojoin-userscript
// @downloadURL https://code.fbi.h-da.de/istddmue2/bbb-echotest-autojoin-userscript/-/raw/master/bbb-echotest-autojoin.user.js
// @updateURL https://code.fbi.h-da.de/istddmue2/bbb-echotest-autojoin-userscript/-/raw/master/bbb-echotest-autojoin.user.js
// @description Automatically accept the echotest and automatically mute after connect
// @author Daniel Müller
// @match https://*.h-da.de/html5client/join*
// @grant none
// ==/UserScript==
async function sleep(ms) {
await new Promise(r => setTimeout(r, ms));
}
function getEchotestAcceptButton() {
let selector = "span[class^=echoTest] > button > span[class*=success]";
return document.querySelector(selector)?.parentElement;
}
function getMuteButton() {
return document.querySelector("button > span > i[class*=icon-bbb-unmute]")?.parentElement?.parentElement;
}
function getUnmuteButton() {
return document.querySelector("button > span > i[class*=icon-bbb-mute]")?.parentElement?.parentElement;
}
function isMuted() {
if (getMuteButton() != null) return false;
if (getUnmuteButton() != null) return true;
return null;
}
(async function() {
'use strict';
let waitTime = 100;
// Loop to catch reconnects without reloading the page
while (true) {
// Wait until the echotest accept button shows up
while (getEchotestAcceptButton() == null) {
await sleep(waitTime);
}
getEchotestAcceptButton().click();
let tStart = new Date();
// Force mute for 2.5 seconds after joining
while (new Date() - tStart < 2500) {
// Ensure that the microphone is muted after joining
// Ensure that the microphone is muted after joining
while (isMuted() == false) {
getMuteButton()?.click();
await sleep(500);
}
// Increase the waitTime after the initial connection
waitTime = 500;
await sleep(waitTime);
}