PageSourceSearch

https://www.fullstackexperts.eu/wp-content/plugins/ecp/components/…/slider-card.js?ver=1.0.0.1787921357

js fullstackexperts.eu collected 2026-09-24 11:43:55 UTC 4,970 bytes, 140 lines download raw bytes

1jQuery(function ($) {
2  $('.ecp__container__sc').each(function () {
3    const slider = $(this);
4    const id = slider.attr('id');
5    //const config = JSON.parse(slider.attr('config') || '{}');
6	let config = JSON.parse(slider.attr('config') || '{}'); // Używamy let zamiast const, by móc modyfikować
7    const nextEl = slider.find('.ecp__actions__btn.--right')[0];
8    const prevEl = slider.find('.ecp__actions__btn.--left')[0];
9    const containerActions = slider.find('.ecp__container__actions');
10    const navigationMarkers = slider.find('.swiper-slide:not(.--empty) [navigation]');
11    navigationMarkers.css('width', `${containerActions.outerWidth()}px`);
12    navigationMarkers.css('height', `${containerActions.outerHeight()}px`);
13	
14	// --- KROK DEBUGOWANIA ---
15    // Poniższa linia wyświetli w konsoli deweloperskiej przeglądarki (F12),
16    // jakie ustawienia slider otrzymał z PHP.
17    // console.log('Konfiguracja Slidera:', config);
18	
19	console.log('Oryginalna Konfiguracja z PHP:', config);
20
21    // ====================================================================
22    //  START: ROZWIĄZANIE TYMCZASOWE - HARDCODING USTAWIEŃ
23    //  Ten blok kodu nadpisuje ustawienia z Elementora
24    // ====================================================================
25    config.autoplay = true;         // Wymuś włączenie autoplay
26    config.autoplayDelay = 3000;    // Ustaw opóźnienie na 3000ms (3 sekundy)
27    config.pauseOnHover = true;     // Włącz pauzę po najechaniu myszką
28    // ====================================================================
29    //  KONIEC: ROZWIĄZANIE TYMCZASOWE
30    // ====================================================================
31
32    console.log('Zmodyfikowana Konfiguracja (na sztywno):', config);
33
34    const setAutomaticHeight = () => {
35      const slides = slider.find('.swiper-slide:not(.--empty)');
36      const inners = slides.find('.ecp__slide__card__inner');
37      const wrapper = slider.find('.swiper-wrapper');
38      const swiperEl = slider.find('.ecp__container.swiper');
39
40      // Najpierw wyrównaj jasne karty z treścią (to one wizualnie „skaczą”)
41      inners.css('height', 'auto');
42      slides.css('height', 'auto');
43      wrapper.css('height', 'auto');
44      swiperEl.css('height', 'auto');
45
46      let maxInnerHeight = 0;
47      inners.each((_, el) => {
48        maxInnerHeight = Math.max(maxInnerHeight, $(el).outerHeight());
49      });
50
51      if (maxInnerHeight > 0) {
52        inners.css('height', `${maxInnerHeight}px`);
53      }
54
55      let maxSlideHeight = 0;
56      slides.each((_, slide) => {
57        maxSlideHeight = Math.max(maxSlideHeight, $(slide).outerHeight());
58      });
59
60      if (maxSlideHeight > 0) {
61        slides.css('height', `${maxSlideHeight}px`);
62        wrapper.css('height', `${maxSlideHeight}px`);
63        swiperEl.css('height', `${maxSlideHeight}px`);
64      }
65
66      setTimeout(setNavigation, 50);
67    };
68
69    const setNavigation = () => {
70      if (config?.navigationCard !== 'inner_card') return
71
72      const swiperEl = slider.find('.ecp__container.swiper')
73      const marker = slider.find('.swiper-slide:not(.--empty) [navigation]').first()
74      if (!swiperEl.length || !marker.length) return
75
76      slider.find('.swiper-slide:not(.--empty) [navigation]').css({
77        width: containerActions.outerWidth(),
78        height: containerActions.outerHeight(),
79        flexShrink: 0
80      })
81
82      const swiperOffset = swiperEl.offset()
83      const markerOffset = marker.offset()
84      if (!swiperOffset || !markerOffset) return
85
86      containerActions.css({
87        position: 'absolute',
88        top: `${markerOffset.top - swiperOffset.top}
88px`,
89        left: `${markerOffset.left - swiperOffset.left}px`
90      })
91    };
92
93    setNavigation();
94    // const conf = {
95    //   slidesPerView: 1,
96    //   loop: config?.loop || true,
97    //   navigation: {
98    //     nextEl,
99    //     prevEl,
100    //   },
101    //   effect: config?.slideEffect || 'slide',
102    //   on: {
103    //     init: setAutomaticHeight
104    //   }
105    // }
106
107    const conf = {
108      slidesPerView: 1,
109      loop: config?.loop || true,
110      navigation: {
111        nextEl,
112        prevEl,
113      },
114      effect: config?.slideEffect || 'slide',
115      on: {
116        init() {
117          // Po init Swiper (zwłaszcza loop/fade) DOM bywa jeszcze niestabilny
118          setAutomaticHeight();
119          setTimeout(setAutomaticHeight, 50);
120          setTimeout(setAutomaticHeight, 250);
121        },
122        imagesReady: setAutomaticHeight,
123        resize: setAutomaticHeight,
124      }
125    };
126    
127    // Dodanie autoplay jeśli jest włączony
128    if (config?.autoplay) {
129      conf.autoplay = {
130        delay: config?.autoplayDelay || 2000,
131        disableOnInteraction: false,
132        pauseOnMouseEnter: config?.pauseOnHover !== false
133      };
134    }
135    new Swiper(`#${id} .ecp__container`, conf);
136    $(window).on('resize', setAutomaticHeight);
137    $(window).on('load', setAutomaticHeight);
138
139  });
140});

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.