Actually fixed regex.
This commit is contained in:
parent
7e7da76006
commit
ce3ac634cb
|
@ -209,11 +209,11 @@ plugins.factory('userPlugins', function() {
|
||||||
* See: https://developers.google.com/youtube/player_parameters
|
* See: https://developers.google.com/youtube/player_parameters
|
||||||
*/
|
*/
|
||||||
var youtubePlugin = new UrlPlugin('YouTube video', function(url) {
|
var youtubePlugin = new UrlPlugin('YouTube video', function(url) {
|
||||||
var regex = /^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/i,
|
var regex = /(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/i,
|
||||||
match = url.match(regex);
|
match = url.match(regex);
|
||||||
|
|
||||||
if (match){
|
if (match){
|
||||||
var token = match[2],
|
var token = match[1],
|
||||||
embedurl = "https://www.youtube.com/embed/" + token + "?html5=1&iv_load_policy=3&modestbranding=1&rel=0",
|
embedurl = "https://www.youtube.com/embed/" + token + "?html5=1&iv_load_policy=3&modestbranding=1&rel=0",
|
||||||
element = angular.element('<iframe></iframe>')
|
element = angular.element('<iframe></iframe>')
|
||||||
.attr('src', embedurl)
|
.attr('src', embedurl)
|
||||||
|
|
Loading…
Reference in New Issue