Skip to content

Instantly share code, notes, and snippets.

@ZeevoX
Last active January 14, 2021 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZeevoX/7fe356ca5741d2d3e5ae0a5beaf9c656 to your computer and use it in GitHub Desktop.
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.
// ==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