Last active
March 4, 2021 05:18
-
-
Save peh/0504bb1ef28c206d2f4439ce0d7ed1cd to your computer and use it in GitHub Desktop.
Google Meet Autojoin
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 Autojoin | |
// @version 0.0.2 | |
// @description try to take over the world! | |
// @author Philipp Eschenbach | |
// @match https://meet.google.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
if (~document.body.children[0].id.indexOf("error")) { | |
window.location.reload(); | |
} else { | |
console.log("looks good") | |
} | |
setTimeout(() => { | |
/** | |
} | |
* Simulate a click event. | |
* @public | |
* @param {Element} elem the element to simulate a click on | |
*/ | |
function simulateClick(elem) { | |
// Create our event (with options) | |
var evt = new MouseEvent('click', { | |
bubbles: true, | |
cancelable: true, | |
view: window | |
}); | |
// If cancelled, don't dispatch our event | |
var canceled = !elem.dispatchEvent(evt); | |
} | |
const joinButton = Array.from(document.querySelectorAll('[role="button"]')).filter(el => el.textContent.toLowerCase().includes('join') || el.textContent.toLowerCase().includes('teilnahme'))[0]; | |
setTimeout(() => { | |
simulateClick(joinButton); | |
}, Math.random()*2000); | |
}, 3000); | |
setInterval(() => { | |
const closeButton = Array.from(document.getElementsByTagName('span')).filter(el => el.textContent.toLowerCase().includes('return to'))[0]; | |
if (closeButton) { | |
window.close() | |
} | |
}, Math.random()*1500) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment