-
-
Save NKid/a843ba93dce8fbdd2824 to your computer and use it in GitHub Desktop.
[Youtube Popup Player] #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: (function() { | |
var pattern = /(v=|embed\/)(.{11})/; | |
var ifyt = document.querySelectorAll('iframe[src^="https://www.youtube.com"]'); | |
var link = ''; | |
if(ifyt.length === 1) { | |
link = pattern.exec(ifyt[0].src)[2]; | |
} else if(ifyt.length > 1) { | |
var n = prompt('No. ?') - 1; | |
link = pattern.exec(ifyt[n].src)[2]; | |
} else if(location.href.indexOf('https://www.youtube.com') !== -1) { | |
link = pattern.exec(location.search)[2]; | |
} | |
if(link.length !== 0) { | |
link = 'https://youtube.googleapis.com/v/' + link + '&hd=1'; | |
window.open(link, new Date().getTime(), 'menubar=0,toolbar=0,location=0,personalbar=0,status=0,scrollbars=0,titlebar=0,directories=0,width=640,height=370,top=0,left=0'); | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment