Skip to content

Commit 3943f4f

Browse files
author
Julian Xhokaxhiu
committed
Match youtube and youtube-nocookie and use it as well in the embed.
1 parent 52bcb18 commit 3943f4f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/js/jquery.swipebox.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@
763763
*/
764764
getVideo : function( url ) {
765765
var iframe = '',
766-
youtubeUrl = url.match( /watch\?v=([a-zA-Z0-9\-_]+)/ ),
766+
youtubeUrl = url.match( /(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/ ),
767767
youtubeShortUrl = url.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/),
768768
vimeoUrl = url.match( /vimeo\.com\/([0-9]*)/ ),
769769
qs = '';
@@ -775,7 +775,7 @@
775775
'autoplay' : ( plugin.settings.autoplayVideos ? '1' : '0' ),
776776
'v' : ''
777777
});
778-
iframe = '<iframe width="560" height="315" src="//www.youtube.com/embed/' + youtubeUrl[1] + '?' + qs + '" frameborder="0" allowfullscreen></iframe>';
778+
iframe = '<iframe width="560" height="315" src="//' + youtubeUrl[1] + '/embed/' + youtubeUrl[2] + '?' + qs + '" frameborder="0" allowfullscreen></iframe>';
779779

780780
} else if ( vimeoUrl ) {
781781
qs = ui.parseUri( url, {

0 commit comments

Comments
 (0)