Skip to content

Commit cad0534

Browse files
committed
Merge branch 'JS-323' into JS-372
2 parents bffa741 + 39aa50f commit cad0534

File tree

5 files changed

+14
-112
lines changed

5 files changed

+14
-112
lines changed

app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</div>
2222
</div>
2323
<!--Fix for jumping content. Loader must be the same size as gallery.-->
24-
<script type="text/javascript">
24+
<script>
2525
var config = {
2626
"width": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_medium', 'width'); ?>,
2727
"thumbheight": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_small', 'height')

app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ define([
77
'jquery',
88
'underscore',
99
'mage/template',
10-
'mage/gallery/preloadImages',
1110
'priceUtils',
1211
'priceBox',
1312
'jquery/ui',
1413
'jquery/jquery.parsequery'
15-
], function ($, _, mageTemplate, preloadImages) {
14+
], function ($, _, mageTemplate) {
1615
'use strict';
1716

1817
$.widget('mage.configurable', {
@@ -40,10 +39,6 @@ define([
4039
// Initial setting of various option values
4140
this._initializeOptions();
4241

43-
//Preload all gallery images
44-
this._preloadImages();
45-
this._preloadOptionalImages();
46-
4742
// Override defaults with URL query parameters and/or inputs values
4843
this._overrideDefaults();
4944

@@ -93,43 +88,6 @@ define([
9388
});
9489
},
9590

96-
/**
97-
* Preloads default configuration images.
98-
* @private
99-
*/
100-
_preloadImages: function () {
101-
var options = this.options,
102-
fullImagesList = [],
103-
imagesList = [];
104-
105-
_.each(options.mediaGalleryInitial, function (item) {
106-
imagesList.push(item.img);
107-
fullImagesList.push(item.full);
108-
});
109-
preloadImages(imagesList);
110-
preloadImages(fullImagesList);
111-
},
112-
113-
/**
114-
* Preloads optional configuration images.
115-
* @private
116-
*/
117-
_preloadOptionalImages: function () {
118-
var options = this.options;
119-
120-
_.each(options.spConfig.images, function (array) {
121-
var fullImagesList = [],
122-
imagesList = [];
123-
124-
_.each(array, function (item) {
125-
imagesList.push(item.img);
126-
fullImagesList.push(item.full);
127-
});
128-
preloadImages(imagesList);
129-
preloadImages(fullImagesList);
130-
});
131-
},
132-
13391
/**
13492
* Override default options values settings with either URL query parameters or
13593
* initialized inputs values.

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,7 @@ define([
363363
t,
364364
tmpVideoData,
365365
currentItem,
366-
iconClass = 'video-thumb-icon',
367-
videoContainerClass = 'fotorama-video-container';
366+
iconClass = 'video-thumb-icon';
368367

369368
if (!fotorama.activeFrame.$navThumbFrame) {
370369
$(this.element).on('fotorama:showend', $.proxy(function (evt, fotoramaData) {
@@ -379,7 +378,7 @@ define([
379378
thumbsParent = fotorama.activeFrame.$navThumbFrame.parent();
380379
thumbs = thumbsParent.find('.fotorama__nav__frame:visible');
381380

382-
fotorama.data.map($.proxy(function(item, i){
381+
fotorama.data.map($.proxy(function (item, i) {
383382
!item.type && (item.type = this.options.VideoData[i].mediaType);
384383
}, this));
385384

@@ -449,7 +448,10 @@ define([
449448
$image = fotorama.data[frameNumber - 1 + number];
450449

451450
if ($image) {
452-
if ($image.type !== 'video') return;
451+
452+
if ($image.type !== 'video') {
453+
return;
454+
}
453455
$image = $image.$stageFrame;
454456
}
455457

@@ -620,6 +622,7 @@ define([
620622
$(this).remove();
621623
$item.append(cloneVideoDiv);
622624
$item.addClass('video-unplayed');
625+
623626
if ($('.fotorama-item').data('fotorama').options.arrows) {
624627
$('.fotorama__arr--next').show();
625628
$('.fotorama__arr--prev').show();

app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
define([
77
'jquery',
88
'underscore',
9-
'mage/gallery/preloadImages',
109
'jquery/ui'
11-
], function ($, _, preloadImages) {
10+
], function ($, _) {
1211
'use strict';
1312

1413
/**
@@ -272,27 +271,6 @@ define([
272271
'img': $main.find('.product-image-photo').attr('src')
273272
}];
274273
}
275-
this._preloadSwatchesImages();
276-
},
277-
278-
/**
279-
* Preloads optional configuration images.
280-
* @private
281-
*/
282-
_preloadSwatchesImages: function () {
283-
var options = this.options;
284-
285-
_.each(options.jsonConfig.images, function (array) {
286-
var fullImagesList = [],
287-
imagesList = [];
288-
289-
_.each(array, function (item) {
290-
imagesList.push(item.img);
291-
fullImagesList.push(item.full);
292-
});
293-
preloadImages(imagesList);
294-
preloadImages(fullImagesList);
295-
});
296274
},
297275

298276
/**
@@ -915,7 +893,8 @@ define([
915893
var justAnImage = images[0],
916894
updateImg,
917895
imagesToUpdate,
918-
gallery = context.find(this.options.mediaGallerySelector).data('gallery');
896+
gallery = context.find(this.options.mediaGallerySelector).data('gallery'),
897+
item;
919898

920899
if (images) {
921900
imagesToUpdate = this._setImageType($.extend(true, [], images));
@@ -927,11 +906,8 @@ define([
927906
return img.isMain;
928907
});
929908

930-
if (updateImg.length) {
931-
gallery.updateDataByIndex(0, updateImg[0]);
932-
} else {
933-
gallery.updateDataByIndex(0, imagesToUpdate[0]);
934-
}
909+
item = updateImg.length ? updateImg[0]: imagesToUpdate[0];
910+
gallery.updateDataByIndex(0, item);
935911

936912
gallery.seek(1);
937913
} else {

lib/web/mage/gallery/preloadImages.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)