Create a gist now

Instantly share code, notes, and snippets.

@cdevroe /readme.md
Last active Jun 6, 2018

Embed
What would you like to do?
YouTube pop-up Bookmarklet

YouTube Pop-up Bookmarklet

I forget where I found this originally (sorry). And I've modified it slightly over the years. But if you're on YouTube in a desktop browser and you'd like to have the video in a small pop-up window, tap this bookmarklet and it automatically creates the perfectly sized window for you.

How to install

  1. Create a new bookmark with any URL.
  2. Edit that bookmark in your browser, delete the URL that is there, and paste the code you see in the JS file into the Location field.

You're welcome / Colin

javascript:ytplayer=document.getElementById('movie_player');ytplayer.pauseVideo();winsize=screen.width-650;vidparams=((document.location.search.includes('&'))%20?%20document.location.search.replace('?v=','').replace('&','?')%20+%20'&'%20:%20document.location.search.replace('?v=','')+'?');void(window.open('http://www.youtube.com/embed/'+vidparams+'vq=hd1080&autoplay=true&start='+Math.floor(ytplayer.getCurrentTime()),'_blank','height=333,width=592,top=50,left='+winsize))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment