Skip to content

Instantly share code, notes, and snippets.

@jjwwcc
Forked from cdevroe/readme.md
Created February 15, 2023 02:20
Show Gist options
  • Select an option

  • Save jjwwcc/59710d0de2352424bd20b9f44387d286 to your computer and use it in GitHub Desktop.

Select an option

Save jjwwcc/59710d0de2352424bd20b9f44387d286 to your computer and use it in GitHub Desktop.
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