-
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
Conversation
Thanks for your contribution, that looks like quite a lot of new code. I'm gonna need more time to review it. |
Remove unmodified files from pull request |
Sorry, you must have misunderstood me. I meant remove Just leave |
Hi @feimosi please check now
i don't understand what is this |
Seems fine now. Just unnecessary empty first line in
It's linter errors. You can see more details here: |
I fixed the warnings and removed first empty line in .editorconfig file, |
Great, I'll take a look in some free time. Also, you may want to read about |
thank you
…On Thu, Jan 5, 2017 at 1:59 AM, Marek Grzybek ***@***.***> wrote:
Great, I'll take a look in some free time.
No problem if it's your first contribution. We're here to help :)
Also, you may want to read about git commit --amend, so you don't create
so many commits.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#137 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AQHDAmi036Wi0NjvRvYFi7E35MpyVmWYks5rPAExgaJpZM4LY1-q>
.
|
demo/index.html
Outdated
@@ -1,3 +1,4 @@ | |||
|
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.
This shouldn't be here.
src/baguetteBox.js
Outdated
function loadImage(index, callback) { | ||
var imageContainer = imagesElements[index]; | ||
var galleryItem = currentGallery[index]; | ||
var isVideo = false; | ||
if(imageContainer !== undefined) { |
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.
Missing space/ Also better use typeof imageContainer !== 'undefined'
src/baguetteBox.js
Outdated
@@ -490,11 +515,23 @@ | |||
|
|||
// Get element reference, optional caption and source path | |||
var imageElement = galleryItem.imageElement; | |||
var thumbnailElement = imageElement.getElementsByTagName('img')[0]; | |||
var thumbnailElement = null; | |||
if(isVideo) { |
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.
Missing space afyer if
.
src/baguetteBox.js
Outdated
var thumbnailElement = null; | ||
if(isVideo) { | ||
thumbnailElement = imageElement.getElementsByTagName('video')[0]; | ||
} |
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.
else
should be on the same line.
src/baguetteBox.js
Outdated
@@ -477,7 +477,7 @@ | |||
|
|||
function pauseAnyVideoPlaying(){ | |||
[].forEach.call(imagesElements, function(imageElement) { | |||
if(imageElement.getElementsByTagName('video').length > 0){ | |||
if (imageElement.getElementsByTagName('video').length > 0){ |
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
src/baguetteBox.js
Outdated
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 comment
The reason will be displayed to describe this comment to others. Learn more.
space before ||
src/baguetteBox.js
Outdated
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; | ||
if(isVideo) { | ||
if (isVideo) { | ||
imageSrc = getVideoSrc(imageElement); | ||
} |
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.
You should use else
in the same line as the brackets.
src/baguetteBox.js
Outdated
function loadImage(index, callback) { | ||
var imageContainer = imagesElements[index]; | ||
var galleryItem = currentGallery[index]; | ||
var isVideo = false; | ||
if typeof imageContainer !== 'undefined' { |
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.
This is wrong now; you are missing the parentheses.
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.
fixing
src/baguetteBox.js
Outdated
@@ -490,11 +515,21 @@ | |||
|
|||
// Get element reference, optional caption and source path | |||
var imageElement = galleryItem.imageElement; | |||
var thumbnailElement = imageElement.getElementsByTagName('img')[0]; | |||
var thumbnailElement = null; |
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
thank you fixing
src/baguetteBox.js
Outdated
var imageCaption = typeof options.captions === 'function' ? | ||
options.captions.call(currentGallery, imageElement) : | ||
imageElement.getAttribute('data-caption') || imageElement.title; | ||
var imageSrc = getImageSrc(imageElement); | ||
var imageSrc = null; |
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.
src/baguetteBox.js
Outdated
} | ||
|
||
// If video is already loaded run callback and return | ||
if (imageContainer.getElementsByTagName('video')[0] && isVideo) { |
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.
This is the same as above
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.
can you please explain what is problem here, i don't understand
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.
You can merge this condition with the previous one instead of duplicating.
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.
thanks merged
src/baguetteBox.js
Outdated
var imageSrc = getImageSrc(imageElement); | ||
|
||
var imageSrc = isVideo ? getVideoSrc(imageElement) : getImageSrc(imageElement); | ||
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.
Trailing spaces.
src/baguetteBox.js
Outdated
// If image is already loaded run callback and return | ||
if (imageContainer.getElementsByTagName('img')[0]) { | ||
// If image is already loaded run callback and return OR If video is already loaded run callback and return | ||
if ((imageContainer.getElementsByTagName('img')[0] && !isVideo) || (imageContainer.getElementsByTagName('video')[0] && isVideo)) { |
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.
Is the && !isVideo
needed?
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.
yes, it is needed
Any update on this @feimosi ? |
@rafaelpimpa Sorry, it needs more time from my side because it introduces too many changes and I don't have much time lately. |
Hi feimosi my name is Elber and I'm a Baguette.box's maintainer in Drupal.org (please see it: https://www.drupal.org/project/baguettebox) we have an issue with the same target of this pull request (please see it: https://www.drupal.org/project/baguettebox/issues/3261916) for keep working on that issue I need you commit this changes here. Please don't forget of this comment. Thank you all. |
Wonder if this is still being used on 1.11.1? |
I used this script in our site, and we need a requirement of video on popup, so i modified the code the add video support