Skip to content

Commit 39aa50f

Browse files
committed
Merge pull request #79 from AnastasiaBuniakEPAM/JS-323
JS-337: [Configurable.JS] Preload all needed images
2 parents e8b7b00 + 2d7afe6 commit 39aa50f

File tree

3 files changed

+2
-111
lines changed

3 files changed

+2
-111
lines changed

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/Swatches/view/frontend/web/js/swatch-renderer.js

Lines changed: 1 addition & 20 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,24 +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 imagesList = [];
287-
288-
_.each(array, function (item) {
289-
imagesList.push(item.img);
290-
});
291-
preloadImages(imagesList);
292-
});
293274
},
294275

295276
/**

lib/web/mage/gallery/preloadImages.js

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

0 commit comments

Comments
 (0)