PageSourceSearch

https://static.www.arkana.pl/scripts/47210062b50741b0bbd7c98c4169bb7b-global-body-arkana-1789479601747-.js

js arkana.pl collected 2026-09-25 01:04:09 UTC 59,728 bytes, 1,899 lines download raw bytes

1let intervalSlider = "";
2let intervalAv = "";
3let initJS = [true, true];
4
5setTimeout(() => {
6  const scroller = document.querySelector(".index4_line");
7  const view = document.querySelector(".index4_show");
8  const img = document.querySelector(".index4_img");
9  if (!scroller || !view || !img) {
10    // console.warn("Nie znaleziono wymaganych elementów. Skrypt został zatrzymany.");
11    return;
12  }
13
14  let selectLocked = false;
15
16  scroller?.addEventListener("touchstart", (e) => {
17    selectLocked = true;
18    e.preventDefault();
19  });
20
21  scroller?.addEventListener("mousedown", (e) => {
22    selectLocked = true;
23    e.preventDefault();
24  });
25
26  scroller?.addEventListener("touchend", (e) => {
27    selectLocked && (selectLocked = false);
28    e.preventDefault();
29  });
30
31  scroller?.addEventListener("mouseup", (e) => {
32    selectLocked && (selectLocked = false);
33    e.preventDefault();
34  });
35
36  function moveBar(clientData) {
37    if (selectLocked) {
38      const imgData = img.getBoundingClientRect();
39      if (clientData >= imgData.x && clientData <= imgData.x + imgData.width) {
40        const pos = clientData - imgData.x;
41        const percentWidth = 100 - (100 * pos) / imgData.width;
42
43        scroller.style.left = pos + "px";
44        view.style.width = percentWidth + "%";
45      }
46    }
47  }
48
49  img?.addEventListener("mousemove", (e) => {
50    e.preventDefault();
51    moveBar(e.clientX);
52  });
53
54  img?.addEventListener("touchmove", (e) => {
55    e.preventDefault();
56    moveBar(e.changedTouches[0].clientX);
57  });
58
59  img?.addEventListener("mouseleave", (e) => {
60    selectLocked = false;
61  });
62
63  window.onresize = function () {
64    scroller.style.left = "";
65    view.style.width = "";
66  };
67}, 1000);
68
69(function ($) {
70  const setAcco = function () {
71    if (initJS[0]) {
72      $(".acco_title").click(function () {
73        let hasclass = $(this).parent().hasClass("active");
74        $(".acco_box").removeClass("active");
75        $(".acco_txt").hide("slow", "linear");
76
77        if (hasclass) {
78          $(this).parent().removeClass("active");
79          $(this).next().hide("slow", "linear");
80        } else {
81          $(this).parent().addClass("active");
82          $(this).next().show("slow", "linear");
83        }
84      });
85    }
86    initJS[0] = false;
87  };
88
89  function timeoutSlider() {
90    intervalSlider = setInterval(function () {
91      if ($(".section_acco").length) {
92        clearInterval(intervalSlider);
93        setAcco();
94      }
95    }, 500);
96  }
97
98  $(document).ready(function () {
99    timeoutSlider();
100    let elemBodyCheck = document.querySelector("body");
101    let lastClassName = elemBodyCheck.className;
102
103    window.setInterval(function () {
104      let className = elemBodyCheck.className;
105      if (className !== lastClassName) {
106        initMainSlider = true;
107        timeoutSlider();
108        lastClassName = className;
109      }
110    }, 500);
111  });
112})(jQuery);
113
114(function () {
115  // Flaga, aby uniknąć wielokrotnego wykonania
116  let isCountryFixed = false;
117
118  // Funkcja ustawiająca Polskę jako stały kraj
119  function setPolandAsFixedCountry() {
120    if (isCountryFixed) return;
121
122    // Znajdujemy select z krajami
123    const countrySelect = document.querySelector(
124      'select[name="państwo"][data-testid="cart:address:country:input"]'
125    );
126    if (!countrySelect) {
127      return false;
128    }
129
130    try {
131      // Bezpośrednio ustaw wartość na Polska
132      countrySelect.value = "Polska";
133
134      // Wyślij zdarzenie change, które Vue może obserwować
135      countrySelect.dispatchEvent(
136        new Event("change", { bubbles: true, cancelable: true })
137      );
138
139      // Dodatkowe zdarzenie input dla pewności
140      countrySelect.dispatchEvent(
141        new Event("input", { bubbles: true, cancelable: true })
142      );
143
144      // Zablokuj możliwość zmiany
145      countrySelect.disabled = true;
146
147      isCountryFixed = true;
148      return true;
149    } catch (e) {
150      console.error("Błąd podczas ustawiania kraju:", e);
151      return false;
152    }
153  }
154
155  // Funkcja sprawdzająca czy formularz jest już widoczny
156  function checkAndSetCountry() {
157    // Spróbuj ustawić Polskę
158    setPolandAsFixedCountry();
159
160    // Sprawdzaj co 300ms przez 5 sekund
161    let attempts = 0;
162    const maxAttempts = 15; // 15 * 300ms = 4.5s
163
164    const intervalId = setInterval(function () {
165      attempts++;
166      if (setPolandAsFixedCountry() || attempts >= maxAttempts) {
167        clearInterval(intervalId);
168      }
169    }, 300);
170  }
171
172  // Funkcja nasłuchująca na radio button "Podaj nowy adres"
173  function setupListener() {
174    // Szukaj radio buttona po dokładnym selektorze
175    const newAddressRadio = document.querySelector(
176      'div[data-testid="core:cart-checkout-addresses:new-address:radio"] input'
177    );
178
179    if (newAddressRadio) {
180      // Nasłuchuj na zmianę stanu radio buttona
181      newAddressRadio.addEventListener("change", function (e) {
182        if (e.target.checked) {
183          // Daj chwilę na załadowanie formularza
184          setTimeout(checkAndSetCountry, 300);
185        }
186      });
187
188      // Jeśli radio button jest już zaznaczony, uruchom funkcję
189      if (newAddressRadio.checked) {
190        setTimeout(checkAndSetCountry, 300);
191      }
192    } else {
193      // Jeśli nie znaleziono, spróbuj ponownie za chwilę
194      setTimeout(setupListener, 500);
195    }
196  }
197
198  // Uruchom skrypt po załadowaniu DOM
199  if (document.readyState === "loading") {
200    document.addEventListener("DOMContentLoaded", setupListener);
201  } else {
202    setupListener();
203  }
204})();
205
206///ONE PLUGIN
207/* ================== USTAWIENIA ================== */
208var BP_DESKTOP = 992;
209var DESKTOP_STEP_MS = 1500; // tempo rotacji desktop
210var DESKTOP_BOOT_MS = 6000; // zapalnik co 6s (desktop)
211var MOBILE_CYCLE_MS = 6000; // auto-rotacja mobile
212
213/* ================== STAN ================== */
214var desktopRunning = false;
215var desktopTimerId = null;
216var desktopIndex = 0;
217
218var mobileRunning = false;
219var mobileTimerId = null;
220var mobileArmed = false; // czy czekamy na pierwszy scroll w dół
221var mobilePrevY = 0; // do detekcji kierunku (w dół)
222
223/* ================== DESKTOP ================== */
224function desktopStop() {
225  desktopRunning = false;
226  if (desktopTimerId) {
227    clearTimeout(desktopTimerId);
228    desktopTimerId = null;
229  }
230}
231
232function desktopStart() {
233  if (desktopRunning || window.innerWidth < BP_DESKTOP) return;
234
235  var items = document.querySelectorAll(".arkana-step");
236  if (!items.length) return;
237
238  desktopRunning = true;
239
240  items.forEach(function (item, idx) {
241    if (!item.__arkanaHoverBound) {
242      item.addEventListener("mouseover", function () {
243        items.forEach(function (it) {
244          it.classList.remove("active-item");
245        });
246        item.classList.add("active-item");
247        desktopIndex = idx;
248      });
249      item.__arkanaHoverBound = true;
250    }
251  });
252
253  function cycle() {
254    items = document.querySelectorAll(".arkana-step");
255    if (!items.length || !desktopRunning) return;
256
257    items.forEach(function (it) {
258      it.classList.remove("active-item");
259    });
260    items[desktopIndex % items.length].classList.add("active-item");
261    desktopIndex = (desktopIndex + 1) % items.length;
262
263    desktopTimerId = setTimeout(cycle, DESKTOP_STEP_MS);
264  }
265
266  cycle(); // start od razu
267}
268
269// Start desktop przy PIERWSZYM scrollu (bez czekania 6 s)
270window.addEventListener(
271  "scroll",
272  function () {
273    desktopStart();
274  },
275  { passive: true, once: true }
276);
277
278// Oryginalny „zapalnik” – co 6 s próbuj wystartować (jeśli jeszcze nie działa)
279setInterval(function () {
280  desktopStart();
281}, DESKTOP_BOOT_MS);
282
283/* ================== MOBILE (start po pierwszym scrollu W DÓŁ + auto co 6s) ================== */
284function mobileStop() {
285  if (mobileTimerId) {
286    clearInterval(mobileTimerId);
287    mobileTimerId = null;
288  }
289  mobileRunning = false;
290}
291
292function setActiveOne(items, i) {
293  items.forEach(function (it) {
294    it.classList.remove("active-item");
295  });
296  if (items[i]) items[i].classList.add("active-item");
297}
298
299function chooseNearestToCenter(items) {
300  var mid = window.innerHeight / 2;
301  var bestIdx = 0,
302    bestDist = Infinity;
303
304  items.forEach(function (item, idx) {
305    var r = item.getBoundingClientRect();
306    var c = r.top + r.height / 2;
307    var d = Math.abs(c - mid);
308    if (d < bestDist) {
309      bestDist = d;
310      bestIdx = idx;
311    }
312  });
313  return bestIdx;
314}
315
316function mobileStartNow() {
317  if (mobileRunning || window.innerWidth > BP_DESKTOP) return;
318
319  var items = document.querySelectorAll(".arkana-step");
320  if (!items.length) return;
321
322  mobileRunning = true;
323
324  // Ustaw start na elemencie najbliżej środka ekranu
325  var i = chooseNearestToCenter(items);
326  setActiveOne(items, i);
327
328  // Auto-rotacja co 6 s (bez reagowania na scroll)
329  mobileTimerId = setInterval(function () {
330    items = document.querySelectorAll(".arkana-step");
331    if (!items.length) return;
332    var current = Array.prototype.findIndex.call(items, function (el) {
333      return el.classList.contains("active-item");
334    });
335    var next = (current + 1) % items.length;
336    setActiveOne(items, next);
337  }, MOBILE_CYCLE_MS);
338}
339
340/* Uzbrój mobile: czekaj na PIERWSZY SCROLL W DÓŁ i dopiero wtedy startuj */
341function armMobileFirstScroll() {
342  if (mobileArmed || window.innerWidth > BP_DESKTOP) return;
343  mobileArmed = true;
344  mobilePrevY = window.scrollY;
345
346  function onFirstScroll() {
347    var y = window.scrollY;
348    if (y > mobilePrevY + 2) {
349      // kierunek w dół (z minimalnym marginesem)
350      mobileStartNow();
351      window.removeEventListener("scroll", onFirstScroll, { capture: false });
352      mobileArmed = false;
353    } else {
354      mobilePrevY = y; // aktualizuj i czekaj dalej
355    }
356  }
357  window.addEventListener("scroll", onFirstScroll, { passive: true });
358}
359
360/* Uzbrój mobile na starcie (ale nie startuj bez scrolla) */
361if (document.readyState === "loading") {
362  document.addEventListener("DOMContentLoaded", armMobileFirstScroll);
363} else {
364  armMobileFirstScroll();
365}
366
367/* ================== PRZEŁĄCZANIE TRYBÓW ================== */
368window.addEventListener("resize", function () {
369  if (window.innerWidth >= BP_DESKTOP) {
370    // przejście na desktop
371    mobileStop();
372    mobileArmed = false;
373    desktopStart();
374  } else {
375    // przejście na mobile – zatrzymaj desktop i uzbrój „pierwszy scroll w dół”
376    desktopStop();
377    mobileStop();
378    mobileArmed = false; // pozwól uzbroić ponownie
379    armMobileFirstScroll();
380  }
381});
382
383//OTREE CODE
384
385let listingContainerInterval = false;
386
387class ClassOTreeWatcher {
388  constructor(targetNode, classAddedCallback, classRemovedCallback) {
389    this.targetNode = targetNode;
390    this.lastClass = "";
391    this.classAddedCallback = classAddedCallback;
392    this.classRemovedCallback = classRemovedCallback;
393    this.observer = null;
394
395    this.init();
396  }
397
398  init() {
399    this.observer = new MutationObserver(this.mutationCallback);
400    this.observe();
401  }
402
403  observe() {
404    this.observer.observe(this.targetNode, { attributes: true });
405  }
406
407  disconnect() {
408    this.observer.disconnect();
409  }
410
411  mutationCallback = (mutationsList) => {
412    for (let mutation of mutationsList) {
413      if (
414        mutation.type === "attributes" &&
415        mutation.attributeName === "class"
416      ) {
417        if (this.lastClass !== mutation.target.className) {
418          // otreeOneApp.consoleLog(
419          //   "mutation.target class: " + mutation.target.className
420          // );
421          // otreeOneApp.consoleLog(mutation.target);
422          this.classRemovedCallback(this.lastClass);
423          this.lastClass = mutation.target.className;
424          this.classAddedCallback(mutation.target.className);
425        }
426      }
427    }
428  };
429}
430
431var otreeOneApp = {};
432
433jQuery(document).ready(function ($) {
434  $.extend(window.otreeOneApp, {
435    data: {
436      ver: "1.1",
437      initSiteStatus: false, //be siure that we use only once to start page initation
438      initStartWatcher: false, //be siure that we use only once to start page initation
439      isLogged: false, //user is logged
440      actualStatus: "", //actual status of site - which page is showing
441      watchSite: null, //watcher class
442      intervalSet: null, //global var for root interval
443      bodyElement: null, //'body' element - faster var
444      nuxtElement: null, //'nuxt' element - faster var
445      urlActual: null, //use for check actual url changes in catalog list
446      mobileON: null, //is mobile view - by viewport size
447      intervals: [], //array for temporary interval garbage
448      staticPages: ["o-nas", "kontakt", "kariera"], //maybe to use for check it is static page???? - sofar not used!!!!
449      timeoutStartOffset: 500, //vue inject new class to body on changes start - wait minimal one frame to start rest functions on part of elements, used for core staff
450      timeoutIntervals: 300, //intervals time to wait on class - used for custom intervals on each page
451      listingProducts: [], //intervals time to wait on class - used for custom intervals on each page
452      listingGrid: "list", //intervals time to wait on class - used for custom intervals on each page [list | tiles | minilist]
453      productGrid: "list", //intervals time to wait on class - used for custom intervals on each page [list | tile | minilist]
454      defaultSwiper: {
455        // default setting for swiper
456        spaceBetween: 24,
457        slidesPerView: 3.5,
458        loop: false,
459        scrollbar: {
460          el: ".swiper-scrollbar",
461          draggable: true,
462        },
463        breakpoints: {
464          360: {
465            spaceBetween: 24,
466            slidesPerView: 3.5,
467          },
468          680: {
469            spaceBetween: 24,
470            slidesPerView: 5,
471          },
472          1024: {
473            spaceBetween: 72,
474            slidesPerView: 7.8,
475          },
476        },
477      },
478      regexes: {
479        //example of regex
480        emailRegex:
481          /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
482        emailLength: 320,
483        phoneRegex: /^[0-9 ()+]+$/,
484        passRegexVeryWeak: /(?=.*[a-z])(?=\S+$).{12,64}$/,
485        passRegexWeak: /^(?=.*[0-9])(?=.*[a-z])(?=\S+$).{12,64}$/,
486        passRegexMedium:
487          /^(?=.*[0-9])(?=.*[a-z])(?=.*[#%&()*+,-.:;=?@\[\]^_{|}!~])(?=\S+$).{12,64}$/,
488        passRegex:
489          /^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[#%&()*+,-.:;=?@\[\]^_{|}!~])(?=\S+$).{12,64}$/,
490        // phoneRegex: /^\+[0-9]{2}-?[0-9]{9}$/,
491      },
492    },
493
494    consoleLog: function (log) {
495      let showTimeExecute = false;
496      let showPrefix = true;
497      let logInfo = log;
498      if (showTimeExecute) logInfo = window.performance.now() + " > " + logInfo;
499      if (showPrefix) logInfo = "OTREE > " + logInfo;
500
501      // console.log(logInfo);
502
503      if (typeof log === "object") {
504        // console.log(log);
505      }
506      return true;
507    },
508
509    initSwiper: function (classTo, dataTo) {
510      let dataSet = Object.assign(dataTo, otreeOneApp.data.defaultSwiper);
511      new Swiper(classTo, dataSet);
512    },
513
514    /**
515     * Global  interval one for alls - initiate
516     */
517    startInterval: function () {
518      //restart global interval
519      if (otreeOneApp.data.intervalSet == null)
520        otreeOneApp.data.intervalSet = setInterval(
521          otreeOneApp.checkIntervals,
522          otreeOneApp.data.timeoutIntervals
523        );
524    },
525
526    /**
527     * Global  interval one for alls - stop if nothing to check
528     */
529    stopInterval: function () {
530      //restart global interval
531      if (otreeOneApp.data.intervalSet != null)
532        clearInterval(otreeOneApp.data.intervalSet);
533      otreeOneApp.data.intervalSet = null;
534    },
535
536    /**
537     * check intervals all for once on one global interval caller
538     */
539    checkIntervals: function () {
540      for (let i = otreeOneApp.data.intervals.length; i > 0; i--) {
541        let elem = otreeOneApp.data.intervals[i - 1];
542
543        switch (elem.type.trim()) {
544          case "swiper":
545            if (document.getElementsByClassName(elem.classTo).length > 0) {
546              otreeOneApp.initSwiper(elem.classTo, elem.dataTo);
547              otreeOneApp.data.intervals.splice(i - 1, 1);
548            }
549            break;
550
551          case "function":
552            if (elem.classTo != null) {
553              if (document.getElementsByClassName(elem.classTo).length > 0) {
554                otreeOneApp.initFunction(elem);
555                otreeOneApp.data.intervals.splice(i - 1, 1);
556              }
557            } else {
558              if (otreeOneApp.initFunction(elem)) {
559                otreeOneApp.data.intervals.splice(i - 1, 1);
560              }
561            }
562
563            break;
564        }
565      }
566
567      if (otreeOneApp.data.intervals.length == 0) {
568        otreeOneApp.stopInterval();
569      }
570    },
571
572    initFunction: function (data) {
573      let isEnd = false;
574      if (data.functionNamesTo != null && data.functionNamesTo.trim() != "") {
575        isEnd = window[data.functionNamesTo.trim()][data.functionTo.trim()](
576          data.dataTo
577        );
578      } else if (data.functionTo != null && data.functionTo.trim() != "") {
579        isEnd = window[data.functionTo.trim()]?.(data.dataTo);
580      }
581      return isEnd;
582    },
583
584    /**
585     *
586     * @param {*} data
587     * - type - function or swipe - swipe are call only once after find classTo,
588     * - classTo - class to search to init function/swiper - close interval, if null interval will be close by return true from function called
589     * - dataTo - data to swipe or function in one object {}
590     * - functionTo - function to call in type=function - return true to close interval - functionToCall
591     * - functionNamesTo - name space - for example otreeOneApp -> otreeOneApp.functionToCall
592     */
593    addIntervalFunction: function (data) {
594      otreeOneApp.startInterval();
595
596      let dataInterval = {
597        type: "function", //swipe, function,
598        classTo: null,
599        dataTo: null,
600        functionTo: null,
601        functionNamesTo: null,
602      };
603
604      Object.assign(dataInterval, data);
605
606      otreeOneApp.data.intervals.push(dataInterval);
607    },
608
609    cleanAllIntervals: function () {
610      // otreeOneApp.consoleLog("clear ALL intervals");
611      /*       for (i = 0; i < otreeOneApp.data.intervals.length; i++) {
612                
613                clearInterval(otreeOneApp.data.intervals[i]);
614              } */
615      otreeOneApp.data.intervals = [];
616    },
617
618    addSwiper: function (classSwipeToObserve, dataSwipe) {
619      otreeOneApp.addIntervalFunction({
620        type: "swiper",
621        classTo: classSwipeToObserve,
622        dataTo: dataSwipe,
623      });
624    },
625
626    /**
627     * Start every refresh page by browser - from zero - once pare view time (view time is unless page is refreshing)
628     */
629
630    initSite: function () {
631      //INIT MENU ELEMENTS
632      //INIT FOOTER ELEMENTS
633      // otreeOneApp.consoleLog("START");
634      //resize window to add for lisitng problem on RWD - maybe not necessary?
635      otreeOneApp.initWindowSize();
636    },
637
638    loginPage: function () {
639      //SHOW LOGIN PAGE
640      // otreeOneApp.consoleLog("loginPage");
641    },
642    cartPage: function () {
643      //SHOW CART PAGE
644      // otreeOneApp.consoleLog("cart");
645      otreeOneApp.addIntervalFunction({ functionTo: "inputOnCart" });
646      // otreeOneApp.inputOnCart();
647    },
648
649    registrationPage: function () {
650      //SHOW registration PAGE
651      // otreeOneApp.consoleLog("registrationPage");
652      otreeOneApp.addIntervalFunction({ functionTo: "registrationFormFields" });
653      otreeOneApp.addIntervalFunction({ functionTo: "registrationCheckbox" });
654      // waitForElement(
655      //   ".one-cms-products-rotator .swiper-container",
656      //   // homeRotatorsScripts
657      // );
658    },
659
660    initWindowSize: function () {
661      window.addEventListener("resize", otreeOneApp.changedWindowSize);
662      otreeOneApp.setWindowSize();
663    },
664
665    changedWindowSize: function () {
666      otreeOneApp.setWindowSize();
667    },
668
669    setWindowSize: function () {
670      let mobileON = false;
671      if (window.innerWidth < 992) {
672        mobileON = true;
673      }
674
675      //on change size after init status of window size, and size is changes mobile/desktop and grid is not listing
676      if (
677        otreeOneApp.data.mobileON != null && //not on init site
678        otreeOneApp.data.mobileON != mobileON && //it must be changed size range
679        otreeOneApp.data.listingGrid != "list" //problem is when system change grid from desktop not list to mobile list - FIXME: check is problem only desktop>mobile or both desktop<>mobile
680      ) {
681        otreeOneApp.checkListingChange(
682          document.body.getAttribute("class").split(" ")[0]
683        );
684      }
685      otreeOneApp.data.mobileON = mobileON;
686    },
687
688    checkLogin: function () {
689      //INIT LOGIN PAGE
690      let islogged = false;
691
692      /* if (typeof isAuthenticated !== "undefined") {
693                  islogged = true;
694                } */
695      const logoutComponent = document.querySelector(
696        ".one-login-logout-component"
697      );
698      if (logoutComponent?.textContent.trim() == "Wyloguj") {
699        islogged = true;
700        logoutComponent.addEventListener("click", otreeOneApp.checkLogin);
701      }
702
703      if (otreeOneApp.data.isLogged != islogged) {
704        if (otreeOneApp.data.isLogged) {
705          //redirect - problems with change from logged - to logout - functionality to refresh
706          location.reload();
707          return true;
708        }
709        otreeOneApp.data.isLogged = islogged;
710        otreeOneApp.loginChanged();
711      }
712      otreeOneApp.data.isLogged = islogged;
713    },
714
715    loginChanged: function () {
716      //Login status is changed
717      otreeOneApp.consoleLog(
718        "loginChanged - CALL ACTION TO CHANGE STATUS > " +
719          otreeOneApp.data.isLogged
720      );
721      if (otreeOneApp.data.isLogged) {
722        otreeOneApp.data.nuxtElement.classList.add("logged");
723      } else {
724        otreeOneApp.data.nuxtElement.classList.remove("logged");
725      }
726      otreeOneApp.refreshStatus();
727    },
728
729    /**
730     * Start by refresh page
731     */
732    home: function () {
733      //INIT HOME ELEMENTS
734      // otreeOneApp.consoleLog("HOME");
735      // waitForElement(
736      //   ".one-cms-products-rotator .swiper-container",
737      //   homeRotatorsScripts
738      // );
739      outLine();
740      outlineMobile();
741      initHomeSwipers();
742    },
743
744    /**
745     * Start by by refresh page
746     * @param {*} classChange - slug of page
747     */
748    checkStaticPage: function (classChange) {
749      //INIT STATIC PAGE ELEMENTS - CHECK BY classChange
750      // otreeOneApp.consoleLog("STATIC PAGE " + classChange);
751
752      switch (classChange) {
753        case "regulamin":
754          selectLink();
755          accordionBlock();
756          footerAccordion();
757          break;
758        case "polityka-prywatnosci":
759          selectLink();
760          accordionBlock();
761          footerAccordion();
762          break;
763        case "warunki-i-koszty-dostawy":
764          selectLink();
765          accordionBlock();
766          footerAccordion();
767          break;
768        case "reklamacje-i-zwroty":
769          selectLink();
770          accordionBlock();
771          footerAccordion();
772          break;
773        case "reklamacje-i-zwroty":
774          selectLink();
775          accordionBlock();
776          footerAccordion();
777          break;
778        default:
779          //rest pages
780          // otreeOneApp.consoleLog("strona statyczna test");
781          break;
782      }
783    },
784
785    /**
786     * Start by refresh page && by react only inject in content elems !!!! DANGER - use check for elements to eliminate double initation or use removeCallBack
787     * @param {*} classChange - slug of page
788     */
789    checkListing: function (classChange) {
790      //add event listener for filters change - listing is changing without refresh and change body class after use filters
791      // otreeOneApp.consoleLog("CATALOG LIST " + classChange);
792      // addCategoryBanner(classChange);
793      // addSpecificCategoryBanner();
794      updateListingFilters();
795
796      //add baner to category page - top of listing
797      //otreeOneApp.addIntervalFunction({ functionTo: "addBanner" });
798
799      //check url in intervals
800      otreeOneApp.addIntervalFunction({
801        functionTo: "checkListingURL",
802        functionNamesTo: "otreeOneApp",
803      });
804      //add check grid changes
805      let gridBtns = document.querySelectorAll(".one-toolbar-list__tool i");
806      gridBtns.forEach((btn) => {
807        btn.addEventListener("click", otreeOneApp.checkGridChange);
808      });
809      //check actual
810      otreeOneApp.checkGridChangeByElem(
811        document.querySelector(".one-toolbar-list__tool i.active")
812      );
813    },
814
815    checkGridChange: function (e) {
816      // otreeOneApp.consoleLog("checkGridChange ");
817      // otreeOneApp.consoleLog(e);
818      otreeOneApp.checkGridChangeByElem(e.currentTarget);
819      otreeOneApp.checkListingChange(
820        document.body.getAttribute("class").split(" ")[0]
821      );
822    },
823
824    checkGridChangeByElem: function (elem) {
825      if ($(elem).hasClass("icon-view-list")) {
826        otreeOneApp.data.listingGrid = "list";
827        otreeOneApp.data.productGrid = "list";
828      } else if ($(elem).hasClass("icon-view-tiles")) {
829        otreeOneApp.data.listingGrid = "tiles";
830        otreeOneApp.data.productGrid = "tile";
831      } else if ($(elem).hasClass("icon-view-minilist")) {
832        otreeOneApp.data.listingGrid = "minilist";
833        otreeOneApp.data.productGrid = "minilist";
834      }
835    },
836
837    /**
838     *
839     * @param {*} classChange
840     * action by changing sorting, filters
841     */
842    // checkListingChange: function (classChange) {
843    //   otreeOneApp.consoleLog("CATALOG LIST CHANGED URL " + classChange);
844
845    //   if ($(".one-selected-filters__row.py-1 .pl-1").length > 0) {
846    //     $(".one-catalog-view-list__catalog-row").addClass("activefilters");
847    //   } else {
848    //     $(".one-catalog-view-list__catalog-row").removeClass("activefilters");
849    //   }
850
851    //   updateListingFiltersInterval = setInterval(updateListingFilters, 1000);
852
853    //   if (classChange === "search") {
854    //     urlParamsHandler(classChange);
855    //   } else {
856    //     addCategoryBanner(classChange);
857    //   }
858
859    //   otreeOneApp.addIntervalFunction({
860    //     functionTo: "productListStart",
861    //     functionNamesTo: "otreeOneApp",
862    //   });
863    //   // //FIXME: przeniesc te funkcje do setProductData()
864    //   // otreeOneApp.addIntervalFunction({ functionTo: "addMinLog" });
865    //   // otreeOneApp.addIntervalFunction({ functionTo: "productAsk" });
866    // },
867    checkListingChange: function (classChange) {
868      // otreeOneApp.consoleLog("CATALOG LIST CHANGED URL " + classChange);
869
870      // Check if there are selected filters
871      if ($(".one-selected-filters__row.py-1 .pl-1").length > 0) {
872        $(".one-catalog-view-list__catalog-row").addClass("activefilters");
873      } else {
874        $(".one-catalog-view-list__catalog-row").removeClass("activefilters");
875      }
876
877      // Handle search or category change
878      if (classChange === "search") {
879      }
880
881      // Add interval functions for product list start
882      otreeOneApp.addIntervalFunction({
883        functionTo: "productListStart",
884        functionNamesTo: "otreeOneApp",
885      });
886
887      // Check if the URL ends with id- followed by digits
888      const urlPattern = /id-\d+$/;
889      if (urlPattern.test(window.location.href)) {
890        // otreeOneApp.consoleLog("sprawdzenie url");
891        otreeOneApp.addIntervalFunction({
892          functionTo: "checkPageStatus",
893          functionNamesTo: "otreeOneApp",
894        });
895      }
896
897      // //FIXME: przeniesc te funkcje do setProductData()
898      // otreeOneApp.addIntervalFunction({ functionTo: "addMinLog" });
899      // otreeOneApp.addIntervalFunction({ functionTo: "productAsk" });
900    },
901
902    /**
903     * check listing - available products - init functionality
904     */
905    productListStart: function () {
906      // otreeOneApp.consoleLog("productListStart 33");
907      otreeOneApp.data.listingProducts = Array.from(
908        document.querySelectorAll(".products-content > div")
909      );
910      //check by grid class in product to verify that it is target list
911      if (
912        otreeOneApp.data.listingProducts.length > 0 &&
913        $(otreeOneApp.data.listingProducts[0]).hasClass(
914          "one-product-" + otreeOneApp.data.productGrid + "-view"
915        )
916      ) {
917        otreeOneApp.addIntervalFunction({
918          functionTo: "productListCheck",
919          functionNamesTo: "otreeOneApp",
920        });
921        return true;
922      }
923      return false;
924    },
925
926    /**
927     * sprawdzanie dostepności produktów
928     * tylko dla list grid wymaga sprawdzenia - pozostałe gridy są rednerowane w całości od razu
929     * @returns
930     */
931    productListCheck: function () {
932      // otreeOneApp.consoleLog(
933      //   "productListCheck " + otreeOneApp.data.listingProducts.length
934      // );
935      for (let i = otreeOneApp.data.listingProducts.length; i > 0; i--) {
936        const product = otreeOneApp.data.listingProducts[i - 1];
937        //testowo dodana klasa finded - dla pewności że nie poszedł refresh obiektu bez naszej wiedzy
938        $(product).addClass("finded");
939        if (otreeOneApp.data.listingGrid == "list") {
940          if ($(product).find(".one-product-list-view__tile").length > 0) {
941            otreeOneApp.setProductData(product, otreeOneApp.data.listingGrid);
942            otreeOneApp.data.listingProducts.splice(i - 1, 1);
943          }
944        } else {
945          otreeOneApp.setProductData(product, otreeOneApp.data.listingGrid);
946          otreeOneApp.data.listingProducts.splice(i - 1, 1);
947        }
948      }
949      if (otreeOneApp.data.listingProducts.length == 0) {
950        return true;
951      }
952      return false;
953    },
954
955    /**
956     * set all necessary events/content after one product dom element if is available (each of list refresh is set from all products from zero)
957     * use grid to check which template use - you can use only global function if no need any changes in special grid
958     * @param {*} product - DOM element
959     */
960    setProductData: function (product, grid) {
961      //global --->
962      // otreeOneApp.consoleLog("set product ");
963      // otreeOneApp.consoleLog(product, grid);
964      // //FIXME: przeniesc te funkcje do setProductData()
965      // otreeOneApp.addIntervalFunction({ functionTo: "addMinLog" });
966      // otreeOneApp.addIntervalFunction({ functionTo: "productAsk" });
967      //addMinLogProduct(product);
968      // productAsk(product);
969      //by grid --->
970
971      listingProductsUpdate(product);
972
973      switch (grid) {
974        case "tiles":
975          otreeOneApp.setProductDataTiles(product);
976          break;
977        case "minilist":
978          otreeOneApp.setProductDataMiniList(product);
979          break;
980        default:
981          otreeOneApp.setProductDataList(product);
982          break;
983      }
984    },
985
986    setProductDataList: function (product) {},
987
988    setProductDataTiles: function (product) {},
989
990    setProductDataMiniList: function (product) {},
991
992    /**
993     * call function at start and all changes in listing products - change lef sidebar, list of products, settings for filter, etc
994     * if changes filters, grid, sort elements in catalog listing
995     */
996    checkListingURL: function () {
997      // otreeOneApp.consoleLog("checkListingURL - changes filters, grid, sort");
998      let urlCheck = window.location.href;
999      let classChange = document.body.getAttribute("class").split(" ")[0];
1000      if (otreeOneApp.data.urlActual != urlCheck) {
1001        otreeOneApp.data.urlActual = urlCheck;
1002        //TOCHECK: - ADD setTimeout?
1003        otreeOneApp.checkListingChange(classChange);
1004      }
1005    },
1006
1007    /**
1008     * Start by refresh page && by react only inject in content elems !!!! DANGER - use check for elements to eliminate double initation or use removeCallBack
1009     * @param {*} classChange - slug of page
1010     */
1011    checkProduct: function (classChange) {
1012      // otreeOneApp.addIntervalFunction({ functionTo: "showWarehouses" });
1013      prodCardRelatedInterval = setInterval(prodCardRelatedScript, 1000);
1014      otreeOneApp.addIntervalFunction({ functionTo: "otreeProductPageInput" });
1015      otreeOneApp.addIntervalFunction({ functionTo: "swiperCarousel" });
1016      otreeOneApp.addIntervalFunction({ functionTo: "accordionBlock" });
1017      otreeOneApp.addIntervalFunction({ functionTo: "productTooltipButtons" });
1018      otreeOneApp.addIntervalFunction({ functionTo: "addHomeBreadcrumb" });
1019      otreeOneApp.addIntervalFunction({ functionTo: "footerAccordion" });
1020    },
1021
1022    /**
1023     * Start by refresh page
1024     * @param {*} classChange - slug of page
1025     */
1026    error404: function (classChange) {
1027      setErrorPage();
1028      otreeOneApp.consoleLog("404??? " + classChange);
1029    },
1030
1031    validatePass: function () {
1032      let passFormat = otreeOneApp.data.regexes.passRegex.test(
1033        $("#userPass").val()
1034      );
1035      if (passFormat) {
1036        //passed
1037      }
1038    },
1039
1040    /**
1041     * Call before set of new status - clean changes removed page - attention it starts on zero event
1042     * @param {*} classChange - slug of page
1043     */
1044    removeCallBack: function (classChange) {
1045      // otreeOneApp.consoleLog("removeCallBack - cleaning");
1046      otreeOneApp.cleanAllIntervals();
1047    },
1048
1049    /**
1050     * Call after set of new status - start new functionality
1051     * @param {*} classChange - slug of page
1052     */
1053    addCallBack: function (classChange) {
1054      // otreeOneApp.consoleLog("addCallBack");
1055      otreeOneApp.data.initStartWatcher = true;
1056      /**
1057       * use safety time for remove intervals from callback
1058       */
1059      if (classChange != "")
1060        setTimeout(function () {
1061          // otreeOneApp.consoleLog("test pusta klasa");
1062          otreeOneApp.checkPageStatus(classChange);
1063        }, otreeOneApp.data.timeoutStartOffset);
1064    },
1065
1066    checkPageStatus: function (classChange) {
1067      otreeOneApp.checkLogin();
1068      // otreeOneApp.consoleLog("checkPageStatus " + classChange);
1069
1070      let classArr = classChange.split(" ");
1071      // otreeOneApp.consoleLog(classArr);
1072      // otreeOneApp.consoleLog("logged: " + otreeOneApp.data.isLogged);
1073      //not necessary - we only check first of class in body element
1074      classChange = classArr[0];
1075      otreeOneApp.data.actualStatus = classChange;
1075 //for use extra function to check status pages, and for refresh status
1076
1077      if (!otreeOneApp.data.initSiteStatus) {
1078        otreeOneApp.data.initSiteStatus = true;
1079        otreeOneApp.initSite();
1080      }
1081
1082      if (classChange == "index") {
1083        otreeOneApp.home();
1084        return true;
1085      }
1086      if (classChange == "blog") {
1087        return true;
1088      }
1089
1090      if (classChange == "login") {
1091        otreeOneApp.loginPage();
1092
1093        return true;
1094      }
1095
1096      if (classChange == "registration") {
1097        otreeOneApp.registrationPage();
1098        return true;
1099      }
1100      if (classChange == "cart") {
1101        otreeOneApp.cartPage();
1102        return true;
1103      }
1104
1105      if (classChange === "search" && !listingContainerInterval) {
1106        listingContainerInterval = setInterval(() => {
1107          if (
1108            document.querySelector(
1109              ".row.one-catalog-view-list__catalog-row > .px-0.col-lg-9.col-12 .products-content"
1110            )
1111          ) {
1112            clearInterval(listingContainerInterval);
1113            otreeOneApp.checkListing(classChange);
1114            listingContainerInterval = false;
1115          }
1116        }, 1000);
1117        return true;
1118      }
1119
1120      if (document.getElementsByClassName("static-page").length == 1) {
1121        otreeOneApp.checkStaticPage(classChange);
1122        return true;
1123      }
1124      if (document.getElementsByClassName("one-static-page").length == 1) {
1125        otreeOneApp.checkStaticPage(classChange);
1126        return true;
1127      }
1128
1129      if (document.getElementsByClassName("one-product-page").length == 1) {
1130        otreeOneApp.checkProduct(classChange);
1131        return true;
1132      }
1133
1134      if (
1135        document.getElementsByClassName("one-catalog-view-list").length == 1
1136      ) {
1137        otreeOneApp.checkListing(classChange);
1138        return true;
1139      }
1140
1141      if (document.getElementsByClassName("error-container").length == 1) {
1142        otreeOneApp.error404(classChange);
1143        return true;
1144      }
1145
1146      // otreeOneApp.consoleLog("NIE WIADOMO " + classChange);
1147      setTimeout(function () {
1148        otreeOneApp.checkPageStatus(classChange);
1149      }, otreeOneApp.data.timeoutStartOffset);
1150    },
1151
1152    refreshStatus: function () {
1153      // otreeOneApp.consoleLog("refreshStatus");
1154      let classChecks = document
1155        .getElementsByTagName("body")[0]
1156        .className.split(" ")[0];
1157      otreeOneApp.removeCallBack(otreeOneApp.data.actualStatus);
1158      otreeOneApp.checkPageStatus(classChecks);
1159    },
1160
1161    checkInit: function () {
1162      // otreeOneApp.consoleLog(
1163      //   "checkInit " +
1164      //     otreeOneApp.data.initSiteStatus +
1165      //     " watcher " +
1166      //     otreeOneApp.data.initStartWatcher
1167      // );
1168      if (!otreeOneApp.data.initStartWatcher) {
1169        let classChange = document
1170          .getElementsByTagName("body")[0]
1171          .className.split(" ")[0];
1172        if (classChange != "") {
1173          // otreeOneApp.consoleLog("checkInit checkPageStatus");
1174          otreeOneApp.checkPageStatus(classChange);
1175        } else {
1176          // otreeOneApp.consoleLog("checkInit setTimeout");
1177          setTimeout(
1178            otreeOneApp.checkInit,
1179            otreeOneApp.data.timeoutStartOffset
1180          );
1181        }
1182      }
1183    },
1184
1185    init: function () {
1186      // otreeOneApp.consoleLog("init otree observer " + otreeOneApp.data.ver);
1187
1188      otreeOneApp.data.bodyElement = document.body;
1189      otreeOneApp.data.nuxtElement = document.getElementById("__nuxt");
1190
1191      //on problem when vue has change body class before watcher has started
1192      //setTimeout(otreeOneApp.checkInit, otreeOneApp.data.timeoutStartOffset);
1193
1194      otreeOneApp.data.watchSite = new ClassOTreeWatcher(
1195        document.getElementsByTagName("body")[0],
1196        otreeOneApp.addCallBack,
1197        otreeOneApp.removeCallBack
1198      );
1199      // otreeOneApp.consoleLog("zakonczenie");
1200    },
1201  });
1202  otreeOneApp.init();
1203});
1204
1205const intervalId = setInterval(() => {
1206  if (document.querySelector(".adress-form__checkbox")) {
1207    clearInterval(intervalId);
1208    return;
1209  }
1210  document.body.className = "registration";
1211  if (window.otreeOneApp && typeof otreeOneApp.addCallBack === "function") {
1212    otreeOneApp.addCallBack("registration");
1213  }
1214}, 1600);
1215
1216let swiperInit = setInterval(function () {
1217  const el = document.querySelector(".myOurline");
1218  if (el && !el.classList.contains("swiper-initialized")) {
1219    new Swiper(".myOurline", {
1220      slidesPerView: 4,
1221      spaceBetween: 20,
1222      navigation: {
1223        nextEl: ".swiper-button-next",
1224        prevEl: ".swiper-button-prev",
1225      },
1226      breakpoints: {
1227        0: {
1228          slidesPerView: 2,
1229          grid: {
1230            rows: 2,
1231            fill: "row",
1232          },
1233        },
1234        992: {
1235          slidesPerView: 4,
1236          grid: {
1237            rows: 1,
1238            fill: "row",
1239          },
1240        },
1241      },
1242    });
1243    clearInterval(swiperInit);
1244  }
1245}, 1600);
1246
1247// let otreeTimeout20jb = setInterval(function () {
1248//   if (window.innerWidth > 992) {
1249//     document.querySelectorAll(".ourline__item").forEach((item) => {
1250//       item.addEventListener("mouseenter", () => {
1251//         const category = item.querySelector(".ourline__category");
1252//         const desc = item.querySelector(".ourline__desc");
1253//         if (category && desc) {
1254//           category.style.opacity = "0";
1255//           category.style.pointerEvents = "none";
1256//           desc.style.opacity = "1";
1257//           desc.style.pointerEvents = "auto";
1258//           desc.style.zIndex = "3";
1259//           category.style.zIndex = "1";
1260//         }
1261//       });
1262
1263//       item.addEventListener("mouseleave", () => {
1264//         const category = item.querySelector(".ourline__category");
1265//         const desc = item.querySelector(".ourline__desc");
1266//         if (category && desc) {
1267//           category.style.opacity = "1";
1268//           category.style.pointerEvents = "auto";
1269//           desc.style.opacity = "0";
1270//           desc.style.pointerEvents = "none";
1271//           desc.style.zIndex = "1";
1272//           category.style.zIndex = "3";
1273//         }
1274//       });
1275//     });
1276
1277//     clearInterval(otreeTimeout20jb);
1278//   }
1279// }, 1000);
1280
1281function outLine() {
1282  if (window.innerWidth > 992) {
1283    document.querySelectorAll(".ourline__item").forEach((item) => {
1284      item.addEventListener("mouseenter", () => {
1285        const category = item.querySelector(".ourline__category");
1286        const desc = item.querySelector(".ourline__desc");
1287        if (category && desc) {
1288          category.style.opacity = "0";
1289          category.style.pointerEvents = "none";
1290          desc.style.opacity = "1";
1291          desc.style.pointerEvents = "auto";
1292          desc.style.zIndex = "3";
1293          category.style.zIndex = "1";
1294        }
1295      });
1296
1297      item.addEventListener("mouseleave", () => {
1298        const category = item.querySelector(".ourline__category");
1299        const desc = item.querySelector(".ourline__desc");
1300        if (category && desc) {
1301          category.style.opacity = "1";
1302          category.style.pointerEvents = "auto";
1303          desc.style.opacity = "0";
1304          desc.style.pointerEvents = "none";
1305          desc.style.zIndex = "1";
1306          category.style.zIndex = "3";
1307        }
1308      });
1309    });
1310  }
1311}
1312
1313function outlineMobile() {
1314  const items = document.querySelectorAll(".ourline__item");
1315  let activeItem = null;
1316
1317  function showDesc(item) {
1318    const category = item.querySelector(".ourline__category");
1319    const desc = item.querySelector(".ourline__desc");
1320    if (category && desc) {
1321      category.style.opacity = "0";
1322      category.style.pointerEvents = "none";
1323      desc.style.opacity = "1";
1324      desc.style.pointerEvents = "auto";
1325      desc.style.zIndex = "3";
1326      category.style.zIndex = "1";
1327    }
1328  }
1329
1330  function hideDesc(item) {
1331    const category = item.querySelector(".ourline__category");
1332    const desc = item.querySelector(".ourline__desc");
1333    if (category && desc) {
1334      category.style.opacity = "1";
1335      category.style.pointerEvents = "auto";
1336      desc.style.opacity = "0";
1337      desc.style.pointerEvents = "none";
1338      desc.style.zIndex = "1";
1339      category.style.zIndex = "3";
1340    }
1341  }
1342
1343  items.forEach((item) => {
1344    const category = item.querySelector(".ourline__category");
1345
1346    if (category) {
1347      category.addEventListener("click", (e) => {
1348        e.stopPropagation();
1349
1350        if (activeItem === item) {
1351          hideDesc(item);
1352          activeItem = null;
1353        } else {
1354          if (activeItem) hideDesc(activeItem);
1355          showDesc(item);
1356          activeItem = item;
1357        }
1358      });
1359    }
1360  });
1361
1362  document.addEventListener("click", () => {
1363    console.log("klik poza");
1364    if (activeItem) {
1365      hideDesc(activeItem);
1366      activeItem = null;
1367    }
1368  });
1369}
1370
1371let otreeTimeout16jb = setInterval(function () {
1372  const banners = document.querySelectorAll(".myBanner");
1373
1374  banners.forEach((banner) => {
1375    if (!banner.classList.contains("swiper-initialized")) {
1376      new Swiper(banner, {
1377        slidesPerView: 1,
1378        spaceBetween: 20,
1379        pagination: {
1380          el: banner.querySelector(".swiper-pagination"),
1381          clickable: true,
1382        },
1383      });
1384    }
1385  });
1386}, 1600);
1387
1388let otreeTimeout17jb = setInterval(function () {
1389  const cardItems = document.querySelectorAll(".card-link");
1390  const cards = document.querySelectorAll(".card-item");
1391
1392  if (cardItems.length > 0) {
1393    clearInterval(otreeTimeout17jb);
1394
1395    cardItems.forEach((item, index) => {
1396      item.addEventListener("mouseenter", function () {
1397        if (window.innerWidth >= 992) {
1398          this.classList.add("active");
1399
1400          if (this !== cardItems[0]) {
1401            cardItems[0].classList.remove("active");
1402          }
1403        }
1404      });
1405
1406      item.addEventListener("mouseleave", function () {
1407        if (window.innerWidth >= 992) {
1408          this.classList.remove("active");
1409
1410          cardItems[0].classList.add("active");
1411
1412          firstActive();
1413        }
1414      });
1415
1416      item.addEventListener("click", function (e) {
1417        if (this.classList.contains("active")) {
1418          this.classList.remove("active");
1419        } else {
1420          cardItems.forEach((i, idx) => {
1421            if (idx !== 0) {
1422              i.classList.remove("active");
1423            }
1424          });
1425          this.classList.add("active");
1426        }
1427      });
1428    });
1429
1430    function firstActive() {
1431      const isAnyOtherActive = Array.from(cardItems).some(
1432        (item, idx) => idx !== 0 && item.classList.contains("active")
1433      );
1434
1435      if (!isAnyOtherActive && !cardItems[0].classList.contains("active")) {
1436        cardItems[0].classList.add("active");
1437      }
1438    }
1439  }
1440}, 1600);
1441
1442let otreeTimeout18jb = setInterval(function () {
1443  document.querySelectorAll(".myOurline").forEach((container) => {
1444    if (!container.classList.contains("swiper-initialized")) {
1445      const swiper = new Swiper(container, {
1446        slidesPerView: 4,
1447        spaceBetween: 20,
1448        navigation: {
1449          nextEl: container.querySelector(".swiper-button-next"),
1450          prevEl: container.querySelector(".swiper-button-prev"),
1451        },
1452        breakpoints: {
1453          0: {
1454            slidesPerView: 2,
1455            grid: {
1456              rows: 2,
1457              fill: "row",
1458            },
1459          },
1460          992: {
1461            slidesPerView: 4,
1462            grid: {
1463              rows: 1,
1464              fill: "row",
1465            },
1466          },
1467        },
1468      });
1469
1470      container.querySelectorAll(".ourline__item").forEach((item) => {
1471        if (!item.dataset.hoverBound) {
1472          item.addEventListener("mouseenter", () => {
1473            const category = item.querySelector(".ourline__category");
1474            const desc = item.querySelector(".ourline__desc");
1475            if (category && desc) {
1476              category.style.opacity = "0";
1477              category.style.pointerEvents = "none";
1478              desc.style.opacity = "1";
1479              desc.style.pointerEvents = "auto";
1480              desc.style.zIndex = "3";
1481              category.style.zIndex = "1";
1482            }
1483          });
1484
1485          item.addEventListener("mouseleave", () => {
1486            const category = item.querySelector(".ourline__category");
1487            const desc = item.querySelector(".ourline__desc");
1488            if (category && desc) {
1489              category.style.opacity = "1";
1490              category.style.pointerEvents = "auto";
1491              desc.style.opacity = "0";
1492              desc.style.pointerEvents = "none";
1493              desc.style.zIndex = "1";
1494              category.style.zIndex = "3";
1495            }
1496          });
1497
1498          item.dataset.hoverBound = "true";
1499        }
1500      });
1501    }
1502  });
1503
1504  if (
1505    document.querySelectorAll(".myOurline:not(.swiper-initialized)").length ===
1506    0
1507  ) {
1508    clearInterval(otreeTimeout18jb);
1509  }
1510}, 500);
1511
1512let opened = false;
1513
1514let otreeTimeout19jb = setInterval(function () {
1515  function syncAccordionHeaders() {
1516    document.querySelectorAll(".accordion-item").forEach((item) => {
1517      const header = item.querySelector(".accordion-header");
1518      const collapse = item.querySelector(".accordion-collapse");
1519
1520      if (collapse && header) {
1521        if (collapse.classList.contains("show")) {
1522          header.classList.add("active-accordion");
1523        } else {
1524          header.classList.remove("active-accordion");
1525        }
1526      }
1527    });
1528  }
1529
1530  if (!opened && window.innerWidth >= 992) {
1531    document.querySelectorAll(".accordion-collapse").forEach((el) => {
1532      el.classList.add("show");
1533    });
1534    opened = true;
1535  }
1536
1537  document.querySelectorAll(".accordion-item").forEach((item) => {
1538    const header = item.querySelector(".accordion-header");
1539    const collapse = item.querySelector(".accordion-collapse");
1540
1541    if (header && collapse && !header.dataset.listenerAdded) {
1542      header.dataset.listenerAdded = true;
1543      header.addEventListener("click", () => {
1544        collapse.classList.toggle("show");
1545        header.classList.toggle("active-accordion");
1546      });
1547    }
1548  });
1549
1550  syncAccordionHeaders();
1551}, 1600);
1552
1553function waitForElement(selector, callback, interval = 1000) {
1554  const intervalId = setInterval(() => {
1555    const elements = document.querySelectorAll(selector);
1556    if (elements) {
1557      clearInterval(intervalId);
1558      callback(elements);
1559    }
1560  }, interval);
1561}
1562
1563let otreeTimeout21jb = setInterval(function () {
1564  // Upewniamy się, że język jest ustawiony na "pl" domyślnie przy załadowaniu strony
1565  document.addEventListener("DOMContentLoaded", function () {
1566    const lang = document.getElementById("language");
1567    if (!lang.value) {
1568      lang.value = "pl"; // Jeśli wartość języka nie została ustawiona, domyślnie ustaw na "pl"
1569    }
1570  });
1571
1572  // Sprawdzamy wartość języka co 1600 ms
1573  const lang = document.getElementById("language").value;
1574
1575  if (lang === "en") {
1576    // Jeśli użytkownik jeszcze nie był przekierowany, to przekieruj
1577    if (!sessionStorage.getItem("redirected")) {
1578      window.location.href = "https://arkanacosmetics.com";
1579      sessionStorage.setItem("redirected", "true"); // Zapisujemy flagę, żeby nie przekierowywać ponownie
1580    }
1581  } else {
1582    // Jeśli język nie jest "en", to usuwamy flagę "redirected" z sessionStorage
1583    sessionStorage.removeItem("redirected");
1584  }
1585}, 1600);
1586
1587// let playBtnInterval = setInterval(function () {
1588//   const playBtn = document.getElementById("playBtn");
1589//   const player = document.getElementById("player");
1590
1591//   if (playBtn && player && !playBtn.dataset.listenerAdded) {
1592//     playBtn.dataset.listenerAdded = true;
1593
1594//     playBtn.addEventListener("click", () => {
1595//       playBtn.style.display = "none";
1596
1597//       player.contentWindow.postMessage(
1598//         '{"event":"command","func":"playVideo","args":""}',
1599//         "*"
1600//       );
1601
1602//       clearInterval(playBtnInterval);
1603//     });
1604//   }
1605// }, 500);
1606let playBtnInterval = setInterval(function () {
1607  const playBtn = document.getElementById("playBtn");
1608  const player = document.getElementById("player");
1609
1610  if (playBtn && player && !playBtn.dataset.listenerAdded) {
1611    playBtn.dataset.listenerAdded = true;
1612
1613    playBtn.addEventListener("click", () => {
1614      playBtn.style.display = "none";
1615
1616      player.contentWindow.postMessage(
1617        JSON.stringify({
1618          event: "command",
1619          func: "playVideo",
1620          args: [],
1621        }),
1622        "https://www.youtube.com"
1623      );
1624
1625      clearInterval(playBtnInterval);
1626    });
1627  }
1628}, 500);
1629
1630const initHomeSwipers = () => {
1631  let homeSwipersInterval = setInterval(function () {
1632    const homeSwipers = document.querySelectorAll(
1633      ".product-swiper--tight .swiper-container"
1634    );
1635    if (homeSwipers.length) {
1636      clearInterval(homeSwipersInterval);
1637      homeSwipers.forEach((swiperContainer) => {
1638        if (swiperContainer.swiper) {
1639          swiperContainer.swiper.destroy(true, true);
1640        }
1641
1642        swiperContainer.insertAdjacentHTML(
1643          "beforeend",
1644          `<div class="swiper-scrollbar"></div>`
1645        );
1646
1647        swiperContainer.insertAdjacentHTML(
1648          "afterend",
1649          `
1650          <div class="btn-pr swiper-button-prev--news"></div>
1651          <div class="btn-nx swiper-button-next--news"></div>
1652        `
1653        );
1654
1655        const swiperScrollbar =
1656          swiperContainer.querySelector(".swiper-scrollbar");
1657        const swiperBtnPrev = swiperContainer.parentNode.querySelector(
1658          ".swiper-button-prev--news"
1659        );
1660        const swiperBtnNext = swiperContainer.parentNode.querySelector(
1661          ".swiper-button-next--news"
1662        );
1663
1664        new Swiper(swiperContainer, {
1665          observer: true,
1666          observeParents: true,
1667          loop: false,
1668          spaceBetween: 8,
1669          slidesPerView: 1.2,
1670          scrollbar: {
1671            el: swiperScrollbar,
1672            draggable: true,
1673          },
1674          navigation: {
1675            nextEl: swiperBtnNext,
1676            prevEl: swiperBtnPrev,
1677          },
1678          breakpoints: {
1679            560: {
1680              spaceBetween: 8,
1681              slidesPerView: 2.5,
1682              centeredSlides: false,
1683            },
1684            800: {
1685              slidesPerView: 2,
1686            },
1687            1000: {
1688              spaceBetween: 12,
1689              slidesPerView: 2.5,
1690            },
1691            1200: {
1692              slidesPerView: 3,
1693            },
1694            1300: {
1695              spaceBetween: 12,
1696              slidesPerView: 3.2,
1697            },
1698            1400: {
1699              spaceBetween: 16,
1700              slidesPerView: 3.6,
1701            },
1702            1600: {
1703              spaceBetween: 16,
1704              slidesPerView: 3.6,
1705            },
1706          },
1707        });
1708      });
1709    }
1710  }, 1000);
1711};
1712
1713let activeMenuPanel = setInterval(function () {
1714    const buttons = document.querySelectorAll(".menu-category__sub-link");
1715    const wrappers = document.querySelectorAll(
1716        ".menu-category__sub-contents--wrapper"
1717    );
1718
1719    if (!buttons.length || !wrappers.length) return;
1720
1721    if (buttons[0].dataset.init === "true") return;
1722
1723    function showWrapper(index) {
1724        wrappers.forEach((w) => w.classList.remove("active"));
1725        buttons.forEach((b) => b.classList.remove("btn-active"));
1726
1727        wrappers[index].classList.add("active");
1728        buttons[index].classList.add("btn-active");
1729    }
1730
1731    buttons.forEach((btn, index) => {
1732        btn.addEventListener("click", () => {
1733            showWrapper(index);
1734        });
1735    });
1736
1737    showWrapper(1);
1738
1739    buttons.forEach((b) => (b.dataset.init = "true"));
1740}, 1000);
1741
1742/* =====================================================================
1743   ARKANA — Landing "Rozwijaj gabinet z ARKANA"
1744   Wklej do panelu: Skrypt
1745   Vanilla JS, bez zależności. Bezpieczny dla Vue2 (działa po wyrenderowaniu).
1746   Obsługuje: walidację obu formularzy, format NIP (10 cyfr), e-mail,
1747   telefon, zgodę + płynne przewijanie do sekcji kontaktu.
1748   ===================================================================== */
1749(function () {
1750    'use strict';
1751
1752    // ---- KONFIGURACJA -------------------------------------------------
1753    // Podaj adres endpointu, który przyjmie zgłoszenie (POST JSON).
1754    // Zostaw pusty ('') aby tylko zwalidować i pokazać komunikat sukcesu
1755    // (np. do czasu podpięcia backendu / integracji ONe).
1756    var ENDPOINT = '';
1757
1758    function init() {
1759        var root = document.getElementById('ark-lp');
1760        if (!root || root.dataset.arkInit === '1') return;
1761        root.dataset.arkInit = '1';
1762
1763        // Płynne przewijanie dla linków wewnętrznych (#ark-contact itd.)
1764        root.addEventListener('click', function (e) {
1765            var a = e.target.closest('a[href^="#"]');
1766            if (!a) return;
1767            var id = a.getAttribute('href').slice(1);
1768            if (!id) return;
1769            var target = document.getElementById(id);
1770            if (target) {
1771                e.preventDefault();
1772                target.scrollIntoView({ behavior: 'smooth', block: 'start' });
1773            }
1774        });
1775
1776        var forms = root.querySelectorAll('[data-ark-form]');
1777        Array.prototype.forEach.call(forms, bindForm);
1778    }
1779
1780    function bindForm(form) {
1781        form.addEventListener('submit', function (e) {
1782            e.preventDefault();
1783            if (form.dataset.arkBusy === '1') return;
1784
1785            clearErrors(form);
1786            var errors = validate(form);
1787            var msg = form.querySelector('[data-ark-msg]');
1788
1789            if (errors.length) {
1790                errors.forEach(function (field) {
1791                    var wrap = field.closest('.ark-field');
1792                    if (wrap) wrap.classList.add('ark-field--error');
1793                });
1794                setMsg(msg, 'Uzupełnij poprawnie zaznaczone pola.', 'err');
1795                errors[0].focus();
1796                return;
1797            }
1798
1799            submit(form, msg);
1800        });
1801
1802        // Kasuj błąd przy edycji pola
1803        form.addEventListener('input', function (e) {
1804            var wrap = e.target.closest('.ark-field');
1805            if (wrap) wrap.classList.remove('ark-field--error');
1806        });
1807    }
1808
1809    function validate(form) {
1810        var bad = [];
1811        var name = form.querySelector('[name="name"]');
1812        var email = form.querySelector('[name="email"]');
1813        var phone = form.querySelector('[name="phone"]');
1814        var nip = form.querySelector('[name="nip"]');
1815        var consent = form.querySelector('[name="consent"]');
1816
1817        if (name && !name.value.trim()) bad.push(name);
1818        if (email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email.value.trim())) bad.push(email);
1819        if (phone && phone.value.replace(/[^\d]/g, '').length < 7) bad.push(phone);
1820        if (nip && !/^\d{10}$/.test(nip.value.trim())) bad.push(nip);
1821        if (consent && !consent.checked) {
1822            bad.push(consent);
1823            var cwrap = consent.closest('.ark-consent');
1824            if (cwrap) cwrap.style.color = '#d64545';
1825        }
1826        return bad;
1827    }
1828
1829    function submit(form, msg) {
1830        var data = {
1831            name: val(form, 'name'),
1832            email: val(form, 'email'),
1833            phone: val(form, 'phone'),
1834            nip: val(form, 'nip'),
1835            consent: true,
1836            source: 'landing-arkana-wspolpraca'
1837        };
1838
1839        if (!ENDPOINT) {
1840            // Tryb bez backendu: potwierdzenie po stronie klienta.
1841            finishOk(form, msg);
1842            return;
1843        }
1844
1845        form.dataset.arkBusy = '1';
1846        var btn = form.querySelector('button[type="submit"]');
1847        if (btn) btn.disabled = true;
1848
1849        fetch(ENDPOINT, {
1850            method: 'POST',
1851            headers: { 'Content-Type': 'application/json' },
1852            body: JSON.stringify(data)
1853        })
1854            .then(function (r) { if (!r.ok) throw new Error('HTTP ' + r.status); return r; })
1855            .then(function () { finishOk(form, msg); })
1856            .catch(function () {
1857                setMsg(msg, 'Wystąpił błąd wysyłki. Spróbuj ponownie lub zadzwoń do nas.', 'err');
1858            })
1859            .then(function () {
1860                form.dataset.arkBusy = '0';
1861                if (btn) btn.disabled = false;
1862            });
1863    }
1864
1865    function finishOk(form, msg) {
1866        form.reset();
1867        setMsg(msg, 'Dziękujemy! Zgłoszenie zostało wysłane — skontaktujemy się z Tobą wkrótce.', 'ok');
1868        var cwrap = form.querySelector('.ark-consent');
1869        if (cwrap) cwrap.style.color = '';
1870    }
1871
1872    // ---- helpers ------------------------------------------------------
1873    function val(form, name) {
1874        var el = form.querySelector('[name="' + name + '"]');
1875        return el ? el.value.trim() : '';
1876    }
1877    function setMsg(el, text, kind) {
1878        if (!el) return;
1879        el.textContent = text;
1880        el.classList.remove('is-ok', 'is-err');
1881        el.classList.add(kind === 'ok' ? 'is-ok' : 'is-err');
1882    }
1883    function clearErrors(form) {
1884        Array.prototype.forEach.call(form.querySelectorAll('.ark-field--error'), function (n) {
1885            n.classList.remove('ark-field--error');
1886        });
1887        var cwrap = form.querySelector('.ark-consent');
1888        if (cwrap) cwrap.style.color = '';
1889        var msg = form.querySelector('[data-ark-msg]');
1890        if (msg) { msg.textContent = ''; msg.classList.remove('is-ok', 'is-err'); }
1891    }
1892
1893    if (document.readyState === 'loading') {
1894        document.addEventListener('DOMContentLoaded', init);
1895    } else {
1896        init();
1897    }
1898})();
1899

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.