From cbafc2c39bbe5ee0dd459f799112d6ed6c84b171 Mon Sep 17 00:00:00 2001 From: David Windell Date: Fri, 18 Aug 2023 12:33:39 +0000 Subject: [PATCH] Update JS to match Magento 2.4.6-p2 --- Magento_Theme/web/js/responsive.js | 77 ------------------------------ Magento_Theme/web/js/theme.js | 24 +++++----- web/js/navigation-menu.js | 6 ++- web/js/responsive.js | 68 -------------------------- web/js/theme.js | 25 ---------- 5 files changed, 17 insertions(+), 183 deletions(-) delete mode 100755 Magento_Theme/web/js/responsive.js delete mode 100755 web/js/responsive.js delete mode 100755 web/js/theme.js diff --git a/Magento_Theme/web/js/responsive.js b/Magento_Theme/web/js/responsive.js deleted file mode 100755 index f146c5b..0000000 --- a/Magento_Theme/web/js/responsive.js +++ /dev/null @@ -1,77 +0,0 @@ -define([ - 'jquery', - 'matchMedia', - 'mage/tabs', - 'domReady!' -], function ($, mediaCheck) { - 'use strict'; - - mediaCheck({ - media: '(min-width: 768px)', - - /** - * Switch to Desktop Version. - */ - entry: function () { - var galleryElement; - - (function () { - - var productInfoMain = $('.product-info-main'), - productInfoAdditional = $('#product-info-additional'); - - if (productInfoAdditional.length) { - productInfoAdditional.addClass('hidden'); - productInfoMain.removeClass('responsive'); - } - - })(); - - galleryElement = $('[data-role=media-gallery]'); - - if (galleryElement.length && galleryElement.data('mageZoom')) { - galleryElement.zoom('enable'); - } - - if (galleryElement.length && galleryElement.data('mageGallery')) { - galleryElement.gallery('option', 'disableLinks', true); - galleryElement.gallery('option', 'showNav', false); - galleryElement.gallery('option', 'showThumbs', true); - } - }, - - /** - * Switch to Mobile Version. - */ - exit: function () { - var galleryElement; - - $('.action.toggle.checkout.progress').on('click.gotoCheckoutProgress', function () { - var myWrapper = '#checkout-progress-wrapper'; - - scrollTo(myWrapper + ' .title'); - $(myWrapper + ' .title').addClass('active'); - $(myWrapper + ' .content').show(); - }); - - $('body').on('click.checkoutProgress', '#checkout-progress-wrapper .title', function () { - $(this).toggleClass('active'); - $('#checkout-progress-wrapper .content').toggle(); - }); - - galleryElement = $('[data-role=media-gallery]'); - - setTimeout(function () { - if (galleryElement.length && galleryElement.data('mageZoom')) { - galleryElement.zoom('disable'); - } - - if (galleryElement.length && galleryElement.data('mageGallery')) { - galleryElement.gallery('option', 'disableLinks', false); - galleryElement.gallery('option', 'showNav', true); - galleryElement.gallery('option', 'showThumbs', false); - } - }, 2000); - } - }); -}); diff --git a/Magento_Theme/web/js/theme.js b/Magento_Theme/web/js/theme.js index 8324201..84cdd18 100755 --- a/Magento_Theme/web/js/theme.js +++ b/Magento_Theme/web/js/theme.js @@ -1,27 +1,27 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + define([ 'jquery', 'mage/smart-keyboard-handler', 'mage/mage', - 'mage/ie-class-fixer', 'domReady!' ], function ($, keyboardHandler) { 'use strict'; - if ($('body').hasClass('checkout-cart-index')) { - if ($('#co-shipping-method-form .fieldset.rates').length > 0 && - $('#co-shipping-method-form .fieldset.rates :checked').length === 0 - ) { - $('#block-shipping').on('collapsiblecreate', function () { - $('#block-shipping').collapsible('forceActivate'); - }); - } - } - $('.cart-summary').mage('sticky', { container: '#maincontent' }); $('.panel.header > .header.links').clone().appendTo('#store\\.links'); + $('#store\\.links li a').each(function () { + var id = $(this).attr('id'); + if (id !== undefined) { + $(this).attr('id', id + '_mobile'); + } + }); keyboardHandler.apply(); -}); +}); \ No newline at end of file diff --git a/web/js/navigation-menu.js b/web/js/navigation-menu.js index 157ac45..ff66fb2 100755 --- a/web/js/navigation-menu.js +++ b/web/js/navigation-menu.js @@ -1,3 +1,7 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ /** * @deprecated * @see lib/web/mage/menu.js @@ -663,4 +667,4 @@ define([ }); return $.mage.navigationMenu; -}); +}); \ No newline at end of file diff --git a/web/js/responsive.js b/web/js/responsive.js deleted file mode 100755 index 5905290..0000000 --- a/web/js/responsive.js +++ /dev/null @@ -1,68 +0,0 @@ -define([ - 'jquery', - 'matchMedia', - 'mage/tabs', - 'domReady!' -], function($, mediaCheck) { - 'use strict'; - - mediaCheck({ - media: '(min-width: 768px)', - // Switch to Desktop Version - entry: function() { - (function() { - - var productInfoMain = $('.product-info-main'), - productInfoAdditional = $('#product-info-additional'); - - if (productInfoAdditional.length) { - productInfoAdditional.addClass('hidden'); - productInfoMain.removeClass('responsive'); - } - - })(); - - var galleryElement = $('[data-role=media-gallery]'); - - if (galleryElement.length && galleryElement.data('mageZoom')) { - galleryElement.zoom('enable'); - } - - if (galleryElement.length && galleryElement.data('mageGallery')) { - galleryElement.gallery('option', 'disableLinks', true); - galleryElement.gallery('option', 'showNav', false); - galleryElement.gallery('option', 'showThumbs', true); - } - }, - // Switch to Mobile Version - exit: function() { - $('.action.toggle.checkout.progress') - .on('click.gotoCheckoutProgress', function() { - var myWrapper = '#checkout-progress-wrapper'; - scrollTo(myWrapper + ' .title'); - $(myWrapper + ' .title').addClass('active'); - $(myWrapper + ' .content').show(); - }); - - $('body') - .on('click.checkoutProgress', '#checkout-progress-wrapper .title', function() { - $(this).toggleClass('active'); - $('#checkout-progress-wrapper .content').toggle(); - }); - - var galleryElement = $('[data-role=media-gallery]'); - - setTimeout(function() { - if (galleryElement.length && galleryElement.data('mageZoom')) { - galleryElement.zoom('disable'); - } - - if (galleryElement.length && galleryElement.data('mageGallery')) { - galleryElement.gallery('option', 'disableLinks', false); - galleryElement.gallery('option', 'showNav', true); - galleryElement.gallery('option', 'showThumbs', false); - } - }, 2000); - } - }); -}); diff --git a/web/js/theme.js b/web/js/theme.js deleted file mode 100755 index 1416945..0000000 --- a/web/js/theme.js +++ /dev/null @@ -1,25 +0,0 @@ -define([ - 'jquery', - 'mage/smart-keyboard-handler', - 'mage/mage', - 'mage/ie-class-fixer', - 'domReady!' -], function($, keyboardHandler) { - 'use strict'; - - if ($('body').hasClass('checkout-cart-index')) { - if ($('#co-shipping-method-form .fieldset.rates').length > 0 && $('#co-shipping-method-form .fieldset.rates :checked').length === 0) { - $('#block-shipping').on('collapsiblecreate', function() { - $('#block-shipping').collapsible('forceActivate'); - }); - } - } - - $('.cart-summary').mage('sticky', { - container: '#maincontent' - }); - - $('.panel.header > .header.links').clone().appendTo('#store\\.links'); - - keyboardHandler.apply(); -});