Last active
September 29, 2021 19:28
-
-
Save iamandrewluca/09b5cf4bddff0d3db30c90eeda6dac8b to your computer and use it in GitHub Desktop.
Google Meet, open your video Picture in Picture mode #bookmarklet
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
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