wickes-css2 2.98.0-develop.14 → 2.98.0-develop.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wickes-css2",
3
- "version": "2.98.0-develop.14",
3
+ "version": "2.98.0-develop.15",
4
4
  "description": "CSS and JS and page templates in use by Wickes",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -108,7 +108,7 @@
108
108
  "branches": [
109
109
  "alt-master",
110
110
  {
111
- "name": "custom-tag/0.5.0-icons",
111
+ "name": "develop",
112
112
  "prerelease": "${name.replace(/^custom-tag\\//g, '')}"
113
113
  }
114
114
  ],
@@ -1,67 +1,16 @@
1
1
  $(document).ready(function () {
2
2
  Wick.OfferBanner = (function () {
3
3
  var offerBanner = $('.offer-banner')[0],
4
- offer;
4
+ offer;
5
5
 
6
- var selectors = [
7
- 'main > div > div > div:nth-child(1) > div > h1',
8
- 'main > div.hybris-class > div > h1:nth-child(1)',
9
- 'main > div.cartMessages',
10
- 'main div.checkout-header',
11
- 'main.my-account',
12
- 'div.new-usp-container',
13
- 'div.breadcrumbs'
14
- ];
15
-
16
- var targetContainers = ['main', 'div.new-usp-container', 'div.breadcrumbs'];
17
-
18
- Wick.applyTopMarginIfBanner = function () {
19
- if (!Wick.isTradePro) {
20
- return;
21
- }
22
-
23
- if (!offerBanner) {
24
- return;
25
- }
26
-
27
- let bannerHeight = $(offerBanner).outerHeight();
28
-
29
- var containers = new Set();
30
- var containersSelector = targetContainers.join(', ');
31
-
32
- selectors.forEach(function (sel) {
33
- var elements = $(sel);
34
- if (!elements.length) return;
35
-
36
- elements.each(function () {
37
- var container = $(this).closest(containersSelector);
38
- if (container.length) {
39
- containers.add(container[0]);
40
- }
41
- });
42
- });
43
-
44
- var hasBreadcrumbs = Array.from(containers).some(el => $(el).is('div.breadcrumbs'));
45
-
46
- if (hasBreadcrumbs) {
47
- containers = new Set(
48
- Array.from(containers).filter(el => $(el).is('div.breadcrumbs'))
49
- );
50
- }
51
-
52
- containers.forEach(function (el) {
53
- $(el).css('margin-top', bannerHeight + 'px');
54
- });
55
- }
56
-
57
- var init = function () {
6
+ var init = function(){
58
7
  offer = new Waypoint.Sticky({
59
8
  element: offerBanner
60
9
  });
61
10
  };
62
11
 
63
- var toggle = function () {
64
- if (offer) {
12
+ var toggle = function(){
13
+ if (offer){
65
14
  offer.destroy();
66
15
  offer = null;
67
16
  } else {
@@ -69,19 +18,21 @@ $(document).ready(function () {
69
18
  }
70
19
  };
71
20
 
72
- function handleResize() {
73
- if (!offer) {
21
+ function handleResize(){o
22
+ if (!offer){
74
23
  return;
75
24
  }
25
+
76
26
  var elHeight = offer.$element.outerHeight(true);
77
- if (elHeight !== offer.$wrapper.outerHeight(true)) {
27
+ if (elHeight !== offer.$wrapper.outerHeight(true)){
78
28
  offer.$wrapper.height(elHeight);
79
29
  }
80
- }
30
+ };
81
31
 
82
- var bindEvents = function () {
32
+ var bindEvents = function(){
83
33
  $(window).on('resize', handleResize);
84
34
  $(window).on('orientationchange', handleResize);
35
+
85
36
  $(document).on('mobileNav.toggle', toggle);
86
37
  };
87
38
 
@@ -89,11 +40,13 @@ $(document).ready(function () {
89
40
  return;
90
41
  }
91
42
 
92
- // Workaround for sticky banner functionality in IE
43
+ //Workaround for sticky banner functionality in IE
93
44
  function isIE() {
94
- var ua = navigator.userAgent;
45
+ ua = navigator.userAgent;
95
46
  /* MSIE used to detect old browsers and Trident used to newer ones*/
96
- return ua.indexOf("MSIE ") > -1 || ua.indexOf("Trident/") > -1;
47
+ var is_ie = ua.indexOf("MSIE ") > -1 || ua.indexOf("Trident/") > -1;
48
+
49
+ return is_ie;
97
50
  }
98
51
 
99
52
  if (isIE()) {
@@ -101,8 +54,6 @@ $(document).ready(function () {
101
54
  bindEvents();
102
55
  }
103
56
 
104
- Wick.applyTopMarginIfBanner();
105
-
106
57
  return offer;
107
58
  })();
108
59
  });