PageSourceSearch

https://limefitness.center/local/templates/limefitness.center_2026/js/index.js?176266144511681

js limefitness.center collected 2026-10-06 06:24:55 UTC 11,681 bytes, 324 lines download raw bytes

1$(document).ready(function () {
2
3    // Часы
4    function updateClock() {
5        const now = new Date();
6        const hh = String(now.getHours()).padStart(2, '0');
7        const mm = String(now.getMinutes()).padStart(2, '0');
8        const hoursElem = document.getElementById('hours');
9        const minutesElem = document.getElementById('minutes');
10        if (hoursElem) hoursElem.textContent = hh;
11        if (minutesElem) minutesElem.textContent = mm;
12    }
13    setInterval(updateClock, 1000);
14    updateClock();
15
16    // Попапы (открытие/закрытие)
17    document.addEventListener('click', e => {
18        const opener = e.target.closest('[data-popup-open]');
19        if (opener) {
20            e.preventDefault();
21            document.querySelectorAll('.popup.show').forEach(popup => {
22                popup.classList.remove('show');
23            });
24            const popupId = opener.dataset.popupOpen;
25            const popup = document.getElementById(popupId);
26
27            if (popup && opener.dataset.title) {
28                var titleElem = popup.querySelector('.inline-form__title');
29                if (titleElem) {
30                    titleElem.textContent = opener.dataset.title;
31                }
32            }
33
34            if (popup) popup.classList.add('show');
35            return;
36        }
37        const closer = e.target.closest('[data-popup-close]');
38        if (closer) {
39            e.preventDefault();
40            const popup = closer.closest('.popup');
41            if (popup) popup.classList.remove('show');
42            return;
43        }
44        document.querySelectorAll('.popup.show').forEach(popup => {
45            if (!popup.contains(e.target)) {
46                popup.classList.remove('show');
47            }
48        });
49    });
50
51    const popupMenu = document.getElementById('popupDropdown');
52    if (!popupMenu) return;
53
54    function isMobile() {
55        return window.innerWidth < 768; // можно изменить порог
56    }
57
58    popupMenu.addEventListener('click', function (e) {
59        const link = e.target.closest('.popup-menu a[href^="#"]');
60        if (link && isMobile()) {
61            popupMenu.classList.remove('show');
62
63            const hash = link.getAttribute('href');
64            const anchor = document.getElementById(hash.replace('#', ''));
65            if (anchor) {
66                setTimeout(() => {
67                    const offset = 0;
68                    const rect = anchor.getBoundingClientRect();
69                    const top = rect.top + window.pageYOffset + offset;
70
71                    window.scrollTo({
72                        top: top,
73                        behavior: 'smooth'
74                    });
75                }, 150);
76            }
77
78            e.preventDefault();
79        }
80    });
81
82    // Swiper для .area__list и .benefit
83    const areaListElem = document.querySelector('.area__list.swiper');
84    const benefitElem = document.querySelector('.benefit.swiper');
85    if (areaListElem || benefitElem) {
86        let areaSwiper = null;
87        let benefitSwiper = null;
88        const initAreaSwiper = () => {
89            if (!areaSwiper && areaListElem) {
90                areaSwiper = new Swiper('.area__list.swiper', {
91                    slidesPerView: 1.5,
92                    spaceBetween: 10,
93                    watchOverflow: true,
94                });
95            }
96        };
97        const destroyAreaSwiper = () => {
98            if (areaSwiper) {
99                areaSwiper.destroy(true, true);
100                areaSwiper = null;
101            }
102        };
103        const initBenefitSwiper = () => {
104            if (!benefitSwiper && benefitElem) {
105                benefitSwiper = new Swiper('.benefit.swiper', {
106                    slidesPerView: 1,
107                    spaceBetween: 10,
108                    watchOverflow: true,
109                });
110            }
111        };
112        const destroyBenefitSwiper = () => {
113            if (benefitSwiper) {
114                benefitSwiper.destroy(true, true);
115                benefitSwiper = null;
116            }
117        };
118        const mobileQuery = window.matchMedia('(max-width: 767px)');
119        const checkBreakpoint = () => {
120            if (mobileQuery.matches) {
121                initAreaSwiper();
122                initBenefitSwiper();
123            } else {
124                destroyAreaSwiper();
125                destroyBenefitSwiper();
126            }
127        };
128        checkBreakpoint();
129        mobileQuery.addEventListener('change', checkBreakpoint);
130    }
131
132    // Фотогалерея
133    const galleryListElem = document.querySelector('.main-gallery__list');
134    if (galleryListElem) {
135        const gallerySwiperElem = document.querySelector('.main-gallery .swiper');
136        if (gallerySwiperElem) {
137            new Swiper(gallerySwiperElem, {
138                slidesPerView: 'auto',
139                freeMode: true,
140                autoplay: true,
141                loop: false,
142                speed: 20000,
143                pagination: {
144                    type: 'progressbar',
145                    el: '.main-gallery .slider-progressbar'
146                }
147            });
148        }
149        let photogallerySlide = $('.main-gallery__slide').packery({
150            itemSelector: '.main-gallery__item',
151            gutter: 20,
152        });
153        function layoutPackery() {
154            photogallerySlide.packery();
155        }
156        layoutPackery();
157        $(window).resize(function () {
158            layoutPackery();
159        });
160    }
161
162    // Навигация about-scheme
163    const navLinks = document.querySelectorAll('.about-scheme__nav a');
164    const items = document.querySelectorAll('.about-scheme__item');
165    const images = document.querySelectorAll('.about-scheme__floor a');
166    if (navLinks.length && items.length && images.length) {
167        navLinks.forEach(link => {
168            link.addEventListener('click', function (e) {
169                e.preventDefault();
170                navLinks.forEach(l => l.classList.remove('active'));
171                items.forEach(item => item.classList.remove('active'));
172                images.forEach(img => img.classList.remove('active'));
173                this.classList.add('active');
174                const id = this.getAttribute('href').replace('#', '');
175                const targetItem = document.querySelector(`.about-scheme__item[data-id="${id}"]`);
176                const targetImgLink = document.querySelector(`.about-scheme__floor a[data-id="${id}"]`);
177                if (targetItem) targetItem.classList.add('active');
178                if (targetImgLink) {
179                    targetImgLink.classList.add('active');
180                    if (window.innerWidth <= 768) {
181                        setTimeout(() => {
182                            targetImgLink.scrollIntoView({ behavior: 'smooth', block: 'center' });
183                        }, 50);
184                    }
185                }
186            });
187        });
188    }
189
190    // side-panel__logo show on scroll
191    const sidePanelLogo = document.querySelector('.side-panel__logo');
192    if (sidePanelLogo) {
193        window.addEventListener('scroll', function () {
194            if (window.scrollY >= 100) {
195                sidePanelLogo.classList.add('show');
196            } else {
197                sidePanelLogo.classList.remove('show');
198            }
199        });
200    }
201
202    // Кнопка наверх
203    const upBtn = document.querySelector('.up.js-up');
204    if (upBtn) {
205        upBtn.addEventListener('click', function () {
206            window.scrollTo({
207                top: 0,
208                behavior: 'smooth'
209            });
210        });
211    }
212
213    // Анимация появления .benefit__item только на десктопе
214    if (
215        window.gsap &&
216        window.ScrollTrigger &&
217        document.querySelectorAll('.benefit__item').length &&
218        window.matchMedia('(min-width: 768px)').matches
219    ) {
220        gsap.registerPlugin(ScrollTrigger);
221
222        document.querySelectorAll('.benefit__item').forEach(function(item, idx) {
223            gsap.fromTo(item,
224                { opacity: 0, y: 100 },
225                {
226                    opacity: 1,
227                    y: 0,
228                    duration: 1,
229                    delay: idx * 0.15,
230                    ease: "power2.out",
231                    scrollTrigger: {
232                        trigger: item,
233                        start: "top 80%",
234                        toggleActions: "play none none none"
235                    }
236                }
237            );
238        });
239    }
240
241
242    $("input[type='tel']").inputmask({
243        mask: '+7 (*{1}99) 999-99-99',
244        placeholder: "+7 (___) ___-__-__",
245        androidHack: "rtfm",
246        definitions: {
247            '*': {
248                validator: "[0-6,9]"
249            }
250        }
251    });
252
253    $(document).on('click', '.js-ajax-popup', function (e) {
254        e.preventDefault();
255
256        let href = $(this).attr('href');
257        let classPopup = $(this).attr('data-class');
258        let $popupContent = $('#popupContent');
259        let $popupContentWrap = $popupContent.find('.popup-content__wrap');
260
261        if($popupContent.length) {
262
263            $.ajax({
264                url: href,
265                type: 'GET',
266                success: function (data) {
267                    $popupContentWrap.html(data);
268
269                    if (!$('.fancybox-is-open').length) {
270
271                        Fancybox.show([{
272                            src: '#popupContent',
273                            type: "inline",
274                        }], {
275                            closeButton: false,
276                            mainClass: 'open-popup-content',
277                            on: {
278                                reveal: function() {
279                                    $popupContent.addClass(classPopup);
280                                },
281                                destroy: function() {
282                                    $popupContent.removeClass(classPopup);
283                                }
284                            }
285                        });
286
287                        $(document).on('click', '.js-close-fancy', function (e) {
288                            Fancybox.close();
289                            return false;
290                        });
291
292                        if($('.js-order').length) {
293
294                            $('.js-order').click(function (e) {
295                                e.preventDefault();
296
297                                Fancybox.close();
298
299                                Fancybox.show(
300                                    [
301                                        {
302                                            src: 'popupOrder',
303                                            type: "inline",
304                                        }
305                                    ],
306                                    {
307                                        mainClass: 'open-order',
308                                        closeButton: false
309                                    });
310                            });
311                        }
312                    }
313                },
314                error: function () {
315                    alert('Не удалось загрузить контент. Попробуйте позже.');
316                }
317            });
318
319            return false;
320        }
321    });
322
323
324});

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.