wickes-css2 2.107.0-ripple.2 → 2.107.0-ripple.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/css/category-main.css +1 -1
- package/build/css/components/card-product-banner.css +1 -1
- package/build/css/components/checkout-chip.css +1 -1
- package/build/css/components/checkout-payment-details-v2.css +1 -1
- package/build/css/components/price-block-v2-critical.css +1 -1
- package/build/css/components/price-block-v2.css +1 -1
- package/build/css/components/special-opening-schedule-v2.css +1 -1
- package/build/css/components/special-opening-schedule.css +1 -1
- package/build/css/emulation.css +1 -1
- package/build/css/homepage-main.css +1 -1
- package/build/css/kitchen-plp-main.css +1 -1
- package/build/css/main.css +1 -1
- package/build/css/my-account-main-v2.css +1 -1
- package/build/css/my-account-main.css +1 -1
- package/build/css/pages/checkout-new.css +1 -1
- package/build/css/pages/my-account-v2.css +1 -1
- package/build/css/pages/page_checkout_delivery-new.css +1 -1
- package/build/css/pages/page_merged-basket.css +1 -1
- package/build/css/pages/page_personal-details.css +1 -1
- package/build/css/pages/page_product-details-v2-critical.css +1 -1
- package/build/css/pages/page_product-details-v2.css +1 -1
- package/build/css/pages/page_product-details.css +1 -1
- package/build/css/pages/page_products-list-combined.css +1 -1
- package/build/css/pages/page_products-list.css +1 -1
- package/build/css/pages/page_shopping-cart-v2.css +1 -1
- package/build/css/pages/page_store-locator-details.css +1 -1
- package/build/css/pages/page_store-locator.css +1 -1
- package/build/css/pdp-main-before-combine.css +1 -1
- package/build/css/pdp-main-critical.css +1 -1
- package/build/css/pdp-main-non-critical.css +1 -1
- package/build/css/pdp-main.css +1 -1
- package/build/css/plp-main.css +1 -1
- package/build/css/store-locator-main.css +1 -1
- package/build/js/account-hub.min.js +1 -1
- package/build/js/basket.min.js +2 -2
- package/build/js/bloomreach-widget.min.js +1 -0
- package/build/js/bundle.min.js +1 -1
- package/build/js/checkout.min.js +2 -2
- package/build/js/components/general/accordion.js +69 -0
- package/build/js/components/general/back-to-top.js +45 -0
- package/build/js/components/general/backdrop.js +23 -0
- package/build/js/components/general/cart-slider.js +36 -0
- package/build/js/components/general/clamp-content.js +95 -0
- package/build/js/components/general/clamp.js +216 -0
- package/build/js/components/general/clear-input.js +33 -0
- package/build/js/components/general/cookie-chat-back.js +51 -0
- package/build/js/components/general/cookies-policy.js +9 -0
- package/build/js/components/general/create-popup-slider.js +194 -0
- package/build/js/components/general/device-type.js +6 -0
- package/build/js/components/general/footer.js +67 -0
- package/build/js/components/general/handleAccordion.js +35 -0
- package/build/js/components/general/image-accordion.js +54 -0
- package/build/js/components/general/is-trade-pro.js +38 -0
- package/build/js/components/general/main-nav.js +16 -0
- package/build/js/components/general/main-navigation.js +275 -0
- package/build/js/components/general/notification.js +70 -0
- package/build/js/components/general/offer-banner.js +74 -0
- package/build/js/components/general/scroll-disable.js +54 -0
- package/build/js/components/general/search.js +43 -0
- package/build/js/components/general/snack-bar.js +160 -0
- package/build/js/components/general/sticky_header.js +62 -0
- package/build/js/components/general/switchVat.js +161 -0
- package/build/js/components/general/text-clamp.js +102 -0
- package/build/js/components/general/tooltips.js +8 -0
- package/build/js/components/general/validation.js +48 -0
- package/build/js/emulation.min.js +3377 -164
- package/build/js/general.bundle.min.js +1 -1
- package/build/js/gift-cards.min.js +1 -1
- package/build/js/kitchen/kitchen-plp.min.js +1 -1
- package/build/js/merged-checkout.min.js +2 -2
- package/build/js/mini-basket-slider.min.js +1 -1
- package/build/js/package-bulk-add.min.js +1 -0
- package/build/js/page/basket/mini-basket-total.js +17 -2
- package/build/js/page/bloomreach-widget.js +1148 -0
- package/build/js/page/checkout-payment-details.js +12 -1
- package/build/js/page/checkout.js +1 -1
- package/build/js/page/components/notify-me.js +99 -0
- package/build/js/page/components/order-summary.js +35 -0
- package/build/js/page/plp-load-more.js +81 -66
- package/build/js/page/ripple/bulk-add.js +63 -0
- package/build/js/page/ripple/package-bulk-add.js +43 -0
- package/build/js/page/ripple/postcode-checker.js +83 -0
- package/build/js/page/ripple/thumb-gallery.js +168 -0
- package/build/js/page/utils/create-count-stepper.js +30 -9
- package/build/js/page/utils/create-loading-button.js +37 -0
- package/build/js/page/utils/create-toast.js +79 -0
- package/build/js/page/utils/custom-dropdown.js +80 -0
- package/build/js/pdp-count-stepper.min.js +1 -1
- package/build/js/pdp.bundle.min.js +2 -1
- package/build/js/plp.bundle.min.js +1 -1
- package/build/js/postcode-checker.min.js +1 -0
- package/build/js/project-list.min.js +1 -1
- package/build/js/saving-shopping-list.min.js +1 -1
- package/build/js/wickes-dc.js +1 -0
- package/package.json +1 -4
- package/src/badges-ripple.html +120 -0
- package/src/badges.html +9 -18
- package/src/components/base/button.hbs +23 -5
- package/src/components/bloomreach/complete-card-dropdown.hbs +47 -0
- package/src/components/bloomreach/complete-card-skeleton.hbs +19 -0
- package/src/components/bloomreach/complete-card.hbs +138 -0
- package/src/components/bloomreach/complete-divider.hbs +3 -0
- package/src/components/bloomreach/complete-summary-skeleton.hbs +12 -0
- package/src/components/bloomreach/complete-summary.hbs +43 -0
- package/src/components/bloomreach/complete-wrapper.hbs +1 -0
- package/src/components/bloomreach/complete-your-project.hbs +21 -0
- package/src/components/card-store-locator.hbs +70 -33
- package/src/components/card_bloomreach_media_banner.hbs +10 -0
- package/src/components/card_product_banner_v2.hbs +4 -1
- package/src/components/card_sponsor_banner.hbs +4 -1
- package/src/components/cart-voucher.hbs +10 -1
- package/src/components/checkout_order-summary-new.hbs +11 -2
- package/src/components/click-and-collect-modal.hbs +0 -14
- package/src/components/date-selection.hbs +1 -1
- package/src/components/delivery-types.hbs +11 -3
- package/src/components/fulfilment-accordions.hbs +1 -1
- package/src/components/gift-cards.hbs +1 -1
- package/src/components/injected-content.hbs +6 -1
- package/src/components/kitchen/price.hbs +49 -29
- package/src/components/kitchen/strip-stickers.hbs +9 -3
- package/src/components/modal.hbs +1 -1
- package/src/components/modals/notify-me-modal.hbs +76 -0
- package/src/components/order-item.hbs +18 -5
- package/src/components/order-summary.hbs +2 -2
- package/src/components/package-card.hbs +30 -0
- package/src/components/pdp-price-actions.hbs +17 -0
- package/src/components/postcode-checker.hbs +24 -0
- package/src/components/potential-promotion.hbs +12 -3
- package/src/components/price-badges.hbs +14 -0
- package/src/components/price-block-v2.hbs +91 -31
- package/src/components/product-main-info-v2.hbs +2 -0
- package/src/components/sponsor-top-banner.hbs +10 -0
- package/src/components/suite-includes.hbs +43 -12
- package/src/components/suite-product-card.hbs +37 -15
- package/src/components/thumb-gallery.hbs +23 -0
- package/src/data/data_badges.json +143 -0
- package/src/data/data_bathroom-plp.json +814 -0
- package/src/data/data_delivery-address-v2.json +1 -1
- package/src/data/data_locators.json +441 -135
- package/src/data/data_search-results_v2.json +20 -2
- package/src/data/data_shopping-cart-v2.json +23 -5
- package/src/data/data_spr_injected_content.json +4 -0
- package/src/data/data_suite-includes-products.json +73 -2
- package/src/elements/checkbox.hbs +8 -1
- package/src/js/components/banner-placement-manager.js +25 -9
- package/src/js/components/general/accordion.js +25 -2
- package/src/js/components/general/cart-slider.js +19 -6
- package/src/js/components/package-card.js +69 -0
- package/src/js/components/store-locator-cards.js +76 -0
- package/src/js/emulation/banner-placement-manager.js +285 -53
- package/src/js/emulation/bloomreach-widget-calculations.js +132 -0
- package/src/js/emulation/bloomreach-widget-loading.js +11 -0
- package/src/js/emulation/checkout-delivery-details.js +28 -25
- package/src/js/emulation/custom-slider-emulation.js +1 -1
- package/src/js/emulation/date-selection.js +136 -24
- package/src/js/emulation/forms.js +12 -0
- package/src/js/emulation/gift-cards.js +1 -1
- package/src/js/emulation/mini-basket-data.js +3 -3
- package/src/js/emulation/mock.js +3112 -4
- package/src/js/emulation/notify-me.js +9 -0
- package/src/js/emulation/plp-load-more.js +13 -4
- package/src/js/emulation/postcode-checker.js +11 -0
- package/src/js/emulation/store-locator-load-more.js +69 -0
- package/src/js/emulation/switchCalendar.js +12 -8
- package/src/js/page/basket/mini-basket-total.js +17 -2
- package/src/js/page/bloomreach-widget.js +1148 -0
- package/src/js/page/checkout-payment-details.js +12 -1
- package/src/js/page/checkout.js +1 -1
- package/src/js/page/components/notify-me.js +99 -0
- package/src/js/page/components/order-summary.js +35 -0
- package/src/js/page/plp-load-more.js +81 -66
- package/src/js/page/ripple/bulk-add.js +63 -0
- package/src/js/page/ripple/package-bulk-add.js +43 -0
- package/src/js/page/ripple/postcode-checker.js +83 -0
- package/src/js/page/ripple/thumb-gallery.js +168 -0
- package/src/js/page/utils/create-count-stepper.js +30 -9
- package/src/js/page/utils/create-loading-button.js +37 -0
- package/src/js/page/utils/create-toast.js +79 -0
- package/src/js/page/utils/custom-dropdown.js +80 -0
- package/src/page_bathroom-plp-vat.html +81 -0
- package/src/page_bathroom-plp-without-load-more.html +83 -0
- package/src/page_bathroom-plp.html +98 -0
- package/src/page_checkout_next-day-delivery-details.html +2 -2
- package/src/page_checkout_payment-details-v2-asm.html +1 -1
- package/src/page_checkout_payment-details-v2.html +1 -1
- package/src/page_checkout_payment-details_with-card-loader.html +1 -1
- package/src/page_checkout_payment-details_with-klarna-loader.html +1 -1
- package/src/page_checkout_payment-details_with-loader-v2.html +1 -1
- package/src/page_checkout_rapid-delivery-details.html +7 -5
- package/src/page_klarna_payment-details_with-klarna.html +1 -1
- package/src/page_my-account-installer-carousel.html +131 -0
- package/src/page_payment-details-with-billie.html +1 -1
- package/src/page_payment-details-with-clearpay.html +1 -1
- package/src/page_payment-details-with-gift-card.html +1 -1
- package/src/page_payment-details_with_apple-pay.html +1 -1
- package/src/page_payment-details_with_google-pay.html +1 -1
- package/src/page_plp_bloomreach.html +81 -0
- package/src/page_plp_v2.html +6 -0
- package/src/page_product-details-banner.html +1 -4
- package/src/page_product-details-big-wins-disabled-delivery.html +1 -4
- package/src/page_product-details-big-wins-non-registered.html +1 -4
- package/src/page_product-details-big-wins-out-nearest.html +1 -4
- package/src/page_product-details-big-wins-unhappy.html +1 -4
- package/src/page_product-details-big-wins.html +1 -4
- package/src/page_product-details-billie.html +1 -4
- package/src/page_product-details-bloomreach.html +130 -0
- package/src/page_product-details-calculator.html +1 -4
- package/src/page_product-details-cashback-v2.html +1 -4
- package/src/page_product-details-clearpay.html +1 -4
- package/src/page_product-details-cnc-error-notification.html +1 -4
- package/src/page_product-details-cnc-success-notification-vat.html +1 -5
- package/src/page_product-details-cnc-success-notification.html +1 -4
- package/src/page_product-details-default-store.html +1 -4
- package/src/page_product-details-energy-efficiency.html +1 -4
- package/src/page_product-details-flooring-with-pr-placeholder.html +1 -4
- package/src/page_product-details-flooring.html +1 -4
- package/src/page_product-details-gallery-actual.html +1 -4
- package/src/page_product-details-mfe-calculator.html +10 -7
- package/src/page_product-details-minimum-v2.html +0 -1
- package/src/page_product-details-mtm-doors.html +1 -4
- package/src/page_product-details-only-clearpay.html +1 -4
- package/src/page_product-details-paint-mixing.html +1 -4
- package/src/page_product-details-ripple-gallery.html +119 -0
- package/src/page_product-details-saved-pl.html +1 -4
- package/src/page_product-details-suite-includes-banners.html +139 -0
- package/src/page_product-details-suite-includes-vat.html +126 -0
- package/src/page_product-details-suite-includes.html +32 -20
- package/src/page_product-details-tile-steps-klarna-widget-with-method-ids.html +1 -4
- package/src/page_product-details-tile-steps-logout.html +1 -4
- package/src/page_product-details-tile-steps-no-new-project-list.html +1 -4
- package/src/page_product-details-tile-steps-with-klarna.html +1 -4
- package/src/page_product-details-tile-steps.html +1 -4
- package/src/page_product-details-v2.html +1 -4
- package/src/page_product-details-vat.html +1 -4
- package/src/page_product-details-wisdom-mcfc-registered.html +1 -4
- package/src/page_product-details-wisdom-mcfc.html +1 -4
- package/src/page_product-details-wisdom-oos-registered.html +1 -4
- package/src/page_product-details-wisdom-oos.html +1 -4
- package/src/page_product-details-wisdom-registered.html +1 -4
- package/src/page_product-details-wisdom.html +1 -4
- package/src/page_product-details-with-favourite.html +1 -4
- package/src/page_product-details-with-global-search-v2.html +8 -4
- package/src/page_product-details_no-previous-default.html +1 -4
- package/src/page_shopping-cart-v2-vat.html +2 -1
- package/src/page_store-locator-list.html +17 -28
- package/src/page_track-my-order-result.html +1 -0
- package/src/partials/scripts.hbs +1 -0
- package/src/scss/common/_CTAs.scss +7 -3
- package/src/scss/common/_common.scss +1 -0
- package/src/scss/common/_elements.scss +13 -1
- package/src/scss/common/_loading-button.scss +49 -0
- package/src/scss/components/_card-store-locator.scss +139 -32
- package/src/scss/components/_custom-slider.scss +18 -0
- package/src/scss/components/_date-selection-add-new-styles.scss +43 -1
- package/src/scss/components/_image-accordion.scss +5 -2
- package/src/scss/components/_kitchen-card.scss +5 -4
- package/src/scss/components/_notifications.scss +86 -5
- package/src/scss/components/_notify-me-modal.scss +139 -0
- package/src/scss/components/_order-summary.scss +25 -12
- package/src/scss/components/_package-card.scss +63 -0
- package/src/scss/components/_package-plp.scss +88 -0
- package/src/scss/components/_pdp-action-v2-critical.scss +12 -0
- package/src/scss/components/_pdp-action-v2.scss +12 -0
- package/src/scss/components/_postcode-checker.scss +115 -0
- package/src/scss/components/_price-badges-critical.scss +10 -1
- package/src/scss/components/_price-badges.scss +10 -2
- package/src/scss/components/_price-block-critical.scss +11 -3
- package/src/scss/components/_price-block.scss +15 -4
- package/src/scss/components/_suite-includes.scss +29 -26
- package/src/scss/components/_suite-product-card.scss +33 -23
- package/src/scss/components/_thumb-gallery-critical.scss +34 -0
- package/src/scss/components/_thumb-gallery.scss +192 -0
- package/src/scss/components/bloomreach/_bloomreach.scss +3 -0
- package/src/scss/components/bloomreach/_complete-card-dropdown.scss +174 -0
- package/src/scss/components/bloomreach/_complete-card.scss +402 -0
- package/src/scss/components/bloomreach/_complete-your-project.scss +207 -0
- package/src/scss/components/card-product-banner.scss +35 -27
- package/src/scss/components/checkout-chip.scss +1 -0
- package/src/scss/components/checkout-payment-details-v2.scss +12 -0
- package/src/scss/components/kitchen/_price.scss +10 -0
- package/src/scss/components/kitchen/_strip-stickers.scss +46 -0
- package/src/scss/components/my-account/_clipboard-code.scss +4 -0
- package/src/scss/components/price-block-v2-critical.scss +54 -1
- package/src/scss/components/price-block-v2.scss +54 -3
- package/src/scss/components/special-opening-schedule-v2.scss +2 -6
- package/src/scss/components/special-opening-schedule.scss +17 -4
- package/src/scss/emulation.scss +0 -6
- package/src/scss/helpers/_CTAs.scss +15 -5
- package/src/scss/helpers/_variables.scss +1 -0
- package/src/scss/pages/page_checkout_delivery-new.scss +36 -0
- package/src/scss/pages/page_product-details-v2-critical.scss +217 -111
- package/src/scss/pages/page_product-details-v2.scss +200 -109
- package/src/scss/pages/page_product-details.scss +0 -2
- package/src/scss/pages/page_products-list-combined.scss +8 -1
- package/src/scss/pages/page_products-list.scss +8 -1
- package/src/scss/pages/page_shopping-cart-v2.scss +34 -10
- package/src/scss/pages/page_store-locator.scss +48 -26
- package/src/scss/pdp-main-critical.scss +1 -1
- package/src/scss/pdp-main.scss +5 -1
- package/src/scss/plp-main.scss +5 -0
- package/src/scss/store-locator-main.scss +15 -1
- package/src/sitemap.html +15 -0
- package/build/css/components/kitchen/strip-stickers.css +0 -1
- package/build/css/components/strip-stickers.css +0 -1
- package/src/js/emulation/store-locator-list.js +0 -19
- package/src/scss/components/kitchen/strip-stickers.scss +0 -18
- package/src/scss/components/strip-stickers.scss +0 -18
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
function createEvent(eventName, payload, eventDetail) {
|
|
2
|
+
return new CustomEvent(eventName, {
|
|
3
|
+
detail: {
|
|
4
|
+
payload,
|
|
5
|
+
resolve: eventDetail.resolve,
|
|
6
|
+
reject: eventDetail.reject,
|
|
7
|
+
},
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* eslint-disable no-unused-vars -- used globally */
|
|
12
|
+
function createPopupSlider({ type, sliderSelector, onAppendEvent, onAppend, onClose }) {
|
|
13
|
+
const events = {
|
|
14
|
+
CLOSE_JUST_ADDED: 'CLOSE_JUST_ADDED',
|
|
15
|
+
CLOSE_MINI_BASKET: 'CLOSE_MINI_BASKET',
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const el = {
|
|
19
|
+
$body: $('body'),
|
|
20
|
+
slider: sliderSelector,
|
|
21
|
+
sliderWrap: `${sliderSelector} .custom-slider__wrap`,
|
|
22
|
+
sliderWrapScroll: 'custom-slider__wrap--scroll',
|
|
23
|
+
footer: '.custom-slider__footer',
|
|
24
|
+
closePopup: `${sliderSelector} .close-popup`,
|
|
25
|
+
$stickyWrapper: $('.sticky-wrapper'),
|
|
26
|
+
$headerWrapper: $('.header-wrapper'),
|
|
27
|
+
scrollDisable: 'slider-scroll-disable',
|
|
28
|
+
footerFixed: 'footer-fixed',
|
|
29
|
+
btnMiniBasket: '.header-minicart__btn',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
function isSmallBreakpoint() {
|
|
33
|
+
return Wick.Responsive.getCurrentBreakpoint() === 'down-sm';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function getAnimationClass() {
|
|
37
|
+
return isSmallBreakpoint() ? 'bottom-to-top' : 'right-to-left';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function adjustHeight() {
|
|
41
|
+
const stickyWrapperHeight = el.$stickyWrapper.outerHeight() || 0;
|
|
42
|
+
const headerWrapperHeight = el.$headerWrapper.outerHeight() || 0;
|
|
43
|
+
|
|
44
|
+
const totalHeight = stickyWrapperHeight + headerWrapperHeight;
|
|
45
|
+
$(el.slider).css('height', `calc(100% - ${totalHeight}px)`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function hideSlider() {
|
|
49
|
+
$(el.slider).removeClass('show');
|
|
50
|
+
|
|
51
|
+
setTimeout(() => {
|
|
52
|
+
el.$body.removeClass(el.scrollDisable);
|
|
53
|
+
|
|
54
|
+
if (!isSmallBreakpoint()) {
|
|
55
|
+
el.$body.css('padding-right', '');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (type === 'cart') {
|
|
59
|
+
$(el.slider).removeAttr('style').empty();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
$(el.slider).addClass('d-none');
|
|
63
|
+
}, 400);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function handleScroll(sliderWrap) {
|
|
67
|
+
const scrollHeight = $(sliderWrap)[0].scrollHeight;
|
|
68
|
+
const scrollTop = $(sliderWrap).scrollTop();
|
|
69
|
+
const clientHeight = $(sliderWrap)[0].clientHeight;
|
|
70
|
+
const scrollBottom = scrollHeight - scrollTop - clientHeight;
|
|
71
|
+
|
|
72
|
+
if (scrollBottom > 75) {
|
|
73
|
+
$(el.footer).addClass(el.footerFixed);
|
|
74
|
+
$(sliderWrap).addClass(el.sliderWrapScroll);
|
|
75
|
+
} else {
|
|
76
|
+
$(el.footer).removeClass(el.footerFixed);
|
|
77
|
+
$(sliderWrap).removeClass(el.sliderWrapScroll);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function showSlider() {
|
|
82
|
+
if (isSmallBreakpoint()) {
|
|
83
|
+
adjustHeight();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const animationClass = getAnimationClass();
|
|
87
|
+
const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
88
|
+
$(el.slider).removeClass('bottom-to-top right-to-left').addClass(animationClass);
|
|
89
|
+
|
|
90
|
+
$('html, body').animate({ scrollTop: 0 }, 300, () => {
|
|
91
|
+
Wick.Backdrop.show();
|
|
92
|
+
$(el.slider).removeClass('d-none');
|
|
93
|
+
|
|
94
|
+
setTimeout(() => {
|
|
95
|
+
$(el.slider).addClass('show');
|
|
96
|
+
handleScroll(el.sliderWrap);
|
|
97
|
+
el.$body.addClass(el.scrollDisable);
|
|
98
|
+
|
|
99
|
+
if (!isSmallBreakpoint()) {
|
|
100
|
+
el.$body.css('padding-right', `${scrollBarWidth}px`);
|
|
101
|
+
}
|
|
102
|
+
}, 100);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function handleSliderClose(eventName) {
|
|
107
|
+
return new Promise((resolve, reject) => {
|
|
108
|
+
const eventDetail = { resolve, reject };
|
|
109
|
+
const event = createEvent(eventName, {}, eventDetail);
|
|
110
|
+
window.dispatchEvent(event);
|
|
111
|
+
})
|
|
112
|
+
.then(() => {})
|
|
113
|
+
.catch((error) => {
|
|
114
|
+
console.error(error);
|
|
115
|
+
})
|
|
116
|
+
.finally(() => {
|
|
117
|
+
hideSlider();
|
|
118
|
+
Wick.Backdrop.hide();
|
|
119
|
+
if (typeof onClose === 'function') {
|
|
120
|
+
onClose();
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function bindClosePopup() {
|
|
126
|
+
$(document).on('click', el.closePopup, async () => {
|
|
127
|
+
if (type === 'cart') {
|
|
128
|
+
await handleSliderClose(events.CLOSE_JUST_ADDED);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (type === 'miniBasket') {
|
|
132
|
+
await handleSliderClose(events.CLOSE_MINI_BASKET);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
hideSlider();
|
|
136
|
+
Wick.Backdrop.hide();
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function handleResize() {
|
|
141
|
+
const animationClass = getAnimationClass();
|
|
142
|
+
|
|
143
|
+
if ($(el.slider).hasClass('show')) {
|
|
144
|
+
$(el.slider).removeClass('bottom-to-top right-to-left').addClass(animationClass);
|
|
145
|
+
|
|
146
|
+
if (isSmallBreakpoint()) {
|
|
147
|
+
adjustHeight();
|
|
148
|
+
} else {
|
|
149
|
+
$(el.slider).css('height', '');
|
|
150
|
+
Wick.Backdrop.show();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function shouldClosePopup(event) {
|
|
156
|
+
const $target = $(event.target);
|
|
157
|
+
return (
|
|
158
|
+
!$target.closest(el.slider).length &&
|
|
159
|
+
!$target.closest(el.closePopup).length &&
|
|
160
|
+
$(el.slider).hasClass('show')
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function init() {
|
|
165
|
+
bindClosePopup();
|
|
166
|
+
|
|
167
|
+
if (onAppendEvent && onAppend) {
|
|
168
|
+
window.addEventListener(onAppendEvent, (event) => {
|
|
169
|
+
onAppend(event, { showSlider, handleScroll, el });
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
$(window).on('resize', _.debounce(handleResize, 100));
|
|
174
|
+
|
|
175
|
+
$('body').on('click', async (event) => {
|
|
176
|
+
if (shouldClosePopup(event)) {
|
|
177
|
+
if (type === 'cart') {
|
|
178
|
+
await handleSliderClose(events.CLOSE_JUST_ADDED);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (type === 'miniBasket') {
|
|
182
|
+
await handleSliderClose(events.CLOSE_MINI_BASKET);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
init();
|
|
189
|
+
|
|
190
|
+
return {
|
|
191
|
+
showSlider,
|
|
192
|
+
handleScroll,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var Wick = Wick || {};
|
|
2
|
+
Wick.Footer = (function(){
|
|
3
|
+
let $accordion = $('.footer-menu__inner .accordion'),
|
|
4
|
+
$accordionContent = $('.footer-menu__inner .accordion__content'),
|
|
5
|
+
$paymentList = $('footer .payments__list'),
|
|
6
|
+
$waysToPayList = $('footer .payways__list'),
|
|
7
|
+
$paymentListCheckoutFooter = $('footer .payments-checkout__list'),
|
|
8
|
+
$paymentListOrderSummery = $('.right-aside .footer-checkout .payments-checkout__list'),
|
|
9
|
+
paymentSmallListClass = 'payments__list--small',
|
|
10
|
+
waysToPaySmallListClass = 'payways__list--small',
|
|
11
|
+
paymentCheckoutSmallListClass = 'payments-checkout__list--small',
|
|
12
|
+
collapsedState = "accordion_collapsed",
|
|
13
|
+
windowWidth = $(window).width();
|
|
14
|
+
|
|
15
|
+
const elementClassAdjustments = [
|
|
16
|
+
{ $element: $paymentList, count: 6, className: paymentSmallListClass },
|
|
17
|
+
{ $element: $paymentListOrderSummery, count: 6, className: paymentCheckoutSmallListClass, isGreaterThan: true },
|
|
18
|
+
{ $element: $paymentListCheckoutFooter, count: 6, className: paymentCheckoutSmallListClass, isGreaterThan: false },
|
|
19
|
+
{ $element: $waysToPayList, count: 6, className: waysToPaySmallListClass, isGreaterThan: false, checkForWindowWidth: true }
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
function accordionClickHandler() {
|
|
23
|
+
if ($(this).find($accordionContent).is(':visible')) {
|
|
24
|
+
$accordionContent.hide()
|
|
25
|
+
$accordion.not($(this)).removeClass(collapsedState)
|
|
26
|
+
$(this).find($accordionContent).show()
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function applyClassBasedOnChildrenCount($element, count, className, isGreaterThan = false, checkForWindowWidth = false) {
|
|
31
|
+
let hasEnoughChildren = isGreaterThan ? $element.children().length > count : $element.children().length < count;
|
|
32
|
+
|
|
33
|
+
if(checkForWindowWidth && windowWidth < 576) {
|
|
34
|
+
if(hasEnoughChildren) {
|
|
35
|
+
$element.addClass(className);
|
|
36
|
+
}
|
|
37
|
+
} else if (!checkForWindowWidth) {
|
|
38
|
+
if(hasEnoughChildren) {
|
|
39
|
+
$element.addClass(className);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function onWindowResize() {
|
|
45
|
+
windowWidth = $(window).width();
|
|
46
|
+
|
|
47
|
+
let isChildrenCountLessThanSix = $waysToPayList.children().length < 6;
|
|
48
|
+
|
|
49
|
+
if(isChildrenCountLessThanSix && windowWidth > 576 ) {
|
|
50
|
+
$waysToPayList.removeClass(waysToPaySmallListClass);
|
|
51
|
+
} else if (isChildrenCountLessThanSix) {
|
|
52
|
+
$waysToPayList.addClass(waysToPaySmallListClass);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function init () {
|
|
57
|
+
$accordion.click(accordionClickHandler);
|
|
58
|
+
|
|
59
|
+
elementClassAdjustments.forEach(function(item) {
|
|
60
|
+
applyClassBasedOnChildrenCount(item.$element, item.count, item.className, item.isGreaterThan, item.checkForWindowWidth);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
$(window).resize(_.debounce(onWindowResize, 200));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
init();
|
|
67
|
+
})();
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var Wick = Wick || {};
|
|
2
|
+
|
|
3
|
+
Wick.HandleAccordions = {
|
|
4
|
+
el: {
|
|
5
|
+
$body: $('body'),
|
|
6
|
+
$accordions: $(".account-nav .accordion"),
|
|
7
|
+
accordionContent: '.accordion__content',
|
|
8
|
+
accordionHeader: '.accordion__header',
|
|
9
|
+
accordionCollapsed: 'accordion_collapsed',
|
|
10
|
+
},
|
|
11
|
+
handleOutsideClick() {
|
|
12
|
+
document.addEventListener("click", function (event) {
|
|
13
|
+
Wick.HandleAccordions.el.$accordions.each(function () {
|
|
14
|
+
const $accordion = $(this);
|
|
15
|
+
const $content = $accordion.find(Wick.HandleAccordions.el.accordionContent);
|
|
16
|
+
const $toggle = $accordion.find(Wick.HandleAccordions.el.accordionHeader);
|
|
17
|
+
|
|
18
|
+
const toggleButton = $toggle[0];
|
|
19
|
+
const content = $content[0];
|
|
20
|
+
|
|
21
|
+
if (!toggleButton || !content) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (!toggleButton.contains(event.target) && !content.contains(event.target)) {
|
|
26
|
+
if ($content.is(":visible")) {
|
|
27
|
+
$content.hide();
|
|
28
|
+
$accordion.addClass(Wick.HandleAccordions.el.accordionCollapsed);
|
|
29
|
+
$accordion.attr("aria-expanded", "false");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var Wick = Wick || {};
|
|
2
|
+
Wick.ImageAccordion = (function () {
|
|
3
|
+
const CONFIG = {
|
|
4
|
+
animationDuration: 200,
|
|
5
|
+
collapsedText: 'See details',
|
|
6
|
+
expandedText: 'Hide details',
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const SELECTORS = {
|
|
10
|
+
root: '.image-accordion',
|
|
11
|
+
toggler: '.image-accordion__header',
|
|
12
|
+
content: '.image-accordion__content',
|
|
13
|
+
headerText: '.image-accordion__header-text',
|
|
14
|
+
collapsedClass: 'image-accordion--collapsed',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function handleToggle(e) {
|
|
18
|
+
var $trigger = $(e.currentTarget);
|
|
19
|
+
var $accordion = $trigger.closest(SELECTORS.root);
|
|
20
|
+
|
|
21
|
+
if (!$accordion.length) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var $triggerSel = $(SELECTORS.toggler);
|
|
26
|
+
|
|
27
|
+
if (!$trigger.is($triggerSel)) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var $headerText = $accordion.find(SELECTORS.headerText);
|
|
32
|
+
|
|
33
|
+
$accordion.toggleClass(SELECTORS.collapsedClass);
|
|
34
|
+
|
|
35
|
+
$headerText.text(
|
|
36
|
+
$accordion.hasClass(SELECTORS.collapsedClass)
|
|
37
|
+
? CONFIG.collapsedText
|
|
38
|
+
: CONFIG.expandedText
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
$accordion
|
|
42
|
+
.children(SELECTORS.content)
|
|
43
|
+
.stop(true, true)
|
|
44
|
+
.slideToggle(CONFIG.animationDuration);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function init() {
|
|
48
|
+
$(document)
|
|
49
|
+
.off('click.wickImageAccordion', SELECTORS.toggler)
|
|
50
|
+
.on('click.wickImageAccordion', SELECTORS.toggler, handleToggle);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
init();
|
|
54
|
+
})();
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var Wick = Wick || {};
|
|
2
|
+
Wick.isTradeProAndroid = (function(){
|
|
3
|
+
if (navigator.userAgent.match(/TradeProMobile_Android|DIYMobile_Android/i)) {
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
})();
|
|
7
|
+
|
|
8
|
+
Wick.isTradeProiOS = (function(){
|
|
9
|
+
if (navigator.userAgent.match(/TradeProMobile_iOS|DIYMobile_iOS/i)) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
})();
|
|
13
|
+
|
|
14
|
+
Wick.isTradePro = (function(){
|
|
15
|
+
if (navigator.userAgent.match(/TradeProMobile_iOS|TradeProMobile_Android|DIYMobile_iOS|DIYMobile_Android/i)) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
})();
|
|
19
|
+
|
|
20
|
+
$(document).ready(function () {
|
|
21
|
+
if (navigator.userAgent.match(/TradeProMobile_iOS|TradeProMobile_Android|DIYMobile_iOS|DIYMobile_Android/i)) {
|
|
22
|
+
$('body').addClass('tp-app');
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
$(function() {
|
|
27
|
+
if (Wick.isTradeProAndroid) {
|
|
28
|
+
$('body').addClass('tp-android');
|
|
29
|
+
}
|
|
30
|
+
if (Wick.isTradeProiOS) {
|
|
31
|
+
$('body').addClass('tp-ios');
|
|
32
|
+
if (
|
|
33
|
+
window.matchMedia('(min-width: 768px)').matches
|
|
34
|
+
) {
|
|
35
|
+
$('body').addClass('tp-ios-notch');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var Wick = Wick || {};
|
|
2
|
+
|
|
3
|
+
Wick.MainNav = (function () {
|
|
4
|
+
return {
|
|
5
|
+
createMainNav: function () {
|
|
6
|
+
Wick.Nav();
|
|
7
|
+
Wick.Responsive.callBr();
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
})();
|
|
11
|
+
|
|
12
|
+
$(document).ready(function () {
|
|
13
|
+
if (!$('#main-nav').length) return;
|
|
14
|
+
|
|
15
|
+
Wick.MainNav.createMainNav();
|
|
16
|
+
});
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
var Wick = Wick || {};
|
|
2
|
+
Wick.Nav = function () {
|
|
3
|
+
var $nav = $('.main-nav'),
|
|
4
|
+
navs = [
|
|
5
|
+
'.main-nav__top-level-wrap',
|
|
6
|
+
'.main-nav__menu-wrapper',
|
|
7
|
+
'.main-nav__sub-menu__wrapper',
|
|
8
|
+
'.main-nav__offers',
|
|
9
|
+
'.main-nav__sub-sub-menu__wrapper'
|
|
10
|
+
],
|
|
11
|
+
navItems = [
|
|
12
|
+
'.main-nav__top-level__item',
|
|
13
|
+
'.main-nav__menu__item',
|
|
14
|
+
'.main-nav__sub-menu__item, .main-nav__offers__wrapper',
|
|
15
|
+
'.main-nav__sub-menu__item',
|
|
16
|
+
'.main-nav__sub-sub-menu__item'
|
|
17
|
+
],
|
|
18
|
+
navLabels = [
|
|
19
|
+
'.main-nav__top-level__label'
|
|
20
|
+
],
|
|
21
|
+
navDropdown = [
|
|
22
|
+
'.main-nav__menu__label',
|
|
23
|
+
'.main-nav__sub-menu__label'
|
|
24
|
+
],
|
|
25
|
+
currentLevel = 0,
|
|
26
|
+
desktopNav,
|
|
27
|
+
mobileNav,
|
|
28
|
+
navSubMenuIsHovered = false;
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
function setBottomShadowWhenNoBreadcrumbs() {
|
|
32
|
+
if (!$('.breadcrumbs').length) {
|
|
33
|
+
$nav.addClass('with-bottom-shadow');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function setActiveLink() {
|
|
38
|
+
const pathname = location.pathname.toLowerCase();
|
|
39
|
+
$('.main-nav li:not(.main-nav__sub-menu__view-more) > a').each(function() {
|
|
40
|
+
const link = $(this).attr('href') || '';
|
|
41
|
+
const lowerCaseLink = link.toLowerCase();
|
|
42
|
+
|
|
43
|
+
if (pathname.endsWith(lowerCaseLink)) {
|
|
44
|
+
$(this).addClass('active');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const replacedLink = replaceAndWithPlusSymbol(lowerCaseLink);
|
|
48
|
+
if(pathname.endsWith(replacedLink)) {
|
|
49
|
+
$(this).addClass('active');
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function replaceAndWithPlusSymbol(link) {
|
|
55
|
+
return link.replace(/-and-/g, '+')
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function setCurrentVisibleLevel(lvl) {
|
|
59
|
+
$nav.attr('data-active-lvl', lvl);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function resetSectionHeight(sectionName) {
|
|
63
|
+
$(sectionName).removeAttr('style');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function resizeNavSection(firstSection, SecondSection, padding) {
|
|
67
|
+
if (padding == null) {
|
|
68
|
+
padding = 0;
|
|
69
|
+
}
|
|
70
|
+
$(firstSection).css({"min-height": $(SecondSection).height() + padding});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function mobileNavigation() {
|
|
74
|
+
var self = this,
|
|
75
|
+
$btnHamburger = $('.header-hamburger-menu'),
|
|
76
|
+
$navSection = $('.main-nav__section'),
|
|
77
|
+
hamburgerState = 'header-hamburger-menu_close-visible',
|
|
78
|
+
$btnBack = $('.main-nav__back-btn'),
|
|
79
|
+
$navOpener = $(navLabels.join(',')),
|
|
80
|
+
$navDropdown = $(navDropdown.join(',')),
|
|
81
|
+
mobileNavBodyClass = 'mobile-nav-opened',
|
|
82
|
+
isHidden = 'js-down-sm-hidden',
|
|
83
|
+
isVisible = 'js-visible';
|
|
84
|
+
isOpen = 'js-open';
|
|
85
|
+
|
|
86
|
+
this.toggleNavVisibility = function () {
|
|
87
|
+
$btnHamburger.toggleClass(hamburgerState);
|
|
88
|
+
$nav.toggleClass(isVisible);
|
|
89
|
+
$('main, footer').toggleClass(isHidden);
|
|
90
|
+
$(document).trigger('mobileNav.toggle');
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
this.toggleBodyClass = function () {
|
|
94
|
+
$('body').toggleClass(mobileNavBodyClass);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
this.checkLink = function($link) {
|
|
98
|
+
if ($link.hasClass("main-nav__offers__label")) {
|
|
99
|
+
if (!$link.is(navLabels[currentLevel]) || !$link.nextAll(navs.join(',')).length) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
// Click on link from previous level or without submenu will directly follow the link
|
|
104
|
+
if (!$link.is(navLabels[currentLevel - 1]) || !$link.nextAll(navs.join(',')).length) {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return false
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
this.showNavSection = function (e) {
|
|
113
|
+
var $link = $(this);
|
|
114
|
+
|
|
115
|
+
if (self.checkLink($link)) {
|
|
116
|
+
return true
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
$link.parent().addClass(isVisible);
|
|
120
|
+
$navSection.addClass('slide-in');
|
|
121
|
+
|
|
122
|
+
$('html, body').animate({
|
|
123
|
+
scrollTop: $("body").offset().top
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
setTimeout(function () {
|
|
127
|
+
$navSection.removeClass('slide-in');
|
|
128
|
+
}, 300);
|
|
129
|
+
|
|
130
|
+
setCurrentVisibleLevel(++currentLevel);
|
|
131
|
+
return false;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
this.closeOpenSub = function() {
|
|
135
|
+
$('.js-open').removeClass(isOpen)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
this.openSubNavigation = function (e) {
|
|
139
|
+
var $link = $(this).parent();
|
|
140
|
+
|
|
141
|
+
if ($link.hasClass(isOpen)) {
|
|
142
|
+
$link.removeClass(isOpen)
|
|
143
|
+
} else {
|
|
144
|
+
$link.addClass(isOpen)
|
|
145
|
+
$(this).next().focus()
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return false
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
this.handleBackBtnClick = function () {
|
|
152
|
+
$(navItems[currentLevel - 2]).removeClass(isVisible);
|
|
153
|
+
$navSection.addClass('slide-in-l2r');
|
|
154
|
+
setTimeout(function () {
|
|
155
|
+
$navSection.removeClass('slide-in-l2r');
|
|
156
|
+
}, 300);
|
|
157
|
+
self.closeOpenSub()
|
|
158
|
+
|
|
159
|
+
setCurrentVisibleLevel(--currentLevel);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
this.init = function () {
|
|
163
|
+
$btnHamburger.on('click.mobile', function () {
|
|
164
|
+
self.toggleNavVisibility();
|
|
165
|
+
self.toggleBodyClass();
|
|
166
|
+
});
|
|
167
|
+
$navOpener.on('click.mobile', self.showNavSection);
|
|
168
|
+
$navDropdown.on('click.mobile', self.openSubNavigation);
|
|
169
|
+
$btnBack.on('click.mobile', self.handleBackBtnClick);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
this.destroy = function () {
|
|
173
|
+
$btnHamburger.off('.mobile');
|
|
174
|
+
$navOpener.off('.mobile');
|
|
175
|
+
$btnBack.off('.mobile');
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
self.init();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function desktopNavigation() {
|
|
182
|
+
var self = this,
|
|
183
|
+
isHovered = 'is-hovered',
|
|
184
|
+
isHoveredLvl1 = 'is-hovered-lvl-1';
|
|
185
|
+
|
|
186
|
+
this.handleTouchstart = function () {
|
|
187
|
+
console.log('start');
|
|
188
|
+
var $link = $(this),
|
|
189
|
+
$li = $link.parent(),
|
|
190
|
+
hovered = $li.hasClass(isHovered);
|
|
191
|
+
|
|
192
|
+
if (hovered || !$link.nextAll(navs.join(',')).length) {
|
|
193
|
+
$link.data("shouldPrevent", false);
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
$li.siblings().removeClass(isHovered);
|
|
198
|
+
$li.addClass(isHovered);
|
|
199
|
+
$nav.addClass(isHoveredLvl1);
|
|
200
|
+
$link.data("shouldPrevent", true);
|
|
201
|
+
$(document).off("touchstart.leaveNav").on("touchstart.leaveNav", function (e) {
|
|
202
|
+
if (!$(e.target).parents('.main-nav').length) {
|
|
203
|
+
$nav.removeClass(isHoveredLvl1).find(navItems.join(',')).removeClass(isHovered);
|
|
204
|
+
$(document).off("touchstart.leaveNav")
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
this.handleTouchend = function (e) {
|
|
210
|
+
console.log('end');
|
|
211
|
+
$(this).data("shouldPrevent") && e.preventDefault();
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
this.bindHoverEvents = function () {
|
|
215
|
+
$(navItems[0]).on('mouseenter.navDesktop', function () {
|
|
216
|
+
$(this).addClass(isHovered)
|
|
217
|
+
if ($(this).children(navs[1]).length) {
|
|
218
|
+
$nav.addClass(isHoveredLvl1);
|
|
219
|
+
resetSectionHeight(".main-nav__menu-wrapper");
|
|
220
|
+
}
|
|
221
|
+
}).on('mouseleave.navDesktop', function () {
|
|
222
|
+
$(this).removeClass(isHovered)
|
|
223
|
+
$nav.removeClass(isHoveredLvl1);
|
|
224
|
+
$(navItems[1]).removeClass(isHovered);
|
|
225
|
+
resetSectionHeight(".main-nav__menu-wrapper");
|
|
226
|
+
});
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
this.bindTouchEvents = function () {
|
|
230
|
+
$(document).on('touchstart.navTouchStart', navLabels.join(','), self.handleTouchstart);
|
|
231
|
+
$(document).on('touchend.navTouchEnd', navLabels.join(','), self.handleTouchend);
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
this.init = function () {
|
|
235
|
+
if (!Wick.Responsive.isTouchDevice()) {
|
|
236
|
+
self.bindHoverEvents();
|
|
237
|
+
} else {
|
|
238
|
+
self.bindTouchEvents();
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
this.destroy = function () {
|
|
243
|
+
if (!Wick.Responsive.isTouchDevice()) {
|
|
244
|
+
$(navItems.join(',')).off('.navDesktop');
|
|
245
|
+
$(navs.join(',')).off('.navDesktop');
|
|
246
|
+
} else {
|
|
247
|
+
$(document).off('.navTouchStart .navTouchEnd');
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
self.init();
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
var init = function () {
|
|
254
|
+
setBottomShadowWhenNoBreadcrumbs();
|
|
255
|
+
setCurrentVisibleLevel(++currentLevel);
|
|
256
|
+
setActiveLink();
|
|
257
|
+
|
|
258
|
+
Wick.Responsive.onBreakpoint(function () {
|
|
259
|
+
desktopNav && desktopNav.destroy();
|
|
260
|
+
desktopNav = null;
|
|
261
|
+
if (!mobileNav) {
|
|
262
|
+
mobileNav = new mobileNavigation();
|
|
263
|
+
}
|
|
264
|
+
}, 'down-lg');
|
|
265
|
+
Wick.Responsive.onBreakpoint(function () {
|
|
266
|
+
mobileNav && mobileNav.destroy();
|
|
267
|
+
mobileNav = null;
|
|
268
|
+
if (!desktopNav) {
|
|
269
|
+
desktopNav = new desktopNavigation();
|
|
270
|
+
}
|
|
271
|
+
}, 'up-lg');
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
init();
|
|
275
|
+
};
|