wickes-css2 2.98.0-develop.10 → 2.98.0-develop.12

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.
@@ -1 +1 @@
1
- !function o(n,a,i){function d(t,e){if(!a[t]){if(!n[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(c)return c(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=a[t]={exports:{}},n[t][0].call(r.exports,function(e){return d(n[t][1][e]||e)},r,r.exports,o,n,a,i)}return a[t].exports}for(var c="function"==typeof require&&require,e=0;e<i.length;e++)d(i[e]);return d}({1:[function(e,t,r){"use strict";var o=e("./utils/copy-to-clipboard"),n=window.Wick||{};n.TradeProRewards={el:{$tradeProRewards:$(".page_tradePro-rewards"),buttonSelector:".copy-tradePro-barcode"},message:"Code copied to clipboard",copyToClipboardInit:function(){n.SnackBar.init(),$(n.TradeProRewards.el.buttonSelector).on("click",function(e){e.preventDefault(),e.stopPropagation();var t=$(this).parent().find("input"),r=t.val().trim();return t.removeAttr("disabled").attr("readonly","readonly"),(0,o.copyToClipboard)(r,e.currentTarget),t.attr("disabled","disabled").removeAttr("readonly"),window.getSelection().removeAllRanges(),n.SnackBar.show({text:n.TradeProRewards.message,type:n.SnackBar.types.SUCCESS,withCloseButton:!1,autoClose:!0,delayBeforeClose:3e3}),!1})},init:function(){n.TradeProRewards.copyToClipboardInit()}},$(document).ready(function(){n.TradeProRewards.el.$tradeProRewards.length&&n.TradeProRewards.init()})},{"./utils/copy-to-clipboard":2}],2:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.copyToClipboard=function(e,t){var r=$("<textarea>").css({position:"absolute",top:0,left:0,opacity:0});$(t).parent().append(r);t=e.replace(/(^\w|\s\w)/g,function(e){return e.toUpperCase()}).split(" ").filter(function(e){return""!==e}).join(" ");r.val(t),navigator.userAgent.match(/TradeProMobile_iOS|DIYMobile_iOS/i)?function(e){var e=e.get(0),t=e.contentEditable,r=e.readOnly,o=document.createRange(),n=window.getSelection();e.contentEditable=!0,e.readOnly=!1,o.selectNodeContents(e),n.removeAllRanges(),n.addRange(o),e.setSelectionRange(0,999999),e.contentEditable=t,e.readOnly=r}(r):navigator.userAgent.match(/ipad|ipod|iphone/i)?(r.select(),r[0].setSelectionRange(0,999999)):r.select();document.execCommand("copy"),r.remove()}},{}]},{},[1]);
1
+ !function o(n,a,i){function d(t,e){if(!a[t]){if(!n[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(c)return c(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=a[t]={exports:{}},n[t][0].call(r.exports,function(e){return d(n[t][1][e]||e)},r,r.exports,o,n,a,i)}return a[t].exports}for(var c="function"==typeof require&&require,e=0;e<i.length;e++)d(i[e]);return d}({1:[function(e,t,r){"use strict";var o=e("./utils/copy-to-clipboard"),n=window.Wick||{};n.TradeProRewards={el:{$tradeProRewards:$(".page_tradePro-rewards"),buttonSelector:".copy-tradePro-barcode"},message:"Code copied to clipboard",copyToClipboardInit:function(){n.SnackBar.init(),$(n.TradeProRewards.el.buttonSelector).on("click",function(e){e.preventDefault(),e.stopPropagation();var t=$(this).parent().find("input"),r=t.val().trim();return t.removeAttr("disabled").attr("readonly","readonly"),(0,o.copyToClipboard)(r,e.currentTarget,{noUpperCase:!0}),t.attr("disabled","disabled").removeAttr("readonly"),window.getSelection().removeAllRanges(),n.SnackBar.show({text:n.TradeProRewards.message,type:n.SnackBar.types.SUCCESS,withCloseButton:!1,autoClose:!0,delayBeforeClose:3e3}),!1})},init:function(){n.TradeProRewards.copyToClipboardInit()}},$(document).ready(function(){n.TradeProRewards.el.$tradeProRewards.length&&n.TradeProRewards.init()})},{"./utils/copy-to-clipboard":2}],2:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.copyToClipboard=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},o=$("<textarea>").css({position:"absolute",top:0,left:0,opacity:0});$(t).parent().append(o),t=r.noUpperCase?e:e.replace(/(^\w|\s\w)/g,function(e){return e.toUpperCase()});r=t.split(" ").filter(function(e){return""!==e}).join(" ");o.val(r),navigator.userAgent.match(/TradeProMobile_iOS|DIYMobile_iOS/i)?function(e){var e=e.get(0),t=e.contentEditable,r=e.readOnly,o=document.createRange(),n=window.getSelection();e.contentEditable=!0,e.readOnly=!1,o.selectNodeContents(e),n.removeAllRanges(),n.addRange(o),e.setSelectionRange(0,999999),e.contentEditable=t,e.readOnly=r}(o):navigator.userAgent.match(/ipad|ipod|iphone/i)?(o.select(),o[0].setSelectionRange(0,999999)):o.select();document.execCommand("copy"),o.remove()}},{}]},{},[1]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wickes-css2",
3
- "version": "2.98.0-develop.10",
3
+ "version": "2.98.0-develop.12",
4
4
  "description": "CSS and JS and page templates in use by Wickes",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,292 +1,16 @@
1
1
  var Wick = Wick || {};
2
+
2
3
  Wick.MainNav = (function () {
3
4
  return {
4
- createMainNav: function (defaultOptions) {
5
- const $mainNav = $('#main-nav');
6
-
7
- function createMainNavWrapper(data) {
8
- return `
9
- <div class="main-nav__section main-nav__section_main">
10
- <div class="main-nav__back-btn__wrap">
11
- <a href="#" class="main-nav__back-btn">
12
- <span class="icon"><i class="fas fa-arrow-left fa-lg"></i></span>
13
- </a>
14
- </div>
15
- <div class="main-nav__top-level-wrap">
16
- <ul class="main-nav__top-level">
17
- ${data.map(createMainNavTopLevel).join('')}
18
- </ul>
19
- </div>
20
- </div>
21
- `;
22
- }
23
-
24
- function createMainNavTopLevel(menuSection) {
25
- if (menuSection.name && menuSection.url) {
26
- if (menuSection.children && menuSection.children.length) {
27
- return `
28
- <li class="main-nav__top-level__item">
29
- <a href="${checkUrl(menuSection)}" class="main-nav__top-level__label ${setClass(menuSection, 1)}" tabindex="0" ${setColor(menuSection)}>
30
- ${menuSection.name}
31
- </a>
32
- <div class="main-nav__menu-wrapper">
33
- ${createMainNavBannerItem(menuSection.banner)}
34
- <ul class="main-nav__menu">
35
- ${menuSection.children.map(createMainNavItems).join('')}
36
- </ul>
37
- </div>
38
- </li>
39
- `
40
- } else {
41
- return `
42
- <li class="main-nav__top-level__item main-nav__top-level__item-last">
43
- <a href="${checkUrl(menuSection)}" class="main-nav__top-level__label" tabindex="0" ${setColor(menuSection)}>
44
- ${menuSection.name}
45
- </a>
46
- </li>
47
- `
48
- }
49
- } else {
50
- return ''
51
- }
52
- }
53
-
54
- function createMainNavBannerItem(banner) {
55
- if (banner && Wick.Responsive.getCurrentBreakpoint() !== 'up-lg') {
56
- return `
57
- <div class="main-nav__menu-banner">
58
- ${banner}
59
- </div>
60
- `;
61
- } else {
62
- return ''
63
- }
64
- }
65
-
66
- function createMainNavItems(menuSection) {
67
- if (menuSection) {
68
- if (menuSection.children && menuSection.children.length) {
69
- if(menuSection.originalChildrenCount) {
70
- console.log(menuSection)
71
- }
72
- return `
73
- <li class="main-nav__menu__item nav-col">
74
- <a href="${checkUrl(menuSection)}" class="main-nav__menu__label ${setClass(menuSection, 2)}" tabindex="0" ${setColor(menuSection)}>
75
- ${menuSection.name}
76
- </a>
77
- <div class="main-nav__sub-menu__wrapper" tabindex="0">
78
- <div class="main-nav__sub-menu">
79
- <ul>
80
- ${menuSection.children.map(createSubNavItems).join('')}
81
- ${
82
- menuSection.originalChildrenCount &&
83
- menuSection.originalChildrenCount != menuSection.children.length
84
- ? createSubNavItems({name: 'View More', class: 'main-nav__sub-menu__view-more', url: menuSection.url})
85
- : ''
86
- }
87
- </ul>
88
- <div class="main-nav__view-all">
89
- <a href="${checkUrl(menuSection)}" class="main-nav__view-all__link" tabindex="0">
90
- View all ${menuSection.name}
91
- </a>
92
- </div>
93
- ${createOffersWrapper(menuSection)}
94
- </div>
95
- </div>
96
- </li>
97
- `
98
- } else {
99
- return `
100
- <li class="main-nav__menu__item nav-col">
101
- <a href="${checkUrl(menuSection)}" class="main-nav__menu__label ${setClass(menuSection, 2)}" tabindex="0" ${setColor(menuSection)}>
102
- ${menuSection.name}
103
- </a>
104
- <div class="main-nav__sub-menu__wrapper" tabindex="0">
105
- <div class="main-nav__sub-menu">
106
- <div class="main-nav__view-all">
107
- <a href="${checkUrl(menuSection)}" class="main-nav__view-all__link" tabindex="0">
108
- View all ${menuSection.name}
109
- </a>
110
-
111
- </div>
112
- ${createOffersWrapper(menuSection)}
113
- </div>
114
- </div>
115
- </li>
116
- `
117
- }
118
- }
119
- }
120
-
121
- function createSubNavItems(subItem) {
122
- if (subItem.name && subItem.url) {
123
- return `
124
- <li class="main-nav__sub-menu__item nav-col ${subItem.class || ''}">
125
- <a href="${checkUrl(subItem)}" class="main-nav__sub-menu__link main-nav__sub-sub-menu__link-last ${setClass(subItem, 3)}" tabindex="0" ${setColor(subItem)}>
126
- ${subItem.name}
127
- </a>
128
- </li>
129
- `
130
- }
131
- }
132
-
133
- function createTopOffersWrapper(offer) {
134
- return `
135
- <div class="main-nav__top-offers">
136
- <a href="${offer.url}">
137
- <img class="main-nav__top-offers__img" src="${offer.image}" alt="${offer.name}">
138
- </a>
139
- </div>`
140
- }
141
-
142
- function createOffersWrapper(menuOffers) {
143
- if (menuOffers.offers) {
144
- let offersObj = menuOffers.offers;
145
- return `
146
- <div class="main-nav__offers__wrapper">
147
- <a href="#" class="main-nav__offers__label" tabindex="0">
148
- ${offersObj.name}
149
- </a>
150
- <div class="main-nav__offers">
151
- <div class="main-nav__offers__title">
152
- ${offersObj.name}
153
- </div>
154
- ${offersObj.offers.map(createOfferItem).join('')}
155
- </div>
156
- </div>
157
- `
158
- } else {
159
- return ''
160
- }
161
- }
162
-
163
- function createOfferItem(offer) {
164
- if (offer.image) {
165
- return `
166
- <div class="main-nav__offers__img">
167
- <a href="${offer.url}">
168
- <img src="${offer.image}" alt="${offer.name}">
169
- </a>
170
- </div>
171
- `
172
- } else if (offer.name) {
173
- return `
174
- <div class="main-nav__offers__item">
175
- <a href="${offer.url}" class="main-nav__offers__item-link" tabindex="0">
176
- ${offer.name}
177
- </a>
178
- </div>
179
- `
180
- }
181
- }
182
-
183
- function setClass(section, category) {
184
- let colorClass = '';
185
-
186
- if (section.color) {
187
- switch(section.color.toUpperCase()) {
188
- case 'GREEN':
189
- colorClass = 'green'
190
- break;
191
- case 'RED':
192
- colorClass = 'red'
193
- break;
194
- }
195
-
196
- switch(category) {
197
- case 1:
198
- colorClass += ' main-nav__top-level__label--invert'
199
- break;
200
- case 2:
201
- colorClass += ' main-nav__menu__label--invert'
202
- break;
203
- case 3:
204
- colorClass += ' main-nav__sub-menu__link--invert'
205
- break;
206
- }
207
- }
208
-
209
- return colorClass
210
- }
211
-
212
- function setColor(section) {
213
- let style = 'style="';
214
-
215
- if(section.color) {
216
- switch(section.color.toUpperCase()) {
217
- case 'GREEN':
218
- style += `background-color: #9acd32; color: #fff;`
219
- break;
220
- case 'RED':
221
- style += `background-color: #cf000f; color: #fff;`
222
- break;
223
- }
224
- }
225
-
226
- if (section.bold) {
227
- style += 'font-weight: 700;';
228
- }
229
-
230
- return style+'"'
231
- }
232
-
233
- function checkUrl(menuItem) {
234
- return menuItem.url || ''
235
- }
236
-
237
- function appendMainNav(data) {
238
- $mainNav.prepend(createMainNavWrapper(data));
239
- }
240
-
241
- const createMenu = (data) => {
242
- appendMainNav(data[0].children);
243
- Wick.Nav();
244
- Wick.Responsive.callBr();
245
- };
246
-
247
- const checkIfRealEnvironment = () => {
248
- if (defaultOptions.local) {
249
- createMenu(defaultOptions.mockData)
250
- } else {
251
- APICall(defaultOptions, createMenu)
252
- }
253
- };
254
-
255
- function APICall(options, onSuccess) {
256
- $.ajax({
257
- type: options.type,
258
- dataType: "json",
259
- url: `${options.link}/menu/main`,
260
- cache: options.cache,
261
- success: onSuccess,
262
- });
263
- }
264
-
265
- function isSSR() {
266
- return $mainNav.attr('data-ssr') === 'true'
267
- }
268
-
269
- if (isSSR()) {
270
- Wick.Nav();
271
- Wick.Responsive.callBr();
272
- } else {
273
- checkIfRealEnvironment();
274
- }
5
+ createMainNav: function () {
6
+ Wick.Nav();
7
+ Wick.Responsive.callBr();
275
8
  }
276
9
  }
277
10
  })();
278
11
 
279
12
  $(document).ready(function () {
280
- const defaultOptions = {
281
- type: 'GET',
282
- cache: true,
283
- link: window.location.origin,
284
- local: false
285
- };
286
-
287
- if (!$('#main-nav').length) {
288
- return;
289
- }
13
+ if (!$('#main-nav').length) return;
290
14
 
291
- Wick.MainNav.createMainNav(defaultOptions);
15
+ Wick.MainNav.createMainNav();
292
16
  });
@@ -17,7 +17,7 @@ Wick.TradeProRewards = {
17
17
  var discountCodeValue = discountCode.val().trim();
18
18
  discountCode.removeAttr('disabled').attr('readonly', 'readonly');
19
19
 
20
- copyToClipboard(discountCodeValue, e.currentTarget);
20
+ copyToClipboard(discountCodeValue, e.currentTarget, { noUpperCase: true });
21
21
 
22
22
  discountCode.attr('disabled', 'disabled').removeAttr('readonly');
23
23
  window.getSelection().removeAllRanges();
@@ -1,4 +1,4 @@
1
- export function copyToClipboard(copyValue, currentSelector) {
1
+ export function copyToClipboard(copyValue, currentSelector, options = {}) {
2
2
  const $temp = $('<textarea>').css({
3
3
  position: 'absolute',
4
4
  top: 0,
@@ -8,9 +8,15 @@ export function copyToClipboard(copyValue, currentSelector) {
8
8
 
9
9
  $(currentSelector).parent().append($temp);
10
10
 
11
- const str = copyValue.replace(/(^\w|\s\w)/g, function (m) {
12
- return m.toUpperCase()
13
- });
11
+ let str;
12
+ if (options.noUpperCase) {
13
+ str = copyValue;
14
+ } else {
15
+ str = copyValue.replace(/(^\w|\s\w)/g, function (m) {
16
+ return m.toUpperCase()
17
+ });
18
+ }
19
+
14
20
  const textFiltered = str.split(' ').filter(function (value) {
15
21
  return value !== ''
16
22
  });
@@ -1,6 +1,5 @@
1
1
  <a id="skip-to-navigation"></a>
2
2
  <nav class="main-nav" id="main-nav">
3
- {{>skeleton-nav}}
4
3
 
5
4
  {{#if isLoggedIn}}
6
5
  <div class="nav-button-wrap" data-logged-in="true">
@@ -5,33 +5,6 @@
5
5
  font-weight: 500;
6
6
  background: $white;
7
7
 
8
- .ssc {
9
- &-nav {
10
- @include make-container;
11
- @include make-container-max-widths;
12
- display: flex;
13
- gap: 5px;
14
- padding: 3px 15px;
15
- }
16
-
17
- &-line {
18
- height: 63px;
19
- border-radius: 10px;
20
-
21
- &:first-child {
22
- flex: 0 0 34px;
23
- }
24
-
25
- &:last-child {
26
- flex: 0 0 50px;
27
- }
28
- }
29
- }
30
-
31
- &__section + .ssc-nav {
32
- display: none;
33
- }
34
-
35
8
  &__top-offers {
36
9
  display: none;
37
10
  }
@@ -326,9 +299,13 @@
326
299
  }
327
300
 
328
301
  // fix of mobile menu
329
- .mobile-nav-opened > img {
302
+ body.mobile-nav-opened {
330
303
  display: block;
331
- height: 0;
304
+
305
+ & > img {
306
+ display: block;
307
+ height: 0;
308
+ }
332
309
  }
333
310
 
334
311
  @include media-breakpoint-down(md) {
@@ -354,10 +331,6 @@
354
331
  }
355
332
  }
356
333
 
357
- .ssc-nav {
358
- display: none;
359
- }
360
-
361
334
  &.js-visible {
362
335
  display: block;
363
336
  }
package/src/sitemap.html CHANGED
@@ -946,17 +946,6 @@
946
946
  </a>
947
947
  </li>
948
948
  </ul>
949
- <h3>
950
- Old Navigation
951
- </h3>
952
- <ul>
953
- <li>
954
- <span class="page-id">1</span>
955
- <a href="page_old-navigation.html" target="_blank">
956
- Page with old navigation
957
- </a>
958
- </li>
959
- </ul>
960
949
 
961
950
 
962
951
  </div>
@@ -1,21 +0,0 @@
1
- var Wick = Wick || {};
2
-
3
- Wick.MainNavLocal = function(){
4
- function init() {
5
- var localOptions = {
6
- local: true,
7
- mockData: Wick.MainNavData.returnData()
8
- };
9
-
10
- if (!$('#main-nav').length || !$('.ssc-nav').length) {
11
- return;
12
- }
13
-
14
-
15
- setTimeout(()=> {
16
- Wick.MainNav.createMainNav(localOptions);
17
- }, 2000)
18
- }
19
-
20
- init()
21
- }();
@@ -1,10 +0,0 @@
1
- {{#extend "base" pageClass="" title="Old navigation" oldNav=true hideBreadcrumbs=true pageBasket=true}}
2
- {{#content "body"}}
3
- <main>
4
- <div class="container">
5
- <h1 class="page-header__title">That example old navigation</h1>
6
- <p class="page-header__intro">Must be skeleton and after loading navigation</p>
7
- </div>
8
- </main>
9
- {{/content}}
10
- {{/extend}}