Last active
January 14, 2021 15:42
-
-
Save zeevox/7fe356ca5741d2d3e5ae0a5beaf9c656 to your computer and use it in GitHub Desktop.
Automatically refresh the page until the Google Meet has started and then automatically join.
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
// ==UserScript== | |
// @name Google Meet Auto-Join | |
// @namespace http://meet.google.com/ | |
// @version 0.1 | |
// @description Automatically refresh the page until the Google Meet has started and then automatically join. | |
// @author ZeevoX | |
// @match https://meet.google.com/* | |
// @grant window.close | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
setInterval(() => { | |
let willRefresh = false; | |
document.querySelectorAll("button, *[role='button']").forEach(button => { | |
switch(button.textContent) { | |
case "Join now": | |
if (document.hidden) alert("Google Meet ready!"); | |
button.dispatchEvent(new MouseEvent("click",{bubbles: true, cancellable: true}));; | |
document.querySelector("div[data-tooltip='Leave call']").onclick(() => window.close()); | |
break; | |
case "Rejoin": | |
window.close(); | |
break; | |
case "Return to home screen": | |
case "Reload": | |
if (!willRefresh) { | |
willRefresh = true; | |
setTimeout(() => location.reload(), 1000 + 2000 * Math.random()); | |
} | |
break; | |
} | |
}); | |
}, 2000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment