diff --git a/vendor/magento/module-configurable-product/view/frontend/web/js/configurable.js b/vendor/magento/module-configurable-product/view/frontend/web/js/configurable.js index cbe840c95795f..4b5ea7130d40c 100644 --- a/vendor/magento/module-configurable-product/view/frontend/web/js/configurable.js +++ b/vendor/magento/module-configurable-product/view/frontend/web/js/configurable.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2012 Adobe + * All Rights Reserved. */ /** * @api @@ -349,7 +349,13 @@ define([ * @private */ _addFotoramaVideoEvents: function (isInitial) { - if (_.isUndefined($.mage.AddFotoramaVideoEvents)) { + if (_.isUndefined($.mage.AddFotoramaVideoEvents) + || !$(this.options.mediaGallerySelector).AddFotoramaVideoEvents('instance') + ) { + $(this.options.mediaGallerySelector).on('addfotoramavideoeventscreate', function () { + this._addFotoramaVideoEvents(isInitial); + }.bind(this)); + return; } @@ -512,7 +518,7 @@ define([ if (this.options.spConfig.canDisplayShowOutOfStockStatus) { filteredSalableProducts = $(this.options.spConfig.salable[attributeId][options[i].id]). - filter(options[i].allowedProducts); + filter(options[i].allowedProducts); canDisplayOutOfStockProducts = filteredSalableProducts.length === 0; } diff --git a/vendor/magento/module-product-video/view/frontend/web/js/fotorama-add-video-events.js b/vendor/magento/module-product-video/view/frontend/web/js/fotorama-add-video-events.js index 670d91febe9f7..c1a272e8f685f 100644 --- a/vendor/magento/module-product-video/view/frontend/web/js/fotorama-add-video-events.js +++ b/vendor/magento/module-product-video/view/frontend/web/js/fotorama-add-video-events.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2015 Adobe + * All Rights Reserved. */ define([ @@ -137,16 +137,6 @@ define([ * @private */ _create: function () { - $(this.element).data('gallery') ? - this._onGalleryLoaded() : - $(this.element).on('gallery:loaded', this._onGalleryLoaded.bind(this)); - }, - - /** - * - * @private - */ - _initialize: function () { if (!this.defaultVideoData.length) { this.defaultVideoData = this.options.videoData; } @@ -156,7 +146,14 @@ define([ if (!this.defaultVideoData.length && !this.options.videoData.length) { this.defaultVideoData = this.options.videoData = this.videoDataPlaceholder; } + this._initializeOnGalleryLoaded(); + }, + /** + * + * @private + */ + _initialize: function () { this.clearEvents(); if (this._checkForVideoExist()) { @@ -168,6 +165,17 @@ define([ } }, + /** + * Initializes after gallery is loaded + * + * @private + */ + _initializeOnGalleryLoaded: function () { + $(this.element).data('gallery') ? + this._onGalleryLoaded() : + $(this.element).on('gallery:loaded', this._onGalleryLoaded.bind(this)); + }, + /** * Callback which fired after gallery gets initialized. */ @@ -203,7 +211,7 @@ define([ } this._loadVideoData(options); - this._initialize(); + this._initializeOnGalleryLoaded(); }, /** @@ -473,7 +481,8 @@ define([ elem.removeClass(this.TI); } - if (this.options.videoData[i].mediaType === this.VID && + if (this.options.videoData[i] && + this.options.videoData[i].mediaType === this.VID && fotorama.data[i].type === this.VID && fotorama.options.nav === 'thumbs') { elem.addClass(this.TI); diff --git a/vendor/magento/module-swatches/view/base/web/js/swatch-renderer.js b/vendor/magento/module-swatches/view/base/web/js/swatch-renderer.js index 740eb5e07b99b..a4c3d0f419624 100644 --- a/vendor/magento/module-swatches/view/base/web/js/swatch-renderer.js +++ b/vendor/magento/module-swatches/view/base/web/js/swatch-renderer.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2015 Adobe + * All Rights Reserved. */ define([ @@ -1326,7 +1326,13 @@ define([ * @private */ _addFotoramaVideoEvents: function (isInitial) { - if (_.isUndefined($.mage.AddFotoramaVideoEvents)) { + if (_.isUndefined($.mage.AddFotoramaVideoEvents) + || !$(this.options.mediaGallerySelector).AddFotoramaVideoEvents('instance') + ) { + $(this.options.mediaGallerySelector).on('addfotoramavideoeventscreate', function () { + this._addFotoramaVideoEvents(isInitial); + }.bind(this)); + return; }