Created
March 8, 2019 19:58
-
-
Save vojtechjurasek/5e052dcfd475a570ef80c9cc82a296d7 to your computer and use it in GitHub Desktop.
Minified code of Picture-in-Picture in Google Chrome bookmark. Create bookmark with following code. Don't forget "javascript:" at the beginning.
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:if("pictureInPictureEnabled"in document&&"querySelectorAll"in document){(async function(){const a=document.querySelectorAll("video");if(0===a.length)window.alert("Sorry, no videos on the page.");else if(0<a.length){const b=a[0];try{b===document.pictureInPictureElement?await document.exitPictureInPicture():await b.requestPictureInPicture()}catch(a){console.error(a)}}})()}else"pictureInPictureEnabled"in document?document.pictureInPictureEnabled||window.alert("Picture-in-Picture not available."):window.alert("Picture-in-Picture is disabled."); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment