Skip to content

Instantly share code, notes, and snippets.

@moemoe89
Last active March 27, 2022 04:45
Show Gist options
  • Save moemoe89/8041ddf2526c3edce06ea9bf460fc3c4 to your computer and use it in GitHub Desktop.
Save moemoe89/8041ddf2526c3edce06ea9bf460fc3c4 to your computer and use it in GitHub Desktop.
random choose google meet participant
var exclude = [
'(You)',
'Bismo Baruno'
]
function sleep(milliseconds) {
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds) {
break;
}
}
}
for (i = 1; i <= 5; i++) {
sleep(1000);
console.log(i);
}
var participants = document.querySelectorAll('[aria-label="Participants"]')[0].innerText;
participants = participants.replace(/(\r\n|\n|\r)/gm, '<br />');
for (var i = 0; i < exclude.length; i++) {
participants = participants.replace(exclude[i] + '<br />', '');
}
var names = participants.split('<br />');
var name = names[Math.floor(Math.random() * names.length)];
console.log('The next presenter is ....');
sleep(2);
console.log(name);
console.log('πŸ‘ πŸ‘ πŸ‘ πŸ‘ πŸ‘ πŸ₯³ πŸ₯³ πŸŽ‰πŸŽ‰');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment