Skip to content

Instantly share code, notes, and snippets.

@iamandrewluca
Last active September 29, 2021 19:28
Show Gist options
  • Save iamandrewluca/09b5cf4bddff0d3db30c90eeda6dac8b to your computer and use it in GitHub Desktop.
Save iamandrewluca/09b5cf4bddff0d3db30c90eeda6dac8b to your computer and use it in GitHub Desktop.
Google Meet, open your video Picture in Picture mode #bookmarklet
javascript: void ((function(userName = 'You') {
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */
function findUpElementByDataAttribute(element, attr) {
if (element) {
return element.dataset[attr] ? element : findUpElementByDataAttribute(element.parentElement, attr);
}
}
const usersElements = [...document.querySelectorAll('[data-initial-participant-id] [data-self-name]')];
const userElement = usersElements.find(e => e.textContent.toLowerCase().includes(userName.toLowerCase()));
const element = findUpElementByDataAttribute(userElement, 'initialParticipantId');
const videos = [...element?.querySelectorAll('video')];
const video = videos.find(v => !v.paused);
video?.requestPictureInPicture();
})('%s'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment