-
Notifications
You must be signed in to change notification settings - Fork 430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Video Support #137
base: dev
Are you sure you want to change the base?
Added Video Support #137
Changes from 1 commit
dc68d00
a84b2bb
a341970
6b5ec5f
e4b95f7
662130e
fd0bb45
ef8639d
1ef2c62
24935f8
7f5f62d
9827746
3828e6d
9a17e2b
8f558e4
4f05c46
8d6b47d
8f9faf1
0034778
c49d9f4
87ac750
39e4152
12b0eeb
af7da8b
250e5a3
acf93a1
f8d7c97
44e4819
ef25913
a4cb9b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -477,7 +477,7 @@ | |
|
||
function pauseAnyVideoPlaying(){ | ||
[].forEach.call(imagesElements, function(imageElement) { | ||
if(imageElement.getElementsByTagName('video').length > 0){ | ||
if (imageElement.getElementsByTagName('video').length > 0){ | ||
imageElement.getElementsByTagName('video')[0].pause(); | ||
} | ||
}); | ||
|
@@ -487,13 +487,13 @@ | |
var imageContainer = imagesElements[index]; | ||
var galleryItem = currentGallery[index]; | ||
var isVideo = false; | ||
if(imageContainer !== undefined) { | ||
if typeof imageContainer !== 'undefined' { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is wrong now; you are missing the parentheses. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixing |
||
isVideo = videoRegex.test(galleryItem.imageElement.href); | ||
} | ||
|
||
// Return if the index exceeds prepared images in the overlay | ||
// or if the current gallery has been changed / closed | ||
if (imageContainer === undefined || galleryItem === undefined) { | ||
if (typeof imageContainer === 'undefined'|| typeof galleryItem === 'undefined') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. space before |
||
return; | ||
} | ||
|
||
|
@@ -516,17 +516,16 @@ | |
// Get element reference, optional caption and source path | ||
var imageElement = galleryItem.imageElement; | ||
var thumbnailElement = null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could change this whole thing into a one liner var thumbnailElement = isvideo ? imageElement.getElementsByTagName('video')[0] : imageElement.getElementsByTagName('img')[0]; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thank you fixing |
||
if(isVideo) { | ||
if (isVideo) { | ||
thumbnailElement = imageElement.getElementsByTagName('video')[0]; | ||
} | ||
else { | ||
} else { | ||
thumbnailElement = imageElement.getElementsByTagName('img')[0]; | ||
} | ||
var imageCaption = typeof options.captions === 'function' ? | ||
options.captions.call(currentGallery, imageElement) : | ||
imageElement.getAttribute('data-caption') || imageElement.title; | ||
var imageSrc = null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
if(isVideo) { | ||
if (isVideo) { | ||
imageSrc = getVideoSrc(imageElement); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should use |
||
else { | ||
|
@@ -549,7 +548,7 @@ | |
} | ||
imageContainer.appendChild(figure); | ||
|
||
if(isVideo){ | ||
if (isVideo){ | ||
// Prepare gallery video element | ||
var video = create('video'); | ||
//video.onload = function(){ | ||
|
@@ -715,7 +714,7 @@ | |
slider.style.transform = slider.style.webkitTransform = 'translate3d(' + offset + ',0,0)' | ||
: slider.style.left = offset; | ||
} | ||
if(imagesElements[currentIndex].getElementsByTagName('video').length > 0) { | ||
if (imagesElements[currentIndex].getElementsByTagName('video').length > 0) { | ||
imagesElements[currentIndex].getElementsByTagName('video')[0].play(); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space before brackets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi, do you want me to remove the spaces before brackets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, you should always use it as per the rest of the codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, fixing