Skip to content

Instantly share code, notes, and snippets.

@hx
Last active July 13, 2021 04:21
Show Gist options
  • Save hx/af775a307a0acc42d06b90fd7f1a37c1 to your computer and use it in GitHub Desktop.
Save hx/af775a307a0acc42d06b90fd7f1a37c1 to your computer and use it in GitHub Desktop.
Google Meet single-button navigation
// I use this with the Shortkeys Chrome plugin to navigate meetings with a single button.
(() => {
const find = cond => () => document.querySelector(cond)
const findButton = text => () => [...document.querySelectorAll('button,[role=button]')].find(b => b.textContent === text)
const steps = [
// Unmute first
find('[aria-label*="Turn on mic"]'),
// The first button that has not already ended (or just the first button), which will be one of the big
// buttons with meeting names
() => [...document.querySelectorAll('[data-end-time]')].find(x => +x.getAttribute('data-end-time') >= Date.now()) ||
document.querySelector('[data-end-time]'),
// The "Join now" button on the meeting preview page
findButton('Join now'),
// The red "Hang up" button
find('[aria-label="Leave call"]'),
// The so-named button that returns to the main meet screen
findButton('Return to home screen'),
]
steps.some(fn => {
const button = fn()
if (button) {
button.click()
return true
}
})
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment