PageSourceSearch

https://www.samlerhuset.no/templates/sn_webshop/assets/frontpage-7c58a4b41534bbbdaa04.js

js samlerhuset.no collected 2026-10-02 19:41:11 UTC 73,016 bytes, 2,008 lines download raw bytes

1/******/ (() => { // webpackBootstrap
2/******/ 	"use strict";
3/******/ 	var __webpack_modules__ = ({
4
5/***/ 3960:
6/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7
8__webpack_require__.r(__webpack_exports__);
9// extracted by mini-css-extract-plugin
10
11
12/***/ })
13
14/******/ 	});
15/************************************************************************/
16/******/ 	// The module cache
17/******/ 	var __webpack_module_cache__ = {};
18/******/ 	
19/******/ 	// The require function
20/******/ 	function __webpack_require__(moduleId) {
21/******/ 		// Check if module is in cache
22/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
23/******/ 		if (cachedModule !== undefined) {
24/******/ 			return cachedModule.exports;
25/******/ 		}
26/******/ 		// Create a new module (and put it into the cache)
27/******/ 		var module = __webpack_module_cache__[moduleId] = {
28/******/ 			// no module.id needed
29/******/ 			// no module.loaded needed
30/******/ 			exports: {}
31/******/ 		};
32/******/ 	
33/******/ 		// Execute the module function
34/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
35/******/ 	
36/******/ 		// Return the exports of the module
37/******/ 		return module.exports;
38/******/ 	}
39/******/ 	
40/************************************************************************/
41/******/ 	/* webpack/runtime/make namespace object */
42/******/ 	(() => {
43/******/ 		// define __esModule on exports
44/******/ 		__webpack_require__.r = (exports) => {
45/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47/******/ 			}
48/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
49/******/ 		};
50/******/ 	})();
51/******/ 	
52/************************************************************************/
53var __webpack_exports__ = {};
54// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
55(() => {
56
57;// CONCATENATED MODULE: ./dev/js/GtmItemListEvents.js
58function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
59
60function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
61
62function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
63
64var notSet = 'not set';
65
66var GtmItemListEvents = /*#__PURE__*/function () {
67  function GtmItemListEvents() {
68    var _this = this;
69
70    _classCallCheck(this, GtmItemListEvents);
71
72    this.initViewListener();
73    this.viewedLists = new Set();
74    this.isProcessing = false;
75    setTimeout(function () {
76      _this.initMenuTracking();
77
78      _this.checkOnScreenElements();
79    }, 1000);
80  }
81
82  _createClass(GtmItemListEvents, [{
83    key: "trackElements",
84    value: function trackElements(elements) {
85      this.setClickListener(elements);
86      var $elements = jQuery(elements);
87      var $container = $elements.first().closest('[data-list-name]');
88
89      if ($container.length) {
90        this.pushViewEvent($container);
91      } else {
92        this.pushViewEvent(elements);
93      }
94    }
95  }, {
96    key: "setClickListener",
97    value: function setClickListener(elements) {
98      var $this = this;
99      var $elements = jQuery(elements);
100
101      if ($elements.length) {
102        $elements.each(function (i, el) {
103          jQuery(el).on('click', function (c) {
104            $this.pushClickEvent(c.currentTarget);
105          });
106        });
107      }
108    }
109  }, {
110    key: "initViewListener",
111    value: function initViewListener() {
112      var _this2 = this;
113
114      var $this = this;
115      jQuery(window).scroll(function () {
116        if (_this2.timeout) {
117          clearTimeout($this.timeout);
118        }
119
120        $this.timeout = setTimeout(function () {
121          _this2.checkOnScreenElements();
122        }, 200);
123      });
124    }
125  }, {
126    key: "initMenuTracking",
127    value: function initMenuTracking() {
128      var _this3 = this;
129
130      var $this = this;
131      setTimeout(function () {
132        jQuery('.menu__layout, .nav.menu').each(function (i, container) {
133          var $container = jQuery(container);
134          var listName = $container.attr('data-list-name');
135          $container.find('a[data-item-id]:not(.gtm_listener_added)').each(function (j, element) {
136            jQuery(element).on('click', function (e) {
137              $this.pushClickEvent(e.currentTarget);
138            }).addClass('gtm_listener_added');
139          });
140
141          if (listName && !_this3.viewedLists.has(listName) && $this.isOnScreen($container)) {
142            $this.pushViewEvent($container);
143            $container.addClass('gtm_list_viewed');
144
145            _this3.viewedLists.add(listName);
146          }
147        });
148      }, 1500);
149      var hoverTimeout;
150      jQuery('.menu__item').on('mouseenter', function () {
151        var _this4 = this;
152
153        if (hoverTimeout) {
154          clearTimeout(hoverTimeout);
155        }
156
157        hoverTimeout = setTimeout(function () {
158          var $menuItem = jQuery(_this4);
159          var menuId = $menuItem.data('id');
160
161          if (menuId) {
162            var $submenu = jQuery('.menu__dropline' + menuId);
163            var listName = $submenu.attr('data-list-name');
164
165            if ($submenu.length && listName && !$this.viewedLists.has(listName)) {
166              $this.pushViewEvent($submenu);
167              $submenu.addClass('gtm_list_viewed');
168              $this.viewedLists.add(listName);
169            }
170          }
171        }, 200);
172      });
173      jQuery('.mobilemenu__item.hasSubmenu:not(.gtm_listener_added)').on('click', function () {
174        jQuery(this).addClass('gtm_listener_added');
175        var $submenu = jQuery(this).next('.submenu.nav-submenu').find('ul');
176        var listName = $submenu.attr('data-list-name');
177
178        if ($submenu.length && listName && !$this.viewedLists.has(listName)) {
179          $this.pushViewEvent($submenu);
180          $submenu.addClass('gtm_list_viewed');
181          $this.viewedLists.add(listName);
182        }
183      });
184    }
185  }, {
186    key: "checkOnScreenElements",
187    value: function checkOnScreenElements() {
188      var _this5 = this;
189
190      if (this.isProcessing) {
191        return;
192      }
193
194      this.isProcessing = true;
195
196      try {
197        var containers = jQuery('[data-list-name]:not(.gtm_list_viewed)').slice(0, 3);
198        var processedCount = 0;
199        containers.each(function (i, container) {
200          var $container = jQuery(container);
201          var listName = $container.attr('data-list-name');
202
203          if (_this5.viewedLists.has(listName)) {
204            return;
205          }
206
207          var containerVisible = _this5.isOnScreen($container);
208
209          var childrenVisible = false;
210
211          if (!containerVisible) {
212            var childCount = 0;
213            $container.find('[data-item-id]').each(function (j, child) {
214              childCount++;
215              if (childCount > 5) return false;
216
217              if (_this5.isOnScreen(jQuery(child))) {
218                childrenVisible = true;
219                return false;
220              }
221            });
222          }
223
224          if (containerVisible || childrenVisible) {
225            _this5.pushViewEvent($container);
226
227            $container.addClass('gtm_list_viewed');
228
229            if (listName) {
230              _this5.viewedLists.add(listName);
231            }
232
233            processedCount++;
234          }
235        });
236        var items = jQuery('[data-item-click]:not(.gtm_viewed)').slice(0, 5);
237        items.each(function (i, el) {
238          var $element = jQuery(el);
239          var $container = $element.closest('[data-list-name]');
240
241          if (!_this5.isOnScreen($element)) {
242            return;
243          }
244
245          if ($container.length) {
246            var listName = $container.attr('data-list-name');
247
248            if (_this5.viewedLists.has(listName)) {
249              $element.addClass('gtm_viewed');
250              return;
251            }
252
253            if (!$container.hasClass('gtm_list_viewed')) {
254              _this5.pushViewEvent($container);
255
256              $container.addClass('gtm_list_viewed');
257
258              if (listName) {
259                _this5.viewedLists.add(listName);
260              }
261            }
262          } else {
263            var eventObject = _this5.prepareViewEvent($element);
264
265            _this5.pushEvent(eventObject);
266
267            $element.addClass('gtm_viewed');
268          }
269        });
270
271        if (processedCount < 2) {
272          var menuDroplines = jQuery('.menu__dropline:visible:not(.gtm_list_viewed)').slice(0, 2);
273          menuDroplines.each(function (i, dropline) {
274            var $dropline = jQuery(dropline);
275            var listName = $dropline.attr('data-list-name');
276
277            if (_this5.viewedLists.has(listName)) {
278              return;
279            }
280
281            if (_this5.isOnScreen($dropline)) {
282              _this5.pushViewEvent($dropline);
283
284              $dropline.addClass('gtm_list_viewed');
285
286              if (listName) {
287                _this5.viewedLists.add(listName);
288              }
289            }
290          });
291        }
292      } finally {
293        this.isProcessing = false;
294        setTimeout(function () {
295          return _this5.checkOnScreenElements();
296        }, 1000);
297      }
298    }
299  }, {
300    key: "isOnScreen",
301    value: function isOnScreen(element) {
302      var threshold = 30;
303
304      if (typeof element === 'undefined') {
305        return false;
306      }
307
308      var $element = jQuery(element);
309
310      if ($element.is(":hidden") || $element.css('opacity') === '0') {
311        return false;
312      }
313
314      if ($element.parent().hasClass('carousel__item') && !$element.parent().hasClass('tns-slide-active')) {
315        return false;
316      }
317
318      var elementTop = $element.offset().top;
319      var elementBottom = elementTop + $element.outerHeight();
320      var viewportTop = jQuery(window).scrollTop();
321      var viewportBottom = viewportTop + jQuery(window).height();
322      return elementBottom >= viewportTop && elementTop <= viewportBottom;
323    }
324  }, {
325    key: "pushClickEvent",
326    value: function pushClickEvent(element) {
327      var $element = jQuery(element);
328
329      if ($element.hasClass('gtm_clicked') || $element.attr('data-action') === 'addToCart') {
330        return;
331      }
332
333      var eventObject = this.prepareClickEvent($element);
334      this.pushEvent(eventObject);
335      $element.addClass('gtm_clicked');
336    }
337  }, {
338    key: "pushViewEvent",
339    value: function pushViewEvent(elements) {
340      var _this6 = this;
341
342      if (this.isProcessing) {
343        return;
344      }
345
346      this.isProcessing = true;
347      var $elements = jQuery(elements);
348
349      try {
350        if ($elements.attr('data-list-name')) {
351          var listName = $elements.attr('data-list-name');
352
353          if (this.viewedLists.has(listName)) {
354            return;
355          }
356
357          var items = $elements.find('[data-item-id]');
358
359          if (items.length > 0) {
360            var eventObject = this.prepareViewEvent($elements);
361            this.pushEvent(eventObject);
362            $elements.addClass('gtm_list_viewed');
363            this.viewedLists.add(listName);
364            items.addClass('gtm_viewed');
365          }
366        } else {
367          var elementsByContainer = {};
368          $elements.each(function (i, el) {
369            var $el = jQuery(el);
370            var $container = $el.closest('[data-list-name]');
371
372            if ($container.length) {
373              var _listName = $container.attr('data-list-name');
374
375              if (_this6.viewedLists.has(_listName)) {
376                return;
377              }
378
379              if (!elementsByContainer[_listName]) {
380                elementsByContainer[_listName] = {
381                  container: $container,
382                  elements: []
383                };
384              }
385
386              elementsByContainer[_listName].elements.push($el);
387            } else {
388              if (_this6.isOnScreen($el) && !$el.hasClass('gtm_viewed')) {
389                var _eventObject = _this6.prepareViewEvent($el);
390
391                _this6.pushEvent(_eventObject);
392
393                $el.addClass('gtm_viewed');
394              }
395            }
396          });
397
398          for (var _listName2 in elementsByContainer) {
399            if (this.viewedLists.has(_listName2)) {
400              continue;
401            }
402
403            var containerInfo = elementsByContainer[_listName2];
404
405            if (!containerInfo.container.hasClass('gtm_list_viewed') && (this.isOnScreen(containerInfo.container) || containerInfo.elements.some(function (el) {
406              return _this6.isOnScreen(el);
407            }))) {
408              var _eventObject2 = this.prepareViewEvent(containerInfo.container);
409
410              this.pushEvent(_eventObject2);
411              containerInfo.container.addClass('gtm_list_viewed');
412              this.viewedLists.add(_listName2);
413              containerInfo.elements.forEach(function (el) {
414                return el.addClass('gtm_viewed');
415              });
416            }
417          }
418        }
419      } finally {
420        this.isProcessing = false;
421      }
422    }
423  }, {
424    key: "prepareClickEvent",
425    value: function prepareClickEvent($element) {
426      var item = this.prepareItemData($element);
427      var $container = $element.closest('[data-list-name]');
428
429      if ($container.length) {
430        item.item_list_name = $container.attr('data-list-name');
431      }
432
433      return {
434        event: 'select_item',
435        ecommerce: {
436          items: [item]
437        }
438      };
439    }
440  }, {
441    key: "prepareViewEvent",
442    value: function prepareViewEvent($element) {
443      var items = this.collectListItems($element);
444      return {
445        event: 'view_item_list',
446        ecommerce: {
447          items: items
448        }
449      };
450    }
451  }, {
452    key: "prepareItemData",
453    value: function prepareItemData($element) {
454      var _$element$attr;
455
456      var item = {
457        item_id: $element.attr('data-item-id') || notSet,
458        item_name: ((_$element$attr = $element.attr('data-item-name')) === null || _$element$attr === void 0 ? void 0 : _$element$attr.trim()) || notSet,
459        price: parseFloat($element.attr('data-item-price')) || 0,
460        item_category: $element.attr('data-item-category') || notSet,
461        item_material: $element.attr('data-item-material') || notSet,
462        item_list_name: $element.attr('data-item-list-name') || notSet,
463        index: parseInt($element.attr('data-item-index')) || 0
464      };
465
466      if ($element.attr('data-item-category2')) {
467        item.item_category2 = $element.attr('data-item-category2');
468      }
469
470      return item;
471    }
472  }, {
473    key: "collectListItems",
474    value: function collectListItems($container) {
475      var _this7 = this;
476
477      var items = [];
478      var listName = $container.attr('data-list-name') || notSet;
479      var seenItemIds = new Set();
480      $container.find('[data-item-id]').each(function (index, element) {
481        var $element = jQuery(element);
482        var itemId = $element.attr('data-item-id');
483
484        if (seenItemIds.has(itemId)) {
485          return;
486        }
487
488        var item = _this7.prepareItemData($element);
489
490        item.item_list_name = listName;
491        item.index = items.length + 1;
492        items.push(item);
493        seenItemIds.add(itemId);
494      });
495      return items;
496    }
497  }, {
498    key: "pushEvent",
499    value: function pushEvent(eventObject) {
500      if (eventObject.ecommerce && eventObject.ecommerce.items && eventObject.ecommerce.items.length === 0) {
501        return;
502      }
503
504      eventObject.timestamp = new Date().getTime();
505      window.dataLayer = window.dataLayer || [];
506      window.dataLayer.push(eventObject);
507    }
508  }]);
509
510  return GtmItemListEvents;
511}();
512
513
514;// CONCATENATED MODULE: ./dev/js/GtmPromoEvents.js
515function GtmPromoEvents_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
516
517function GtmPromoEvents_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
518
519function GtmPromoEvents_createClass(Constructor, protoProps, staticProps) { if (protoProps) GtmPromoEvents_defineProperties(Constructor.prototype, protoProps); if (staticProps) GtmPromoEvents_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
520
521var GtmPromoEvents_notSet = 'not set'; // deafult value when property is not set
522
523var GtmPromoEvents = /*#__PURE__*/function () {
524  function GtmPromoEvents() {
525    GtmPromoEvents_classCallCheck(this, GtmPromoEvents);
526
527    this.initViewListener();
528  }
529
530  GtmPromoEvents_createClass(GtmPromoEvents, [{
531    key: "trackElements",
532    value: function trackElements(elements) {
533      this.setClickListener(elements);
534      this.pushViewEvent(elements);
535    }
536  }, {
537    key: "setClickListener",
538    value: function setClickListener(elements) {
539      var $this = this;
540      var $elements = jQuery(elements);
541
542      if ($elements.length) {
543        $elements.each(function (i, el) {
544          jQuery(el).on('click', function (c) {
545            $this.pushClickEvent(c.currentTarget);
546          });
547        });
548      }
549    }
550  }, {
551    key: "initViewListener",
552    value: function initViewListener() {
553      var _this = this;
554
555      var $this = this;
556      jQuery(window).scroll(function () {
557        if (_this.timeout) {
558          clearTimeout($this.timeout);
559        }
560
561        $this.timeout = setTimeout(function () {
562          _this.checkOnScreenElements();
563        }, 200);
564      });
565    }
566  }, {
567    key: "checkOnScreenElements",
568    value: function checkOnScreenElements() {
569      var _this2 = this;
570
571      jQuery('[data-promo-click]:not(.gtm_viewed)').each(function (i, el) {
572        var $element = jQuery(el);
573
574        if (_this2.isOnScreen($element)) {
575          _this2.pushViewEvent($element);
576        }
577      });
578    }
579  }, {
580    key: "isOnScreen",
581    value: function isOnScreen(element) {
582      var threshold = 30; // in px
583
584      if (typeof element === 'undefined') {
585        return false;
586      }
587
588      var $element = jQuery(element);
589
590      if ($element.is(":hidden") || $element.css('opacity') === '0') {
591        return false;
592      }
593
594      if ($element.parent().hasClass('carousel__item') && !$element.parent().hasClass('tns-slide-active')) {
595        return false;
596      }
597
598      var elementTop = $element.offset().top;
599      var elementBottom = elementTop + $element.outerHeight();
600      var viewportTop = jQuery(window).scrollTop();
601      var viewportBottom = viewportTop + jQuery(window).height();
602      return elementTop + threshold > viewportTop && elementBottom - threshold < viewportBottom;
603    }
604  }, {
605    key: "pushClickEvent",
606    value: function pushClickEvent(element) {
607      var $element = jQuery(element);
608
609      if ($element.hasClass('gtm_clicked')) {
610        return;
611      }
612
613      var eventObject = this.prepareClickEvent($element);
614      this.pushEvent(eventObject);
615      $element.addClass('gtm_clicked');
616    }
617  }, {
618    key: "pushViewEvent",
619    value: function pushViewEvent(elements) {
620      var _this3 = this;
621
622      setTimeout(function () {
623        // We have to wait a bit to finish all the animation and make sure the element is on the screen.
624        var $elements = jQuery(elements);
625        $elements.each(function (i, el) {
626          var $el = jQuery(el);
627
628          if (_this3.isOnScreen($el) && !$el.hasClass('gtm_viewed')) {
629            var eventObject = _this3.prepareViewEvent($el);
630
631            _this3.pushEvent(eventObject);
632
633            $el.addClass('gtm_viewed');
634          }
635        });
636      }, 500);
637    }
638  }, {
639    key: "prepareClickEvent",
640    value: function prepareClickEvent($element) {
641      if (window.newMarkestic) {
642        var promotion = this.prepareNewPromotion($element);
643        return {
644          event: 'select_promotion',
645          ecommerce: {
646            items: [promotion]
647          }
648        };
649      } else {
650        return {
651          'event': 'promotionClick',
652          'ecommerce': {
653            'promoClick': {
654              'promotions': [{
655                'id': $element.attr('data-seo-ac') || GtmPromoEvents_notSet,
656                'name': $element.attr('data-seo-name') || GtmPromoEvents_notSet,
657                'creative': $element.attr('data-seo-creative') || GtmPromoEvents_notSet,
658                'position': $element.attr('data-seo-position') || GtmPromoEvents_notSet
659              }]
660            }
661          }
662        };
663      }
664    }
665  }, {
666    key: "prepareViewEvent",
667    value: function prepareViewEvent($element) {
668      if (window.newMarkestic) {
669        var promotion = this.prepareNewPromotion($element);
670        return {
671          event: 'view_promotion',
672          ecommerce: {
673            items: [promotion]
674          }
675        };
676      } else {
677        return {
678          'event': 'promoView',
679          'ecommerce': {
680            'promoView': {
681              'promotions': [{
682                'id': $element.attr('data-seo-ac') || GtmPromoEvents_notSet,
683                'name': $element.attr('data-seo-name') || GtmPromoEvents_notSet,
684                'creative': $element.attr('data-seo-creative') || GtmPromoEvents_notSet,
685                'position': $element.attr('data-seo-position') || GtmPromoEvents_notSet
686              }]
687            }
688          }
689        };
690      }
691    }
692  }, {
693    key: "prepareNewPromotion",
694    value: function prepareNewPromotion($element) {
695      return {
696        promotion_name: $element.attr('data-seo-name') || GtmPromoEvents_notSet,
697        creative_name: ($element.attr('data-seo-creative') || GtmPromoEvents_notSet).replace(/^https?:\/\//, ''),
698        // remove protocol
699        location_id: $element.attr('data-seo-position') || GtmPromoEvents_notSet
700      };
701    }
702  }, {
703    key: "pushEvent",
704    value: function pushEvent(eventObject) {
705      window.dataLayer = window.dataLayer || [];
706      dataLayer.push(eventObject);
707    }
708  }]);
709
710  return GtmPromoEvents;
711}();
712
713
714;// CONCATENATED MODULE: ./dev/js/helpers/HeaderPopup.js
715function HeaderPopup_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
716
717function HeaderPopup_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
718
719function HeaderPopup_createClass(Constructor, protoProps, staticProps) { if (protoProps) HeaderPopup_defineProperties(Constructor.prototype, protoProps); if (staticProps) HeaderPopup_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
720
721var HeaderPopup = /*#__PURE__*/function () {
722  function HeaderPopup() {
723    HeaderPopup_classCallCheck(this, HeaderPopup);
724  }
725
726  HeaderPopup_createClass(HeaderPopup, null, [{
727    key: "init",
728    value: function init(buttonSelector, popupSelector, closeSelector) {
729      var openOnMobile = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
730
731      if (jQuery(buttonSelector).length && jQuery(popupSelector).length) {
732        var $button = jQuery(buttonSelector).first();
733        var $popup = jQuery(popupSelector).first();
734        var $close = jQuery(closeSelector).first();
735        var $this = this;
736        $close.on('click', function () {
737          $this.closePopup($popup);
738        }); // Close the popup when a navigation link is clicked so the user can
739        // see the switched tab (on the profile page the hash changes without
740        // a page reload, otherwise the open popup would cover the content).
741
742        $popup.on('click', '.header__popup-list a', function () {
743          $this.closePopup($popup);
744        });
745        $button.click(function (e) {
746          var isMobile = jQuery('.hmenu').css('display') !== 'flex';
747
748          if (isMobile || openOnMobile) {
749            e.preventDefault();
750            e.stopPropagation();
751
752            if (!$popup.hasClass('fadeInDown')) {
753              $this.openPopup($popup);
754            } else {
755              $this.closePopup($popup);
756            }
757          }
758        });
759      }
760    }
761  }, {
762    key: "closePopup",
763    value: function closePopup($popup) {
764      $popup.addClass('fadeOutUp');
765      $popup.removeClass('fadeInDown');
766    }
767  }, {
768    key: "openPopup",
769    value: function openPopup($popup) {
770      $popup.removeClass('fadeOutUp');
771      $popup.addClass('fadeInDown');
772    }
773  }]);
774
775  return HeaderPopup;
776}();
777
778
779;// CONCATENATED MODULE: ./dev/js/helpers/sendAjaxRequest2.js
780function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
781
782/**
783 * This is updated version of sendAjaxRequest.js.
784 * The changes are due to safety requirements.
785 * The main difference is that it not parse the fields to JSON string and not add the POST parameters to the URL.
786 */
787function sendAjaxRequest(task, method, fields) {
788  var rawData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
789  var params = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
790  var token = jQuery('form input:hidden').last().serialize();
791
792  var data = _defineProperty({}, token, 1);
793
794  data.fields = fields;
795  var controllerPath = '';
796
797  if (params) {
798    if (params.hasOwnProperty('controllerPath')) {
799      controllerPath = params.controllerPath;
800    }
801  }
802
803  return new Promise(function (resolve, reject) {
804    jQuery.ajax({
805      type: 'POST',
806      url: "".concat(window.location.origin, "/").concat(controllerPath, "index.php?option=com_snv2&task=").concat(task, ".").concat(method, "&format=json"),
807      data: data
808    }).done(function (response) {
809      if (response === 'The most recent request was denied because it had an invalid security token. Please refresh the page and try again.') {
810        throw "An AJAX request error has ocurred! Invalid security token ((".concat(method, ")). Please relog try again or contact to IT");
811      }
812
813      resolve(response);
814    }).fail(function (error) {
815      reject(error);
816    });
817  });
818}
819;// CONCATENATED MODULE: ./dev/js/helpers/helpers.js
820function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
821
822function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
823
824function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
825
826function logCheckoutPaymentMode() {
827  var paymentRadios = document.querySelectorAll('input[name="payment"]');
828
829  if (!paymentRadios.length) {
830    return;
831  }
832
833  var isMultiPayment = document.querySelector('input[name="payment"][data-configuration-id]') !== null;
834  console.log(isMultiPayment ? 'Multi payment' : 'Old payment');
835}
836function getCartQuantity() {
837  jQuery.getJSON("".concat(window.location.origin, "/index.php?option=com_snv2&task=getCartQuantity&format=json"), function (_ref) {
838    var data = _ref.data;
839
840    if (jQuery('.cart__counter').length > 0) {
841      jQuery('.cart__counter').text(data);
842    }
843  });
844}
845function getCartDetails() {
846  jQuery.getJSON("".concat(window.location.origin, "/index.php?option=com_snv2&task=getCartDetails&format=json"), function (data) {
847    var basket_url = jQuery('a.fright').attr('data-url');
848    var cartItems = data.data.items;
849    var cartPreview = '',
850        cartRows = '',
851        itemsSum = 0;
852
853    var _iterator = _createForOfIteratorHelper(cartItems),
854        _step;
855
856    try {
857      for (_iterator.s();
857 !(_step = _iterator.n()).done;) {
858        var cartItem = _step.value;
859        itemsSum += parseInt(cartItem.amount);
860        cartRows += "<div class=\"row\">";
861        cartRows += "<div class=\"col-md-3 minicart__image\"><img src=\"".concat(cartItem.image, "\" alt=\"").concat(cartItem.name, "\" title=\"").concat(cartItem.productAlias, "\" /></div>");
862        cartRows += "<div class=\"col-md-9 minicart__title\">";
863        cartRows += cartItem.amount > 1 ? cartItem.amount + ' x ' : '';
864        cartRows += "<a class=\"inverted\" href=\"".concat(cartItem.url, "\">").concat(cartItem.usp, "</a> <span class=\"minicart__price\">").concat(cartItem.price, "</span></div>");
865        cartRows += "</div>";
866      }
867    } catch (err) {
868      _iterator.e(err);
869    } finally {
870      _iterator.f();
871    }
872
873    cartRows += "<div class=\"row\">";
874    cartRows += "<div class=\"col-md-8\">".concat(Joomla.JText._('COM_SNV2_CHECKOUT_CART_SHIPPING_LABEL'), "</div>");
875    cartRows += "<div class=\"col-md-4 align-right\">".concat(data.data.shipment, "</div>");
876    cartRows += "</div>";
877    cartRows += "<div class=\"row\">";
878    cartRows += "<div class=\"col-md-8\">".concat(Joomla.JText._('COM_SNV2_CHECKOUT_CART_SUMMARY_LABEL'), "</div>");
879    cartRows += "<div class=\"col-md-4 align-right\"><b>".concat(data.data.basketTotal, "</b></div>");
880    cartRows += "</div>";
881
882    if (cartRows !== '') {
883      cartPreview += "<h5>".concat(Joomla.JText._('TPL_SN_WEBSHOP_MINICART_HEADER'), "</h5>");
884      cartPreview += cartRows;
885      cartPreview += "<a class=\"promoproduct__cart ga-action\" data-ga_category=\"MainPage\" data-ga_action=\"basketclicked\" href=\"".concat(basket_url, "\">").concat(Joomla.JText._('TPL_SN_WEBSHOP_MINICART_BUTTON'), "</a>");
886    } else {
887      cartPreview = "<small>".concat(Joomla.JText._('TPL_SN_WEBSHOP_MINICART_EMPTY'), "</small>");
888    }
889
890    jQuery('.minicart .header__cart-mini').html(cartPreview);
891    jQuery('.cart__counter').text(itemsSum);
892  });
893}
894;// CONCATENATED MODULE: ./dev/js/helpers/TemplateHelper.js
895function TemplateHelper_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
896
897function TemplateHelper_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
898
899function TemplateHelper_createClass(Constructor, protoProps, staticProps) { if (protoProps) TemplateHelper_defineProperties(Constructor.prototype, protoProps); if (staticProps) TemplateHelper_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
900
901
902
903
904
905var TemplateHelper = /*#__PURE__*/function () {
906  function TemplateHelper() {
907    TemplateHelper_classCallCheck(this, TemplateHelper);
908  }
909
910  TemplateHelper_createClass(TemplateHelper, null, [{
911    key: "setBottomButtonPadding",
912    value: function setBottomButtonPadding() {
913      setTimeout(function () {
914        if (jQuery('.stickyMobileBottomBar:visible').length) {
915          var buttonHeight = jQuery('.stickyMobileBottomBar:visible').outerHeight();
916          jQuery('body').attr('style', "padding-bottom: ".concat(buttonHeight, "px!important;"));
917        }
918      }, 100);
919    }
920  }, {
921    key: "logValidationErrors",
922    value: function logValidationErrors($form) {
923      if (!$form || !$form.length) {
924        console.error('Vista validation error: form not found');
925        return;
926      }
927
928      var validator = $form.data('validator');
929      var errorList = validator && validator.errorList ? validator.errorList : [];
930
931      if (!errorList.length) {
932        console.error('Vista validation error: form invalid but errorList is empty');
933        return;
934      }
935
936      errorList.forEach(function (err) {
937        var el = err.element;
938        var $el = jQuery(el);
939        var field = el.name || el.id || '(unknown)';
940        console.error('Vista validation error field=' + field + ' id=' + (el.id || '') + ' visible=' + $el.is(':visible') + ' message=' + (err.message || ''));
941      });
942    }
943  }, {
944    key: "scrollToInvalidField",
945    value: function scrollToInvalidField() {
946      var stickyBarHeight = jQuery('.stickyMobileBottomBar:visible').outerHeight() || 0;
947      var viewportHeight = window.innerHeight || document.documentElement.clientHeight; // Find the topmost error element by actual page position (not selector/DOM order)
948
949      var $firstTarget = null;
950      var minTop = Infinity;
951
952      var candidateTop = function candidateTop($el) {
953        if (!$el || !$el.length) return;
954        var top = $el.offset().top;
955
956        if (top < minTop) {
957          minTop = top;
958          $firstTarget = $el;
959        }
960      }; // Visible text/select/textarea inputs — use their container
961
962
963      jQuery('input.has-error, select.has-error, textarea.has-error').each(function () {
964        var $el = jQuery(this);
965
966        if ($el.is(':visible')) {
967          candidateTop($el.parent());
968        } else {
969          // Hidden checkbox/input — walk up to nearest visible ancestor
970          var $ancestor = $el.closest(':visible');
971          candidateTop($ancestor.length ? $ancestor : null);
972        }
973      }); // Visible containers marked invalid (e.g. TOS/consent fieldsets styled as checkboxes)
974
975      jQuery('.controls--invalid:visible').each(function () {
976        candidateTop(jQuery(this));
977      });
978
979      if ($firstTarget) {
980        var elHeight = $firstTarget.outerHeight() || 0;
981        var availableViewport = viewportHeight - stickyBarHeight; // Center the target in the available viewport (above the sticky bar)
982
983        var scrollTo = Math.max(0, minTop - availableViewport / 2 + elHeight / 2); // Native smooth scroll. This runs several times per submit attempt
984        // (two jform.valid() checks plus the deferred form submit), so a jQuery
985        // html/body animate queue would stack and snap between calls; scrollTo
986        // simply retargets the same smooth scroll.
987
988        var scrollEl = document.scrollingElement || document.documentElement;
989        scrollEl.scrollTo({
990          top: scrollTo,
991          behavior: 'smooth'
992        });
993      }
994    }
995  }, {
996    key: "initPasswordRemind",
997    value: function initPasswordRemind() {
998      var buttonSelector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '#password-remind';
999      var formSelector = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '#remindme-form';
1000      jQuery(buttonSelector).off('click.passwordRemind').on('click.passwordRemind', function (e) {
1001        e.preventDefault();
1002        e.stopPropagation();
1003        var targetId = jQuery(this).attr('data-password-remind-target');
1004        var $form = targetId ? jQuery(document.getElementById(targetId)) : jQuery(formSelector);
1005        jQuery(this).attr('aria-expanded', !$form.is(':visible'));
1006        $form.stop(true, true).slideToggle();
1007      });
1008    }
1009  }, {
1010    key: "initMagicLinkAuth",
1011    value: function initMagicLinkAuth() {
1012      jQuery('#remindme-form, [data-password-remind-form]').each(function () {
1013        var $form = jQuery(this);
1014
1015        if ($form.data('magicLinkInit')) {
1016          return;
1017        }
1018
1019        $form.data('magicLinkInit', true);
1020        var $email = $form.find('[name="jform[email]"]');
1021        var $error = $form.find('[data-email-required], #jform_email-error');
1022
1023        var showEmailRequiredError = function showEmailRequiredError() {
1024          $error.show();
1025          $email.addClass('has-error').closest('.control-group').addClass('has-error');
1026        };
1027
1028        var hideEmailRequiredError = function hideEmailRequiredError() {
1029          $error.hide();
1030          $email.removeClass('has-error').closest('.control-group').removeClass('has-error');
1031        };
1032
1033        $email.on('input', function () {
1034          if ($email.val().trim()) {
1035            hideEmailRequiredError();
1036          }
1037        });
1038        $form.on('submit', function (e) {
1039          if (!$email.val().trim()) {
1040            e.preventDefault();
1041            showEmailRequiredError();
1042          } else if ($form.hasClass('header__popup-login')) {
1043            $form.find('button[type="submit"]').prop('disabled', true);
1044          }
1045        });
1046        $form.find('[data-send-magic-link], #sendMagicLink').on('click', function (e) {
1047          e.preventDefault();
1048          e.stopPropagation();
1049          var token = $form.find('input[type=hidden][value="1"]').last().attr('name');
1050
1051          if (!token) {
1052            token = jQuery('#member-registration input[type=hidden][value="1"]').last().attr('name');
1053          }
1054
1055          var email = $email.val().trim(); // Keep the current SEF URL and menu Itemid for magic-link authentication.
1056
1057          var dataToSend = {
1058            format: 'json',
1059            returnUrl: encodeURI(window.location.href),
1060            email: email
1061          };
1062          dataToSend[token] = '1';
1063
1064          if (!email) {
1065            showEmailRequiredError();
1066            return;
1067          }
1068
1069          hideEmailRequiredError();
1070          jQuery.ajax({
1071            type: 'POST',
1072            url: 'index.php?option=com_snv2&task=sendMagicLink',
1073            data: dataToSend
1074          }).done(function (data) {
1075            var modalId = $form.attr('data-magic-link-modal') || 'magicLinkSuccess';
1076            var $modal = jQuery(document.getElementById(modalId));
1077
1078            if (data.success && data.data === true) {
1079              $modal.find('[data-magic-link-success], #successMessage').css('display', 'block');
1080              $modal.find('[data-magic-link-failure], #failsafeMessage').css('display', 'none');
1081            } else {
1082              $modal.find('[data-magic-link-success], #successMessage').css('display', 'none');
1083              $modal.find('[data-magic-link-failure], #failsafeMessage').css('display', 'block');
1084            }
1085
1086            var $headerPopup = $form.closest('.header__account-popup');
1087
1088            if ($headerPopup.length) {
1089              HeaderPopup.closePopup($headerPopup);
1090            }
1091
1092            $modal.appendTo(document.body).modal('show');
1093          });
1094        });
1095      });
1096    }
1097  }, {
1098    key: "initFullWidthMenu",
1099    value: function initFullWidthMenu() {
1100      // When the menu has multiple rows and 'full-width' is on, add an element after the last menu item, that will align the last row to the left.
1101      if (jQuery('.navigation.full-width-menu')) {
1102        var $menuLayout = jQuery('.navigation.full-width-menu .menu__layout');
1103        var $menuItems = $menuLayout.find('> .menu__item');
1104
1105        if ($menuLayout && $menuItems) {
1106          if ($menuLayout.outerHeight() < $menuItems.first().outerHeight()) {
1107            $menuItems.last().after('<li style="flex:auto;"></li>');
1108          }
1109        }
1110      }
1111    }
1112  }, {
1113    key: "initPopupBasket",
1114    value: function initPopupBasket(selector) {
1115      jQuery(selector).on('click', function (e) {
1116        e.preventDefault();
1117        var evLab = jQuery(this).data('label') || '',
1118            evVal = jQuery(this).data('value') || jQuery(this).data('item-price') || 0,
1119            evId = jQuery(this).data('pid') || '';
1120        var evItemCategory = jQuery(this).data('item-category') || '',
1121            evItemCategory2 = jQuery(this).data('item-category2') || '',
1122            evItemMaterial = jQuery(this).data('item-material') || '',
1123            evListName = jQuery(this).data('item-list-name') || null;
1124        jQuery('.modal-header h5').html(Joomla.JText._('COM_SNV2_RETURNS_CHECKING'));
1125        jQuery('.productPlace').html('<div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div>');
1126        var fields = {
1127          'pid': jQuery(this).data('pid'),
1128          'type': 'JSON'
1129        };
1130        var promise = sendAjaxRequest('basketfront', 'addToCart', fields, false);
1131        promise.then(function (msg) {
1132          var data = msg.data.data,
1133              addedProduct = '';
1134
1135          if (data.status === true) {
1136            addedProduct += "<div class=\"row\">";
1137            addedProduct += "<div class=\"col-md-3 col-sm-4 col-xs-5 minicart__image\"><img src=\"".concat(msg.data.data.additionalData.img, "\" alt=\"").concat(msg.data.data.additionalData.title, "\" title=\"").concat(msg.data.data.additionalData.title, "\" /></div>");
1138            addedProduct += "<div class=\"col-md-9 col-sm-8 col-xs-7 minicart__title\"><div class=\"product-name\">".concat(msg.data.data.additionalData.title, "</div><div class=\"minicart__price\">").concat(msg.data.data.additionalData.price, "</div></div>");
1139            addedProduct += "</div>";
1140            jQuery('.modal-header h5').html(jQuery('.modal-header h5').data('success'));
1141            jQuery('.productPlace').html(addedProduct);
1142
1143            try {
1144              if (window.newMarkestic && !window.isBasket) {
1145                var mapItems = function mapItems(product) {
1146                  var quantity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
1147                  var listName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
1148                  var item = {
1149                    item_name: product.name.trim() || '',
1150                    item_id: String(product.id || ''),
1151                    price: String(parseFloat(product.price || 0)),
1152                    quantity: parseInt(quantity !== null && quantity !== void 0 ? quantity : '1')
1153                  };
1154
1155                  if (product.category) {
1156                    item.item_category = product.category;
1157                  }
1158
1159                  if (product.category2) {
1160                    item.item_category2 = product.category2;
1161                  }
1162
1163                  if (product.material) {
1164                    item.item_material = product.material;
1165                  }
1166
1167                  if (listName !== null) {
1168                    item.item_list_name = listName;
1169                  }
1170
1171                  return [item];
1172                };
1173
1174                dataLayer.push({
1175                  'event': 'cleanup',
1176                  'ecommerce': null
1177                });
1178                var product = {
1179                  name: evLab,
1180                  id: evId,
1181                  price: evVal,
1182                  category: evItemCategory,
1183                  category2: evItemCategory2,
1184                  material: evItemMaterial
1185                };
1186                var listName = jQuery(this).data('list') || null;
1187                var items = mapItems(product, 1, evListName || listName);
1188                dataLayer.push({
1189                  'event': 'add_to_cart',
1190                  'ecommerce': {
1191                    'items': items
1192                  }
1193                });
1194              }
1195            } catch (e) {
1196              console.log(e);
1197            }
1198          } else {
1199            addedProduct += "<div class=\"row\">";
1200            addedProduct += "<div class=\"col-md-12 col-sm-8 col-xs-7 minicart__title\">".concat(data.msg, "</div>");
1201            addedProduct += "</div>";
1202            jQuery('.modal-header h5').html(jQuery('.modal-header h5').data('error'));
1203            jQuery('.productPlace').html(addedProduct);
1204          }
1205
1206          getCartDetails();
1207        }.bind(this))["catch"](function (err) {
1208          console.log(err);
1209        });
1210      });
1211    }
1212  }, {
1213    key: "initTopBar",
1214    value: function initTopBar() {
1215      if (jQuery('#topbar').length > 0) {
1216        if (jQuery('.top-banner').length) {
1217          jQuery('.top-banner').clone().appendTo('#topBanner');
1218          var topBannerHeight = jQuery('.top-banner').outerHeight();
1219          jQuery('.sitewrapper').css('padding-top', "".concat(topBannerHeight, "px"));
1220          jQuery('.topbar').css('padding-top', "".concat(topBannerHeight, "px")).css('top', "-=".concat(topBannerHeight));
1221          jQuery('.navigation--mobile').css('top', "+=".concat(topBannerHeight));
1222        }
1223
1224        jQuery('.infobar__inner').clone().appendTo('#topBarInfo');
1225        jQuery('.menu__layout').clone().appendTo('#topBarMenu');
1226        jQuery('.header__cart').clone().appendTo('#topBarMenu .menu__layout').addClass('header__cart-second');
1227        jQuery('.header__cart-mini').clone().appendTo('#topBarMenu .menu__layout').addClass('header__cart-mini-second');
1228        jQuery('a.header__cart-second, div.header__cart-mini-second').wrapAll('<div class="minicart header__item" />');
1229      }
1230    }
1231  }]);
1232
1233  return TemplateHelper;
1234}();
1235
1236
1237;// CONCATENATED MODULE: ./dev/js/frontpage.js
1238
1239
1240__webpack_require__(3960);
1241
1242
1243
1244
1245 // create some namespace for validators
1246
1247var APP = window.APP || {};
1248APP.validators = {};
1249window.sr = ScrollReveal();
1250
1251if (jQuery('.testimonials').length) {
1252  var testimonials = new Siema({
1253    selector: '.testimonials',
1254    duration: 600,
1255    easing: 'ease-in-out',
1256    loop: true
1257  });
1258
1259  if (jQuery('.testimonial').length > 1) {
1260    setInterval(function () {
1261      testimonials.next();
1262    }, 12000);
1263  }
1264}
1265
1266if (jQuery('.about').length) {
1267  sr.reveal('.reveal', {
1268    duration: 600
1269  }, 75);
1270}
1271
1272$(document).ready(function () {
1273  $('.hover').bind('touchstart touchend', function (e) {
1274    e.preventDefault();
1275    $(this).toggleClass('hover_effect');
1276  });
1277});
1278document.addEventListener("DOMContentLoaded", function () {
1279  //----------------- font size control -----------------
1280  var fontSizes = [16, 18, 21]; // 100%, 115%, 130%
1281
1282  var currentFontIndex = 0;
1283  var savedFontSize = localStorage.getItem('fontSize');
1284
1285  if (savedFontSize) {
1286    var savedIndex = fontSizes.indexOf(parseFloat(savedFontSize));
1287
1288    if (savedIndex !== -1) {
1289      currentFontIndex = savedIndex;
1290      jQuery('html').css('font-size', savedFontSize + 'px');
1291    } else {
1292      currentFontIndex = 0;
1293      var defaultFontSize = fontSizes[currentFontIndex];
1294      jQuery('html').css('font-size', defaultFontSize + 'px');
1295      localStorage.setItem('fontSize', defaultFontSize);
1296    }
1297  } else {
1298    currentFontIndex = 0;
1299    var _defaultFontSize = fontSizes[currentFontIndex];
1300    jQuery('html').css('font-size', _defaultFontSize + 'px');
1301    localStorage.setItem('fontSize', _defaultFontSize);
1302  }
1303
1304  jQuery(document).on('click keypress', '.font-decrease', function (e) {
1305    if (e.type === 'click' || e.type === 'keypress' && e.which === 13) {
1306      if (currentFontIndex > 0) {
1307        currentFontIndex--;
1308        updateFontSize();
1309      }
1310    }
1311  });
1312  jQuery(document).on('click keypress', '.font-increase', function (e) {
1313    if (e.type === 'click' || e.type === 'keypress' && e.which === 13) {
1314      if (currentFontIndex < fontSizes.length - 1) {
1315        currentFontIndex++;
1316        updateFontSize();
1317      }
1318    }
1319  });
1320
1321  function updateFontSize() {
1322    var newFontSize = fontSizes[currentFontIndex];
1323    jQuery('html').css('font-size', newFontSize + 'px');
1324    localStorage.setItem('fontSize', newFontSize);
1325  } //----------------- font size control END -----------------
1326
1327
1328  var lazyImages = [].slice.call(document.querySelectorAll("img.lazy, source.lazy"));
1329  var active = false;
1330  window.gtmPromoEvents = new GtmPromoEvents();
1331  window.gtmPromoEvents.trackElements(jQuery('[data-promo-click]:not(.promobox__figure)'));
1332  window.gtmItemListEvents = new GtmItemListEvents();
1333  window.gtmItemListEvents.trackElements(jQuery('[data-item-click]:not(.promobox__figure)'));
1334  HeaderPopup.init('.header__account-button', '.header__account-popup', '.header__account-close', true);
1335
1336  var lazyLoad = function lazyLoad() {
1337    if (active === false) {
1338      active = true;
1339      setTimeout(function () {
1340        lazyImages.forEach(function (lazyImage) {
1341          if (lazyImage.getBoundingClientRect().top <= window.innerHeight && lazyImage.getBoundingClientRect().bottom >= 0 && getComputedStyle(lazyImage).display !== "none") {
1342            if (typeof lazyImage.dataset.src !== 'undefined') {
1343              lazyImage.src = lazyImage.dataset.src;
1344            }
1345
1346            if (typeof lazyImage.dataset.srcset !== 'undefined') {
1347              lazyImage.srcset = lazyImage.dataset.srcset;
1348            }
1349
1350            lazyImage.classList.remove("lazy");
1351            lazyImages = lazyImages.filter(function (image) {
1352              return image !== lazyImage;
1353            });
1354
1355            if (lazyImages.length === 0) {
1356              document.removeEventListener("scroll", lazyLoad);
1357              window.removeEventListener("load", lazyLoad);
1358              window.removeEventListener("resize", lazyLoad);
1359              window.removeEventListener("orientationchange", lazyLoad);
1360            }
1361          }
1362        });
1363        active = false;
1364      }, 200);
1365    }
1366  };
1367
1368  document.addEventListener("scroll", lazyLoad);
1369  window.addEventListener("resize", lazyLoad);
1370  window.addEventListener("load", lazyLoad);
1371  window.addEventListener("orientationchange", lazyLoad);
1372  TemplateHelper.initFullWidthMenu();
1373  TemplateHelper.initPasswordRemind("#header-password-remind", "#header-remindme-form");
1374  TemplateHelper.initMagicLinkAuth();
1375  TemplateHelper.initPopupBasket(".popupBasket");
1376});
1377
1378function registerListener(event, func) {
1379  if (window.addEventListener) {
1380    window.addEventListener(event, func);
1381  } else {
1382    window.attachEvent('on' + event, func);
1383  }
1384}
1385
1386jQuery('window').on('load', function () {
1387  var cookies = document.cookie.split(';');
1388
1389  if (!cookies.length) {
1390    document.getElementById('panel_cookie_dol').style.display = 'none';
1391  }
1392});
1393jQuery('document').ready(function () {
1394  "use strict";
1395
1396  eventTracking();
1397  jQuery('.footer__module h3').click(function (e) {
1398    e.stopPropagation();
1399    jQuery(e.target).parent('.moduletable').toggleClass('active');
1400  });
1401  jQuery('.mobilemenu .nav.menu li').each(function () {
1402    // add icon to main menu
1403    if (!jQuery(this).hasClass('submenu') && jQuery(this).next().hasClass('submenu')) {
1404      jQuery(this).append(function () {
1405        return '<i class="fa fa-2x fa-chevron-circle-left submenu-icon"></i>';
1406      });
1407    } // open sub menu if main menu or sub menu is active
1408
1409
1410    if (jQuery(this).hasClass('menu_active')) {
1411      if (jQuery(this).hasClass('submenu')) {
1412        jQuery(this).parent().parent().prev().find('i').addClass('collapsed');
1413        jQuery(this).parent().parent().fadeIn().find('li').fadeIn();
1414      } else {
1415        jQuery(this).find('i').addClass('collapsed');
1416        jQuery(this).next('.nav-submenu').fadeIn().find('li').fadeIn();
1417      }
1418    }
1419  });
1420  jQuery('.submenu-icon').on('click', function (e) {
1421    e.preventDefault();
1422    jQuery(this).toggleClass('collapsed');
1423    var countTime = 0;
1424    var openMenuTime = 170;
1425    var fadeInTime = Math.round(openMenuTime / jQuery(this).parent().next('.nav-submenu').find('ul > li').length);
1426    jQuery(this).parent().next('.nav-submenu').find('ul > li').each(function (index) {
1427      countTime = fadeInTime * index;
1428      jQuery(this).delay(countTime).fadeToggle(openMenuTime);
1429    });
1430    jQuery(this).parent().next('.nav-submenu').fadeToggle(105 + countTime);
1431  }); // clickable labels
1432
1433  var labelID;
1434  jQuery('label').click(function (e) {
1435    if (e.target.nodeName !== 'A') {
1436      labelID = jQuery(this).attr('for');
1437      jQuery('#' + labelID).attr('selected', 'selected');
1438    }
1439  }); // fix anchor scroll
1440
1441  if (window.location.hash && window.location.hash === '#system-message-container') {
1442    jQuery('html, body').animate({
1443      scrollTop: jQuery(window.location.hash).offset().top - 225
1444    }, 400);
1445    return false;
1446  }
1447
1448  getCartQuantity();
1449  jQuery('.grid__wrapper .content').doubleTapToGo(); // top fixed bar
1450
1451  TemplateHelper.initTopBar(); // hamburger menu
1452
1453  if (jQuery('#nav-icon').length > 0) {
1454    jQuery('#nav-icon').click(function (e) {
1455      toggleMenu();
1456    });
1457    jQuery('.sitewrapper').click(function (e) {
1458      if (jQuery('.sitewrapper').hasClass('sitewrapper--opened') && !jQuery(e.target).is('header span')) {
1459        e.preventDefault();
1460        e.stopPropagation();
1461        toggleMenu();
1462      }
1463    });
1464  }
1465
1466  function toggleMenu() {
1467    jQuery('#nav-icon').toggleClass('open');
1468    jQuery('.sitewrapper').toggleClass('sitewrapper--opened');
1469    jQuery('.navigation--mobile').toggleClass('opened');
1470    setIconOffset();
1471
1472    if (!jQuery('.mobilemenu--extended ul li').last().isInViewport()) {
1473      jQuery('.scroll_down').toggleClass('scroll_show').toggleClass('scroll_hide');
1474    }
1475  } // scroll down mobile button
1476
1477
1478  function setIconOffset() {
1479    var offset = Math.round(jQuery('.navigation--mobile').width() / 2 - 20);
1480    jQuery('.scroll_down').css('right', offset);
1481  }
1482
1483  jQuery.fn.isInViewport = function () {
1484    var elementTop = jQuery(this).offset().top;
1485    var elementBottom = elementTop + jQuery(this).outerHeight() - 5;
1486    var viewportTop = jQuery(window).scrollTop();
1487    var viewportBottom = viewportTop + jQuery(window).height();
1488    return elementBottom < viewportBottom;
1489  };
1490
1491  function toggleScrollIcon() {
1492    if (jQuery('#nav-icon').hasClass('open')) {
1493      if (!jQuery('.mobilemenu--extended ul li').last().isInViewport()) {
1494        jQuery('.scroll_down').addClass('scroll_show').removeClass('scroll_hide');
1495      } else {
1496        jQuery('.scroll_down').removeClass('scroll_show').addClass('scroll_hide');
1497      }
1498    }
1499  }
1500
1501  if (jQuery('.navigation--mobile').length > 0) {
1502    jQuery(window).resize(function () {
1503      setIconOffset();
1504      toggleScrollIcon();
1505    });
1506    var showScroll = jQuery('.mobilemenu--extended ul li').last().isInViewport();
1507    var lastScrollTop = 0;
1508    var delayTime = 3;
1509    var nextToggle = Math.round(new Date().getTime() / 1000);
1510    jQuery('.navigation--mobile').on('resize scroll', function () {
1511      var st = jQuery(this).scrollTop();
1512      var now = Math.round(new Date().getTime() / 1000);
1513      var lastLi = jQuery('.mobilemenu--extended ul li').last();
1514
1515      if ((st > lastScrollTop || st < 10) && lastLi !== showScroll && now >= nextToggle) {
1516        toggleScrollIcon();
1517        showScroll = lastLi.isInViewport();
1518      }
1519
1520      if (st > jQuery('.mobilemenu').height() + jQuery('.mobilemenu--extended').height() - window.outerHeight - 5 && now >= nextToggle) {
1521        nextToggle = now + delayTime;
1522      }
1523
1524      lastScrollTop = st;
1525    });
1526    var lastNextToggle = '';
1527    setInterval(function () {
1528      if (Math.round(new Date().getTime() / 1000) >= nextToggle && lastNextToggle !== nextToggle) {
1529        toggleScrollIcon();
1530        showScroll = jQuery('.mobilemenu--extended ul li').last().isInViewport();
1531        lastNextToggle = nextToggle;
1532      }
1533    }, 1000);
1534  } // scroll down mobile button END
1535
1536
1537  if (jQuery('.mobilesearch').length > 0) {
1538    jQuery('.mobilesearch').click(function (e) {
1539      jQuery(this).toggleClass('active');
1540      jQuery('.header__row-mobile-search .site-search').slideToggle().find('input
1540:first').focus();
1541    });
1542  } // mini cart pop-up
1543
1544
1545  if (jQuery('.header__cart').length > 0 && jQuery('.header__cart-mini').length > 0) {
1546    jQuery('.header__cart').click(function (e) {
1547      var minicart = jQuery('.header__cart-mini').first();
1548
1549      if (jQuery(this).hasClass('header__cart-second')) {
1550        minicart = jQuery('.header__cart-mini-second');
1551      }
1552
1553      e.preventDefault();
1554      e.stopPropagation();
1555
1556      if (!minicart.hasClass('fadeInDown')) {
1557        minicart.removeClass('fadeOutUp');
1558        minicart.addClass('fadeInDown');
1559      } else {
1560        minicart.addClass('fadeOutUp');
1561        minicart.removeClass('fadeInDown');
1562      }
1563    });
1564  } // search autocomplete
1565
1566
1567  if (jQuery('.search-query').length > 0) {
1568    var last_phrase = '';
1569    var timer;
1570    var is_seach_site = jQuery('body').hasClass('com_search');
1571    var search_input = is_seach_site ? jQuery('#search-searchword') : jQuery(jQuery('.search-query')[0]);
1572    var search_form = is_seach_site ? search_input.parent().parent() : search_input.parent();
1573    var search_form_hint = search_input.parent();
1574    search_input.attr('autocomplete', 'off');
1575    search_input.on('keyup click focus', function () {
1576      var phrase = jQuery(this).val();
1577
1578      if (phrase.length >= 3) {
1579        if (timer) {
1580          clearTimeout(timer);
1581        }
1582
1583        timer = setTimeout(function () {
1584          if (jQuery('.autocomplete-suggestions').length > 0) {
1585            jQuery('.autocomplete-suggestions').remove();
1586          }
1587
1588          search_form_hint.after('<div class="autocomplete-suggestions"></div>');
1589
1590          if (phrase !== last_phrase || jQuery('.autocomplete-suggestions > div').length === 0) {
1591            var url = '/index.php?option=com_snv2&task=getSearchAutocomplete&format=json&query=' + phrase;
1592            jQuery.get(url, function (result) {
1593              var type = '';
1594              var html_row = '';
1595              jQuery('.autocomplete-suggestions > div').remove();
1596              var mobile = window.outerWidth <= 680 ? true : false;
1597
1598              if (result.data.products.items.length === 0 && result.data.categories.items.length === 0 && result.data.articles.items.length === 0 && result.data.no_results) {
1599                html_row = '<div class="autocomplete-suggestion category noselect">' + result.data.no_results + '</div>';
1600                jQuery('.autocomplete-suggestions').append(html_row);
1601              } else {
1602                jQuery.each(result.data, function (index, value) {
1603                  if (value.items && value.items.length > 0) {
1604                    var show_more_span = value.show_more !== '' ? '<span class="show_more right_link">' + value.show_more + '</span>' : '';
1605                    html_row = '<div class="autocomplete-suggestion category noselect">' + value.label + show_more_span + '</div>';
1606                    jQuery('.autocomplete-suggestions').append(html_row);
1607                    jQuery.each(value.items, function (index, item) {
1608                      if (mobile && index === 3) {
1609                        return false;
1610                      }
1611
1612                      html_row = '<div class="autocomplete-suggestion" data-index="' + index + '"><a href="' + item.link + '">' + item.name + '</a></div>';
1613                      jQuery('.autocomplete-suggestions').append(html_row);
1614                    });
1615                  }
1616                });
1617              }
1618            }).done(function () {
1619              jQuery('.autocomplete-suggestion .show_more').on('click', function () {
1620                search_form.submit();
1621              });
1622              jQuery('.autocomplete-suggestion > a').on('click', function (e) {
1623                var phrase = jQuery(this).text();
1624                var url = jQuery(this).attr('href');
1625                addSearchHint(phrase, url);
1626              });
1627            });
1628          }
1629
1630          last_phrase = phrase;
1631        }, 300);
1632      } else {
1633        jQuery('.autocomplete-suggestions').remove();
1634        var html_row = '';
1635        var search_hints = JSON.parse(localStorage.getItem('sn_lastsearch'));
1636
1637        if (search_hints !== null && search_hints.length > 0) {
1638          search_hints = search_hints.reverse();
1639          search_form_hint.after('<div class="autocomplete-suggestions"></div>');
1640          var clear_searches = '<span class="clear_searches right_link">' + Joomla.JText._('TPL_SN_WEBSHOP_SEARCH_LABEL_CLEAR_SEARCHES') + '</span>';
1641          html_row = '<div class="autocomplete-suggestion category noselect">' + Joomla.JText._('TPL_SN_WEBSHOP_SEARCH_LABEL_RECENT_SEARCHES') + clear_searches + '</div>';
1642          jQuery('.autocomplete-suggestions').append(html_row);
1643          jQuery.each(search_hints, function (index, value) {
1644            var search_url = value.url !== '' ? value.url : window.location.origin + '/component/search/?searchword=' + value.label + '&searchphrase=all';
1645            html_row = '<div class="autocomplete-suggestion"><a href="' + search_url + '">' + value.label + '</a></div>';
1646            jQuery('.autocomplete-suggestions').append(html_row);
1647          });
1648          jQuery('.autocomplete-suggestion .clear_searches').on('click', function () {
1649            localStorage.removeItem('sn_lastsearch');
1650            jQuery('.autocomplete-suggestions').remove();
1651          });
1652          jQuery('.autocomplete-suggestion:not(.category)').on('click', function () {
1653            if (!jQuery(this).find('a').attr('href')) {
1654              var phrase = jQuery(this).text();
1655              search_input.val(phrase).parent().submit();
1656            }
1657          });
1658        }
1659      }
1660    }); // add last search to local storage
1661
1662    search_form.on('submit', function (e) {
1663      if (search_input.val() !== '') {
1664        var phrase = search_input.val();
1665        addSearchHint(phrase, '');
1666      }
1667    });
1668    search_input.on('focusout', function () {
1669      setTimeout(function () {
1670        jQuery('.autocomplete-suggestions').remove();
1671      }, 400);
1672    });
1673  }
1674
1675  function addSearchHint(label, url) {
1676    if (label.length > 3) {
1677      var old_items = JSON.parse(localStorage.getItem('sn_lastsearch')) || [];
1678      var new_item = {
1679        'label': label,
1680        'url': url
1681      };
1682
1683      if (old_items.length >= 8) {
1684        old_items.shift();
1685      }
1686
1687      old_items.push(new_item); // unique itmes
1688
1689      old_items = old_items.reduce(function (memo, e1) {
1690        var matches = memo.filter(function (e2) {
1691          return e1.label == e2.label && e1.url == e2.url;
1692        });
1693        if (matches.length == 0) memo.push(e1);
1694        return memo;
1695      }, []);
1696      localStorage.setItem('sn_lastsearch', JSON.stringify(old_items));
1697    }
1698  } // menu
1699
1700
1701  if (jQuery('.menu__dropline').length > 0) {
1702    var nav = jQuery('.sitewrapper > .navigation > .menu__layout');
1703    var navHeight = jQuery(nav).height();
1704    var items = jQuery(nav).find('> .menu__item');
1705    var itemHeight = jQuery(items).first().height(); // if menu has maultiple lines
1706
1707    if (navHeight / itemHeight > 1) {
1708      for (var i = 0; i < items.length; i++) {
1709        var menuBottom = jQuery(items[i]).offset().top + jQuery(items[i]).height();
1710        var submenu = jQuery('.menu__dropline' + jQuery(items[i]).data('id'));
1711
1712        if (!submenu.length) {
1713          continue;
1714        }
1715
1716        var submenuTop = jQuery(submenu).offset().top;
1717
1718        if (menuBottom === submenuTop) {
1719          continue;
1720        }
1721
1722        jQuery(submenu).css('top', '-' + (submenuTop - menuBottom) + 'px');
1723      }
1724    }
1725
1726    jQuery('.menu__layout .menu__item').hover(function (e) {
1727      jQuery('.menu__dropline.active').removeClass('active');
1728      var target = jQuery(e.target);
1729      var selector = '.menu__dropline' + target.data('id');
1730
1731      if (jQuery(selector).length > 0) {
1732        jQuery(selector).addClass('active');
1733
1734        if (jQuery('body').hasClass('menu-dropdown')) {
1735          jQuery(selector).css({
1736            left: target.position().left
1737          });
1738        }
1739      }
1740    });
1741    jQuery('.menu__dropline').mouseleave(function (e) {
1742      if (jQuery(e.target).hasClass('active')) {
1743        setTimeout(function () {
1744          jQuery(e.target).removeClass('active');
1745        }, 1000);
1746      }
1747
1748      if (jQuery(e.target).parent().hasClass('active')) {
1749        setTimeout(function () {
1750          jQuery(e.target).parent().removeClass('active');
1751        }, 1000);
1752      }
1753    });
1754  } // promobox script
1755
1756
1757  jQuery('.promobox__rotator').each(function (i, el) {
1758    var pbox = jQuery(el);
1759    var interval = pbox.data('interval') * 1000;
1760    var slides = [];
1761    var pagination = [];
1762    var active = 0; // add click events for images
1763
1764    pbox.find('.promobox__figure img').each(function (i, slide) {
1765      slide = jQuery(slide);
1766      slides[i] = slide.parent();
1767      slide.click(function () {
1768        window.open(slides[i].data('url'), slides[i].data('target'));
1769      });
1770    });
1771    slides[0].addClass('promobox__figure--active');
1772    window.gtmPromoEvents.trackElements(slides[0]); // main animation loop
1773
1774    if (slides.length > 1) {
1775      var animTime = setInterval(function () {
1776        slides[active].removeClass('promobox__figure--active');
1777
1778        if (pagination.length > 0) {
1779          pagination[active].removeClass('promobox__pagination--active');
1780        }
1781
1782        active = active >= slides.length - 1 ? 0 : active + 1;
1783        slides[active].addClass('promobox__figure--active');
1784        window.gtmPromoEvents.trackElements(slides[active]);
1785
1786        if (pagination.length > 0) {
1787          pagination[active].addClass('promobox__pagination--active');
1788        }
1789      }, interval);
1790    } // when pagination is enabled mark first dot/number as active and bind click events
1791
1792
1793    if (pbox.data('pagination') !== '0' && slides.length > 0) {
1794      pbox.parents().eq(2).find('.promobox__pagination li').eq(0).addClass('promobox__pagination--active');
1795      pbox.parents().eq(2).find('.promobox__pagination li').each(function (i, el) {
1796        el = jQuery(el);
1797        pagination[i] = el;
1798        el.click(function (e) {
1799          clearInterval(animTime);
1800          var aSlide = pbox.find('.promobox__figure--active');
1801          var aPager = pbox.parents().eq(2).find('.promobox__pagination--active');
1802          active = parseInt(el.html(), 10) - 1;
1803          aSlide.removeClass('promobox__figure--active');
1804          slides[active].addClass('promobox__figure--active');
1805          aPager.removeClass('promobox__pagination--active');
1806          pagination[active].addClass('promobox__pagination--active');
1807        });
1808      });
1809    } // bind events for prev/next arrows
1810
1811
1812    if (pbox.data('arrows') !== 0 && pbox.parent().find('.promobox__arrows').length > 0) {
1813      pbox.parent().find('.promobox__arrow--next').click(function (e) {
1814        e.preventDefault();
1815        e.stopPropagation();
1816        clearInterval(animTime);
1817        slides[active].removeClass('promobox__figure--active');
1818
1819        if (pagination.length > 0) {
1820          pagination[active].removeClass('promobox__pagination--active');
1821        }
1822
1823        active = active >= slides.length - 1 ? 0 : active + 1;
1824        slides[active].addClass('promobox__figure--active');
1825
1826        if (pagination.length > 0) {
1827          pagination[active].addClass('promobox__pagination--active');
1828        }
1829      });
1830      pbox.parent().find('.promobox__arrow--prev').click(function (e) {
1831        e.preventDefault();
1832        e.stopPropagation();
1833        clearInterval(animTime);
1834        slides[active].removeClass('promobox__figure--active');
1835
1836        if (pagination.length > 0) {
1837          pagination[active].removeClass('promobox__pagination--active');
1838        }
1839
1840        active = active <= 0 ? slides.length - 1 : active - 1;
1841        slides[active].addClass('promobox__figure--active');
1842
1843        if (pagination.length > 0) {
1844          pagination[active].addClass('promobox__pagination--active');
1845        }
1846      });
1847    }
1848  });
1849});
1850jQuery(window).on('load', function () {
1851  jQuery('.scroll_down').css('display', 'block');
1852});
1853jQuery(window).scroll(function () {
1854  var pos = jQuery(window).scrollTop();
1855
1856  if (jQuery('.topbar').length > 0 && jQuery('.hbox').length > 0) {
1857    if (pos > jQuery('.hbox').offset().top) {
1858      if (!jQuery('.topbar').hasClass('active')) {
1859        jQuery('.topbar').addClass('active');
1860      }
1861    } else {
1862      if (jQuery('.topbar').hasClass('active')) {
1863        jQuery('.topbar').removeClass('active');
1864      }
1865    }
1866  } else {
1867    if (pos > 400 && !jQuery('.topbar').hasClass('active')) {
1868      jQuery('.topbar').addClass('active');
1869    } else if (pos < 400 && jQuery('.topbar').hasClass('active')) {
1870      jQuery('.topbar').removeClass('active');
1871    }
1872  }
1873}); // Setup a listener to track Add to Homescreen events.
1874
1875window.addEventListener('beforeinstallprompt', function (e) {
1876  e.userChoice.then(function (choiceResult) {
1877    ga('send', 'event', 'A2H', choiceResult.outcome);
1878  });
1879});
1880
1881var eventTracking = function eventTracking() {
1882  var mapItems = function mapItems(product) {
1883    var quantity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
1884    var listName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
1885    var item = {
1886      item_name: product.name.trim() || '',
1887      item_id: String(product.id || ''),
1888      price: String(parseFloat(product.price || 0)),
1889      quantity: parseInt(quantity !== null && quantity !== void 0 ? quantity : '1')
1890    };
1891
1892    if (product.category) {
1893      item.item_category = product.category;
1894    }
1895
1896    if (product.category2) {
1897      item.item_category2 = product.category2;
1898    }
1899
1900    if (product.material) {
1901      item.item_material = product.material;
1902    }
1903
1904    if (listName !== null) {
1905      item.item_list_name = listName;
1906    }
1907
1908    return [item];
1909  };
1910
1911  jQuery('[data-event="ev"]').click(function (e) {
1912    var evCat = jQuery(this).data('category') || '',
1913        evAct = jQuery(this).data('action') || '',
1914        evLab = jQuery(this).data('label') || '',
1915        evVal = jQuery(this).data('value') || jQuery(this).data('item-price') || 0,
1916        evId = jQuery(this).data('pid') || '';
1917    var evItemCategory = jQuery(this).data('item-category') || '',
1918        evItemCategory2 = jQuery(this).data('item-category2') || '',
1919        evItemMaterial = jQuery(this).data('item-material') || '',
1920        evListName = jQuery(this).data('item-list-name') || null;
1921
1922    try {
1923      if (window.newMarkestic && !window.isBasket) {
1924        if (evAct === 'removeFromCart') {
1925          dataLayer.push({
1926            'event': 'cleanup',
1927            'ecommerce': null
1928          });
1929          var product = {
1930            name: evLab,
1931            id: evId,
1932            price: evVal,
1933            category: evItemCategory,
1934            category2: evItemCategory2,
1935            material: evItemMaterial
1936          };
1937          var items = mapItems(product);
1938          dataLayer.push({
1939            'event': 'remove_from_cart',
1940            'ecommerce': {
1941              'items': items
1942            }
1943          });
1944        }
1945      } else if (!window.newMarkestic) {
1946        dataLayer.push({
1947          'event': 'trackEvent',
1948          'eventCategory': evCat,
1949          'eventAction': evAct,
1950          'eventLabel': evLab,
1951          'eventValue': evVal
1952        });
1953      }
1954    } catch (e) {
1955      console.log(e);
1956    }
1957  });
1958  jQuery('.upsell a').click(function () {
1959    try {
1960      if (!window.newMarkestic) {
1961        dataLayer.push({
1962          'event': 'trackEvent',
1963          'eventCategory': 'ws-thankYouPage',
1964          'eventAction': 'upsellClick',
1965          'eventLabel': '',
1966          'eventValue': ''
1967        });
1968      }
1969    } catch (e) {
1970      console.log(e);
1971    }
1972  });
1973};
1974
1975function mapItems(product) {
1976  var _product$name;
1977
1978  var quantity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
1979  var listName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
1980  var item = {
1981    item_name: ((_product$name = product.name) === null || _product$name === void 0 ? void 0 : _product$name.trim()) || '',
1982    item_id: String(product.id || ''),
1983    price: String(parseFloat(product.price || 0)),
1984    quantity: parseInt(quantity !== null && quantity !== void 0 ? quantity : '1')
1985  };
1986
1987  if (product.category) {
1988    item.item_category = product.category;
1989  }
1990
1991  if (product.category2) {
1992    item.item_category2 = product.category2;
1993  }
1994
1995  if (product.material) {
1996    item.item_material = product.material;
1997  }
1998
1999  if (listName) {
2000    item.item_list_name = listName;
2001  }
2002
2003  return [item];
2004}
2005})();
2006
2007/******/ })()
2008;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.