Skip to content

Commit 86d4f38

Browse files
JS-472: Gallery code style
1 parent 55bd773 commit 86d4f38

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

app/code/Magento/ProductVideo/view/frontend/web/js/fotorama-add-video-events.js

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ define([
130130
*/
131131
_initialize: function () {
132132
this._loadVideoData();
133+
133134
if (this._checkForVideoExist()) {
134135
this._checkFullscreen();
135136
this._listenForFullscreen();
@@ -140,6 +141,11 @@ define([
140141
}
141142
},
142143

144+
/**
145+
*
146+
* @param {Object} options
147+
* @private
148+
*/
143149
_setOptions: function (options) {
144150

145151
if (options.videoData && options.videoData.length) {
@@ -425,11 +431,9 @@ define([
425431
}
426432
fotorama.data.map($.proxy(this._setItemType, this));
427433

428-
429434
thumbsParent = fotorama.activeFrame.$navThumbFrame.parent();
430435
thumbs = thumbsParent.find('.fotorama__nav__frame:visible');
431436

432-
433437
for (t = 0; t < thumbs.length; t++) {
434438
this._setThumbsIcon(thumbs.eq(t), t);
435439
this._checkForVideo(e, fotorama, t);
@@ -440,6 +444,12 @@ define([
440444
}, this));
441445
},
442446

447+
/**
448+
*
449+
* @param {Object} elem
450+
* @param {Number} i
451+
* @private
452+
*/
443453
_setThumbsIcon: function (elem, i) {
444454
var fotorama = this.fotoramaItem.data('fotorama');
445455

@@ -461,7 +471,7 @@ define([
461471
* @param {Number} i
462472
* @private
463473
*/
464-
_setItemType: function(item, i) {
474+
_setItemType: function (item, i) {
465475
!item.type && (item.type = this.options.videoData[i].mediaType);
466476
},
467477

@@ -518,6 +528,7 @@ define([
518528
if ($image.type === 'image') {
519529
$image.$navThumbFrame && $image.$navThumbFrame.removeClass(this.TI);
520530
this._hideCloseVideo();
531+
521532
return;
522533
} else if ($image.$navThumbFrame && $image.type === 'video') {
523534
!$image.$navThumbFrame.hasClass(this.TI) && $image.$navThumbFrame.addClass(this.TI);
@@ -600,15 +611,23 @@ define([
600611
.on('click tap', $.proxy(this._clickHandler, this));
601612
this._handleBaseVideo(fotorama, number); //check for video is it base and handle it if it's base
602613
},
614+
603615
/**
604616
* Hides preview arrows above video player.
605617
* @private
606618
*/
607619
_hideVideoArrows: function () {
608-
$('.' + this.FTAR).removeClass('fotorama__arr--shown');
609-
$('.' + this.FTAR).removeClass('fotorama__arr--hidden');
620+
var arrows = $('.' + this.FTAR);
621+
622+
arrows.removeClass('fotorama__arr--shown');
623+
arrows.removeClass('fotorama__arr--hidden');
610624
},
611625

626+
/**
627+
*
628+
* @param {Event} event
629+
* @private
630+
*/
612631
_clickHandler: function (event) {
613632
if ($(event.target).hasClass(this.VU) && $(event.target).find('iframe').length === 0) {
614633

@@ -707,7 +726,7 @@ define([
707726
if ($('.' + self.FTAR + '--prev').is(':focus') || $('.' + self.FTAR + '--next').is(':focus')) {
708727
$(self.FTCF).focus();
709728
}
710-
}
729+
}
711730
});
712731
}
713732
});

app/code/Magento/ProductVideo/view/frontend/web/js/load-player.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ define(['jquery', 'jquery/ui'], function ($) {
189189
*/
190190
'onReady': function onPlayerReady() {
191191
self._player.getDuration();
192-
self.element.closest('.fotorama__stage__frame').addClass('fotorama__product-video--loaded');
192+
self.element.closest('.fotorama__stage__frame')
193+
.addClass('fotorama__product-video--loaded');
193194
},
194195

195196
/**

0 commit comments

Comments
 (0)