wickes-css2 2.103.0-IC-976-pre-commit-lint.7 → 2.103.0-IC-976-pre-commit-lint.9
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/Readme.md +0 -1
- package/build/css/category-main.css +1 -1
- package/build/css/components/card-product-banner.css +1 -1
- package/build/css/main.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/plp-main.css +1 -1
- package/build/js/basket.min.js +1 -1
- package/build/js/bundle.min.js +1 -1
- package/build/js/checkout.min.js +1 -1
- package/build/js/emulation.min.js +0 -54
- package/build/js/merged-checkout.min.js +1 -1
- package/build/js/page/plp-cards-v2.js +6 -15
- package/build/js/page/plp-load-more.js +1 -1
- package/build/js/plp.bundle.min.js +1 -1
- package/build/js/project-list.min.js +1 -1
- package/package.json +2 -5
- package/src/components/card_product_v2.hbs +5 -10
- package/src/components/injected-content.hbs +1 -1
- package/src/components/srp-injected.hbs +3 -13
- package/src/data/data_search-results_v2.json +141 -56
- package/src/js/components/product-banner.js +148 -0
- package/src/js/page/plp-cards-v2.js +6 -15
- package/src/js/page/plp-load-more.js +1 -1
- package/src/page_plp_v2.html +7 -16
- package/src/page_search-results.html +2 -12
- package/src/scss/category-main.scss +1 -0
- package/src/scss/components/card-product-banner.scss +3 -91
- package/src/scss/helpers/_colors-semantic.scss +1 -1
- package/src/scss/helpers/_variables.scss +2 -0
- package/src/scss/pages/page_products-list-combined.scss +0 -11
- package/src/scss/pages/page_products-list.scss +0 -8
- package/src/scss/plp-main.scss +1 -0
- package/src/components/card_sponsor_banner.hbs +0 -8
- package/src/components/card_sponsor_product.hbs +0 -6
- package/src/js/components/banner-placement-manager.js +0 -258
- package/src/js/emulation/banner-placement-manager.js +0 -53
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
@include make-col(4);
|
|
5
5
|
margin-bottom: 30px;
|
|
6
6
|
|
|
7
|
-
@include media-breakpoint-down(md) {
|
|
7
|
+
@include media-breakpoint-down(md) {
|
|
8
8
|
@include make-col(6);
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
padding: 0 15px;
|
|
40
40
|
|
|
41
41
|
@include media-breakpoint-down(sm) {
|
|
42
|
-
display: inline-block;
|
|
42
|
+
display: inline-block;
|
|
43
43
|
padding: 0;
|
|
44
44
|
width: 100%;
|
|
45
45
|
}
|
|
@@ -49,92 +49,4 @@
|
|
|
49
49
|
display: inline-block;
|
|
50
50
|
width: 100%;
|
|
51
51
|
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.products-list {
|
|
55
|
-
.card-sponsor-product,
|
|
56
|
-
.card-sponsor-banner {
|
|
57
|
-
@include make-col(4);
|
|
58
|
-
margin-bottom: 0;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.card-sponsor-banner {
|
|
62
|
-
&__link {
|
|
63
|
-
display: inline-block;
|
|
64
|
-
width: 100%;
|
|
65
|
-
height: 100%;
|
|
66
|
-
padding: 0 15px;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
&__image {
|
|
70
|
-
display: inline-block;
|
|
71
|
-
width: 100%;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.card-sponsor-product {
|
|
76
|
-
.product-card {
|
|
77
|
-
max-width: 100%;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.product-card__sponsored {
|
|
82
|
-
@include font-size(12);
|
|
83
|
-
@include line-height(16);
|
|
84
|
-
color: $squant;
|
|
85
|
-
font-weight: 400;
|
|
86
|
-
margin-top: -3px;
|
|
87
|
-
margin-bottom: 15px;
|
|
88
|
-
padding: 2px 4px;
|
|
89
|
-
|
|
90
|
-
&:not(.product-card__sponsored--empty) {
|
|
91
|
-
width: max-content;
|
|
92
|
-
background: $gray-light;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
@include media-breakpoint-down(md) {
|
|
98
|
-
.products-list {
|
|
99
|
-
.card-sponsor-product,
|
|
100
|
-
.card-sponsor-banner {
|
|
101
|
-
@include make-col(6);
|
|
102
|
-
|
|
103
|
-
.card {
|
|
104
|
-
max-width: 100%;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.products-list-v2 {
|
|
110
|
-
.card-sponsor-product:nth-of-type(n+3) {
|
|
111
|
-
.card {
|
|
112
|
-
&:before {
|
|
113
|
-
content: none;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
@include media-breakpoint-down(sm) {
|
|
121
|
-
.products-list {
|
|
122
|
-
.product-card__sponsored {
|
|
123
|
-
margin-right: auto;
|
|
124
|
-
margin-left: auto;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.card-sponsor-banner {
|
|
128
|
-
position: relative;
|
|
129
|
-
|
|
130
|
-
&::after {
|
|
131
|
-
content: '';
|
|
132
|
-
position: absolute;
|
|
133
|
-
bottom: 20px;
|
|
134
|
-
left: 5px;
|
|
135
|
-
width: calc(100% - 10px);
|
|
136
|
-
border-bottom: 1px solid $gray;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
52
|
+
}
|
|
@@ -117,4 +117,4 @@ $checkout-overlay-action-disabled: rgba($green, .6); // 60% opacity
|
|
|
117
117
|
$offer-overlay-action-default: $red; // #cf000f
|
|
118
118
|
$offer-overlay-action-hover: rgba($red, .2); // 20% opacity
|
|
119
119
|
$offer-overlay-action-pressed: rgba($red, .4); // 40% opacity
|
|
120
|
-
$offer-overlay-action-disabled: rgba($red, .6); // 60% opacity
|
|
120
|
+
$offer-overlay-action-disabled: rgba($red, .6); // 60% opacity
|
|
@@ -47,17 +47,6 @@ $color-bar-radius: 3px;
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
.sponsor-top-banner {
|
|
51
|
-
margin-bottom: 20px;
|
|
52
|
-
margin-top: 10px;
|
|
53
|
-
|
|
54
|
-
&__image {
|
|
55
|
-
display: block;
|
|
56
|
-
max-width: 100%;
|
|
57
|
-
margin-bottom: 20px;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
50
|
.color-pick {
|
|
62
51
|
&__wrap {
|
|
63
52
|
display: none;
|
package/src/scss/plp-main.scss
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<div class="card-sponsor-banner {{#unless show}}d-none{{/unless}}"
|
|
2
|
-
{{#if desktop-position}}data-desktop-position="{{desktop-position}}"{{/if}}
|
|
3
|
-
{{#if mobile-position}}data-mobile-position="{{mobile-position}}"{{/if}}
|
|
4
|
-
>
|
|
5
|
-
<a class="card-sponsor-banner__link" href="{{href}}">
|
|
6
|
-
<img class="card-sponsor-banner__image" src="{{src}}" alt="banner">
|
|
7
|
-
</a>
|
|
8
|
-
</div>
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
var Wick = Wick || {};
|
|
2
|
-
Wick.BannerPlacementManager = {
|
|
3
|
-
SPONSOR_BANNERS_DISPLAYED_EVENT: 'sponsorAdsDisplayedEvent',
|
|
4
|
-
el: {
|
|
5
|
-
banners: '.card-product-banner',
|
|
6
|
-
sponsorBanners: '.card-sponsor-banner',
|
|
7
|
-
sponsorProducts: '.card-sponsor-product',
|
|
8
|
-
allBanners: '.card-product-banner, .card-sponsor-banner, .card-sponsor-product',
|
|
9
|
-
productCard: '.product-card',
|
|
10
|
-
allListSlots: '.product-card, .card-product-banner, .card-sponsor-banner, .card-sponsor-product',
|
|
11
|
-
productsWrap: '.products-list-v2',
|
|
12
|
-
$products: $('.product-card'),
|
|
13
|
-
attrPositionDesktop: 'data-desktop-position',
|
|
14
|
-
attrPositionMobile: 'data-mobile-position',
|
|
15
|
-
attrRequiredAmountDesktop: 'data-required-amount-desktop',
|
|
16
|
-
attrRequiredAmountMobile: 'data-required-amount-mobile',
|
|
17
|
-
hide: 'd-none',
|
|
18
|
-
sponsoredAdvBanners: '.sponsored-ad'
|
|
19
|
-
},
|
|
20
|
-
classes: {
|
|
21
|
-
sponsorBanners: 'card-sponsor-banner',
|
|
22
|
-
sponsorProducts: 'card-sponsor-product',
|
|
23
|
-
productBanners: 'card-product-banner',
|
|
24
|
-
bannerInactiveClass: 'card-product-banner--inactive'
|
|
25
|
-
},
|
|
26
|
-
isEventSent: false,
|
|
27
|
-
currentBreakpoint: null,
|
|
28
|
-
checkProductsInColumn() {
|
|
29
|
-
Wick.BannerPlacementManager.addInactiveClasses();
|
|
30
|
-
Wick.BannerPlacementManager.arrangeBannersInRightOrder();
|
|
31
|
-
const $allBanners = $(Wick.BannerPlacementManager.el.allBanners);
|
|
32
|
-
const totalProducts = Wick.BannerPlacementManager.getListLength();
|
|
33
|
-
const totalSlots = totalProducts + $allBanners.length;
|
|
34
|
-
$allBanners.each((index, banner) => {
|
|
35
|
-
const bannerPosition = Wick.BannerPlacementManager.getBannerPosition(banner);
|
|
36
|
-
|
|
37
|
-
if ($(banner).hasClass('card-product-banner')) {
|
|
38
|
-
if (bannerPosition > totalSlots) {
|
|
39
|
-
Wick.BannerPlacementManager.hideBanner(banner);
|
|
40
|
-
$(Wick.BannerPlacementManager.el.productsWrap).append(banner);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if ($(banner).hasClass(Wick.BannerPlacementManager.classes.sponsorBanners) || $(banner).hasClass(Wick.BannerPlacementManager.classes.sponsorProducts)) {
|
|
46
|
-
if (bannerPosition > totalProducts) {
|
|
47
|
-
Wick.BannerPlacementManager.showBanner(banner);
|
|
48
|
-
Wick.BannerPlacementManager.removeInactiveClass(banner);
|
|
49
|
-
$(Wick.BannerPlacementManager.el.productsWrap).append(banner);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
Wick.BannerPlacementManager.hideBannerDueLimit(banner, index);
|
|
55
|
-
Wick.BannerPlacementManager.moveBannerToSpecifiedPosition(banner);
|
|
56
|
-
});
|
|
57
|
-
},
|
|
58
|
-
moveBannerToSpecifiedPosition(banner) {
|
|
59
|
-
const $listSlots = Wick.BannerPlacementManager.getListSlots();
|
|
60
|
-
const bannerPosition = Wick.BannerPlacementManager.getBannerPosition(banner) - 2;
|
|
61
|
-
const listSlotsLength = $listSlots.length;
|
|
62
|
-
|
|
63
|
-
if (Wick.BannerPlacementManager.isBannerVisible(banner)) {
|
|
64
|
-
if (bannerPosition <= listSlotsLength) {
|
|
65
|
-
if ($listSlots[bannerPosition]) {
|
|
66
|
-
Wick.BannerPlacementManager.showBanner(banner);
|
|
67
|
-
Wick.BannerPlacementManager.removeInactiveClass(banner);
|
|
68
|
-
Wick.BannerPlacementManager.moveBanner(banner, $listSlots[bannerPosition]);
|
|
69
|
-
} else {
|
|
70
|
-
Wick.BannerPlacementManager.hideBanner(banner);
|
|
71
|
-
Wick.BannerPlacementManager.coverEdgeCases(banner);
|
|
72
|
-
}
|
|
73
|
-
} else {
|
|
74
|
-
if ($(banner).hasClass(Wick.BannerPlacementManager.classes.sponsorBanners) || $(banner).hasClass(Wick.BannerPlacementManager.classes.sponsorProducts)) {
|
|
75
|
-
Wick.BannerPlacementManager.showBanner(banner);
|
|
76
|
-
Wick.BannerPlacementManager.removeInactiveClass(banner);
|
|
77
|
-
$(Wick.BannerPlacementManager.el.productsWrap).append(banner);
|
|
78
|
-
} else {
|
|
79
|
-
Wick.BannerPlacementManager.hideBanner(banner);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
moveBanner(banner, targetElement) {
|
|
85
|
-
$(banner).remove();
|
|
86
|
-
$(targetElement).after(banner);
|
|
87
|
-
},
|
|
88
|
-
hideBanner(banner) {
|
|
89
|
-
$(banner).addClass(Wick.BannerPlacementManager.el.hide);
|
|
90
|
-
},
|
|
91
|
-
showBanner(banner) {
|
|
92
|
-
$(banner).removeClass(Wick.BannerPlacementManager.el.hide);
|
|
93
|
-
},
|
|
94
|
-
isBannerVisible(banner) {
|
|
95
|
-
return !$(banner).hasClass(Wick.BannerPlacementManager.el.hide);
|
|
96
|
-
},
|
|
97
|
-
hideBannerDueLimit(banner) {
|
|
98
|
-
const bannerMinLimit = Wick.BannerPlacementManager.getBannerLimit(banner) - 1;
|
|
99
|
-
const $listSlots = Wick.BannerPlacementManager.getListSlots();
|
|
100
|
-
const listProductsLength = $listSlots.length;
|
|
101
|
-
Wick.BannerPlacementManager.showBanner(banner);
|
|
102
|
-
|
|
103
|
-
if (bannerMinLimit > listProductsLength) {
|
|
104
|
-
Wick.BannerPlacementManager.hideBanner(banner);
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
getBannerPosition(banner) {
|
|
108
|
-
const isMobile = Wick.BannerPlacementManager.isMobileResolution();
|
|
109
|
-
const positionAttribute = isMobile
|
|
110
|
-
? Wick.BannerPlacementManager.el.attrPositionMobile
|
|
111
|
-
: Wick.BannerPlacementManager.el.attrPositionDesktop
|
|
112
|
-
|
|
113
|
-
return banner.hasAttribute(positionAttribute)
|
|
114
|
-
? Number(banner.getAttribute(positionAttribute))
|
|
115
|
-
: Number(Wick.BannerPlacementManager.getListLength() + Wick.BannerPlacementManager.getBannersAmount());
|
|
116
|
-
},
|
|
117
|
-
getBannerLimit(banner) {
|
|
118
|
-
const isMobile = Wick.BannerPlacementManager.isMobileResolution();
|
|
119
|
-
|
|
120
|
-
const limitAttribute = isMobile
|
|
121
|
-
? Wick.BannerPlacementManager.el.attrRequiredAmountMobile
|
|
122
|
-
: Wick.BannerPlacementManager.el.attrRequiredAmountDesktop;
|
|
123
|
-
|
|
124
|
-
return banner.hasAttribute(limitAttribute)
|
|
125
|
-
? Number(banner.getAttribute(limitAttribute))
|
|
126
|
-
: 0;
|
|
127
|
-
},
|
|
128
|
-
isMobileResolution() {
|
|
129
|
-
return Wick.Responsive.getCurrentBreakpoint() !== 'up-lg';
|
|
130
|
-
},
|
|
131
|
-
getListLength() {
|
|
132
|
-
const $listItems = $(Wick.BannerPlacementManager.el.productsWrap).children(Wick.BannerPlacementManager.el.productCard);
|
|
133
|
-
return $listItems.length;
|
|
134
|
-
},
|
|
135
|
-
getBannersAmount() {
|
|
136
|
-
return $(Wick.BannerPlacementManager.el.allBanners).length;
|
|
137
|
-
},
|
|
138
|
-
getProductsAmount() {
|
|
139
|
-
return Wick.BannerPlacementManager.el.$products.length;
|
|
140
|
-
},
|
|
141
|
-
arrangeBannersInRightOrder() {
|
|
142
|
-
const $allBanners = $(Wick.BannerPlacementManager.el.allBanners);
|
|
143
|
-
|
|
144
|
-
const sponsorProducts = $allBanners.filter((i, el) =>
|
|
145
|
-
$(el).hasClass(Wick.BannerPlacementManager.classes.sponsorProducts)
|
|
146
|
-
);
|
|
147
|
-
const sponsorBanners = $allBanners.filter((i, el) =>
|
|
148
|
-
$(el).hasClass(Wick.BannerPlacementManager.classes.sponsorBanners)
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
const firstSponsorProductPos = sponsorProducts.length > 0
|
|
152
|
-
? Math.min(...sponsorProducts.map((i, el) => Wick.BannerPlacementManager.getBannerPosition(el)).get())
|
|
153
|
-
: Infinity;
|
|
154
|
-
const firstSponsorBannerPos = sponsorBanners.length > 0
|
|
155
|
-
? Math.min(...sponsorBanners.map((i, el) => Wick.BannerPlacementManager.getBannerPosition(el)).get())
|
|
156
|
-
: Infinity;
|
|
157
|
-
|
|
158
|
-
let groupOrder;
|
|
159
|
-
if (firstSponsorProductPos < firstSponsorBannerPos) {
|
|
160
|
-
groupOrder = [
|
|
161
|
-
Wick.BannerPlacementManager.classes.sponsorProducts,
|
|
162
|
-
Wick.BannerPlacementManager.classes.sponsorBanners,
|
|
163
|
-
Wick.BannerPlacementManager.classes.productBanners
|
|
164
|
-
];
|
|
165
|
-
} else {
|
|
166
|
-
groupOrder = [
|
|
167
|
-
Wick.BannerPlacementManager.classes.sponsorBanners,
|
|
168
|
-
Wick.BannerPlacementManager.classes.sponsorProducts,
|
|
169
|
-
Wick.BannerPlacementManager.classes.productBanners
|
|
170
|
-
];
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
$allBanners.sort((a, b) => {
|
|
174
|
-
function getGroupIndex(el) {
|
|
175
|
-
if ($(el).hasClass(groupOrder[0])) return 0;
|
|
176
|
-
if ($(el).hasClass(groupOrder[1])) return 1;
|
|
177
|
-
if ($(el).hasClass(groupOrder[2])) return 2;
|
|
178
|
-
return 3;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const groupA = getGroupIndex(a);
|
|
182
|
-
const groupB = getGroupIndex(b);
|
|
183
|
-
|
|
184
|
-
if (groupA !== groupB) {
|
|
185
|
-
return groupA - groupB;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
const positionA = Wick.BannerPlacementManager.getBannerPosition(a);
|
|
189
|
-
const positionB = Wick.BannerPlacementManager.getBannerPosition(b);
|
|
190
|
-
|
|
191
|
-
return positionA - positionB;
|
|
192
|
-
}).appendTo(Wick.BannerPlacementManager.el.productsWrap);
|
|
193
|
-
},
|
|
194
|
-
addInactiveClasses() {
|
|
195
|
-
$(Wick.BannerPlacementManager.el.allBanners).addClass(Wick.BannerPlacementManager.el.hide);
|
|
196
|
-
},
|
|
197
|
-
removeInactiveClass(banner) {
|
|
198
|
-
$(banner).removeClass(Wick.BannerPlacementManager.classes.bannerInactiveClass)
|
|
199
|
-
},
|
|
200
|
-
insertFirstBanner(banner) {
|
|
201
|
-
const bannerPosition = Wick.BannerPlacementManager.getBannerPosition(banner);
|
|
202
|
-
|
|
203
|
-
if (bannerPosition === 1) {
|
|
204
|
-
Wick.BannerPlacementManager.showBanner(banner);
|
|
205
|
-
Wick.BannerPlacementManager.removeInactiveClass(banner);
|
|
206
|
-
$(banner).remove();
|
|
207
|
-
$(Wick.BannerPlacementManager.el.productsWrap).prepend(banner);
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
coverEdgeCases(banner) {
|
|
211
|
-
Wick.BannerPlacementManager.insertFirstBanner(banner);
|
|
212
|
-
},
|
|
213
|
-
getListSlots() {
|
|
214
|
-
return $(Wick.BannerPlacementManager.el.productsWrap)
|
|
215
|
-
.children(Wick.BannerPlacementManager.el.allListSlots);
|
|
216
|
-
},
|
|
217
|
-
getBannerPriority(banner) {
|
|
218
|
-
if ($(banner).hasClass(Wick.BannerPlacementManager.classes.sponsorProducts)) {
|
|
219
|
-
return 1;
|
|
220
|
-
}
|
|
221
|
-
if ($(banner).hasClass(Wick.BannerPlacementManager.classes.sponsorBanners)) {
|
|
222
|
-
return 2;
|
|
223
|
-
}
|
|
224
|
-
return 3;
|
|
225
|
-
},
|
|
226
|
-
dispatchSponsorAdsDisplayedEvent() {
|
|
227
|
-
return new Promise((resolve, reject) => {
|
|
228
|
-
const eventDetail = { resolve, reject };
|
|
229
|
-
const sponsorAdsEvent = createEvent(Wick.BannerPlacementManager.SPONSOR_BANNERS_DISPLAYED_EVENT, { displayed: true }, eventDetail);
|
|
230
|
-
window.dispatchEvent(sponsorAdsEvent);
|
|
231
|
-
});
|
|
232
|
-
},
|
|
233
|
-
init() {
|
|
234
|
-
Wick.Responsive.onResize(function () {
|
|
235
|
-
if(Wick.BannerPlacementManager.currentBreakpoint !== Wick.Responsive.getCurrentBreakpoint()) {
|
|
236
|
-
Wick.BannerPlacementManager.currentBreakpoint = Wick.Responsive.getCurrentBreakpoint()
|
|
237
|
-
Wick.BannerPlacementManager.checkProductsInColumn();
|
|
238
|
-
|
|
239
|
-
if (
|
|
240
|
-
!Wick.BannerPlacementManager.isEventSent && $(Wick.BannerPlacementManager.el.sponsoredAdvBanners).length
|
|
241
|
-
) {
|
|
242
|
-
Wick.BannerPlacementManager.dispatchSponsorAdsDisplayedEvent();
|
|
243
|
-
Wick.BannerPlacementManager.isEventSent = true;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
$(window).trigger('productBannerPositionChanged');
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
$(document).ready(function () {
|
|
253
|
-
if (!Wick.BannerPlacementManager.getBannersAmount() || !Wick.BannerPlacementManager.getProductsAmount()) {
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
Wick.BannerPlacementManager.init();
|
|
258
|
-
})
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// Simulate prompt for input
|
|
2
|
-
function getInputs() {
|
|
3
|
-
const productBannerPositions = prompt("Enter Product Banner Positions:", "2") || "";
|
|
4
|
-
const sponsorProductPositions = prompt("Enter Sponsor Product Positions (comma-separated):", "6,7,8") || "";
|
|
5
|
-
const sponsorBannerPositions = prompt("Enter Sponsor Banner Positions:", "10") || "";
|
|
6
|
-
|
|
7
|
-
return {
|
|
8
|
-
productBannerPositions: productBannerPositions ? productBannerPositions.split(",").map(Number) : [],
|
|
9
|
-
sponsorProductPositions: sponsorProductPositions ? sponsorProductPositions.split(",").map(Number) : [],
|
|
10
|
-
sponsorBannerPositions: sponsorBannerPositions ? sponsorBannerPositions.split(",").map(Number) : [],
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function getPositionAttr() {
|
|
15
|
-
const isMobile = Wick.BannerPlacementManager.isMobileResolution();
|
|
16
|
-
return isMobile
|
|
17
|
-
? 'data-mobile-position'
|
|
18
|
-
: 'data-desktop-position';
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function updatePositions(inputs) {
|
|
22
|
-
const productBannerElements = document.querySelectorAll(".card-product-banner");
|
|
23
|
-
productBannerElements.forEach((el, index) => {
|
|
24
|
-
if (inputs.productBannerPositions[index] !== undefined) {
|
|
25
|
-
el.setAttribute(getPositionAttr(), inputs.productBannerPositions[index]);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const sponsorProductElements = document.querySelectorAll(".card-sponsor-product");
|
|
30
|
-
sponsorProductElements.forEach((el, index) => {
|
|
31
|
-
if (inputs.sponsorProductPositions[index] !== undefined) {
|
|
32
|
-
el.setAttribute(getPositionAttr(), inputs.sponsorProductPositions[index]);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const sponsorBannerElements = document.querySelectorAll(".card-sponsor-banner");
|
|
37
|
-
sponsorBannerElements.forEach((el, index) => {
|
|
38
|
-
if (inputs.sponsorBannerPositions[index] !== undefined) {
|
|
39
|
-
el.setAttribute(getPositionAttr(), inputs.sponsorBannerPositions[index]);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function init() {
|
|
45
|
-
const inputs = getInputs();
|
|
46
|
-
updatePositions(inputs);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
$(document).ready(function () {
|
|
50
|
-
if ($('.retail-media .products-list.products-list-v2').length) {
|
|
51
|
-
setTimeout(() => init(), 100)
|
|
52
|
-
}
|
|
53
|
-
});
|