PageSourceSearch

https://granot.co.il/wp-content/themes/granot/js/main.js?ver=1.68347

js granot.co.il collected 2026-10-02 19:48:48 UTC 29,320 bytes, 868 lines download raw bytes

1let sliderCheck = $('html').attr('dir') == 'rtl' ? true : false;
2
3$(document).ready(function () {
4    const heightPage = window.innerHeight;
5    if ($(window).width() <= 991) {
6        $('.hero-main__img').css('min-height', heightPage);
7    }
8
9    $(window).scroll(function () {
10        var windowBottom = $(this).scrollTop() + $(this).innerHeight();
11
12        $(".footer").each(function () {
13            var objectBottom = $(this).offset().top + $(this).outerHeight() / 2;
14
15            if (objectBottom < windowBottom) {
16                $('.scroll-top').addClass("active");
17            } else {
18                $('.scroll-top').removeClass("active");
19            }
20        });
21    }).scroll();
22
23    $('.scroll-top').on('click', function () {
24        $("html, body").animate({scrollTop: 0}, "slow");
25    })
26});
27let menuItemsExp = [...document.querySelectorAll('.menu-item-has-children > a')];
28
29function ariaMenuItems() {
30    if (menuItemsExp.length) {
31        menuItemsExp.forEach((it) => {
32            it.setAttribute('aria-expanded', 'false');
33
34            it.closest('li').setAttribute('aria-label', `${it.innerHTML} , תפריט משנה `);
35
36            [...it.closest('li').querySelectorAll('ul.sub-menu li a')].forEach((btn) => {
37                btn.setAttribute('aria-label', btn.innerHTML);
38                btn.classList.add('sub-menu-link');
39
40            })
41        })
42    }
43}
44
45if (window.innerWidth > 991) {
46    document.addEventListener('focusin', function () {
47        console.log(document.activeElement);
48        if (document.activeElement.closest('.header')) {
49            if (document.querySelector('.header-slide').classList.contains('active')) {
50                document.querySelector('.header-slide').click();
51            }
52            
53            if (document.activeElement.closest('.menu-item-has-children')) {
54                document.activeElement.closest('.menu-item-has-children').querySelector('a').setAttribute('aria-expanded', 'true');
55            } else {
56                document.querySelector('.menu-item-has-children').querySelector('a').setAttribute('aria-expanded', 'false'); 
57            }
58        } else {
59            if (!document.querySelector('.header-slide').classList.contains('active')) {
60                document.querySelector('.header-slide').click();
61            }
62            document.querySelector('.menu-item-has-children').querySelector('a').setAttribute('aria-expanded', 'false');
63
64
65        }
66    }, true);
67}
68if (window.innerWidth < 992) {
69    document.addEventListener('focusin', function () {
70        console.log(document.activeElement);
71        if (document.activeElement.closest('.header')) {
72            if (!document.querySelector('.header-slide').classList.contains('active')) {
73                document.querySelector('.header-slide').click();
74            }
75
76            if (document.activeElement.closest('.menu-item-has-children')) {
77                document.activeElement.closest('.menu-item-has-children').querySelector('a').setAttribute('aria-expanded', 'true');
78                if (!document.querySelector('.menu-item-has-children').classList.contains('active')) {
79                    document.activeElement.closest('.menu-item-has-children').querySelector('.show-menu').click();
80                }
81            } else {
82                document.querySelector('.menu-item-has-children').querySelector('a').setAttribute('aria-expanded', 'false');
83                if (document.querySelector('.menu-item-has-children').classList.contains('active')) {
84                    document.querySelector('.menu-item-has-children').querySelector('.show-menu').click();
85                }
86            }
87        } else {
88            if (document.querySelector('.header-slide').classList.contains('active')) {
89                document.querySelector('.header-slide').click();
90            }
91            document.querySelector('.menu-item-has-children').querySelector('a').setAttribute('aria-expanded', 'false');
92            if (document.querySelector('.menu-item-has-children').classList.contains('active')) {
93                document.activeElement.closest('.menu-item-has-children').querySelector('.show-menu').click();
94            }
95
96
97        }
98    }, true);
99}
100ariaMenuItems();
101$(document).keyup(function (e) {
102    if (e.key === "Escape") {
103        if (document.activeElement.classList.contains('sub-menu-link')) {
104            document.activeElement.closest('.menu-item-has-children').querySelector('a').setAttribute('aria-expanded', 'false');
105            document.activeElement.closest('.menu-item-has-children').nextElementSibling.querySelector('a').focus();
106        }
107    }
108});
109$(document).ready(function () {
110
111    //slide header
112
113    $('.header .nav ul > li > a').each(function () {
114        $(this).prepend(`<span class="nav-link-circle"></span>`)
115    });
116
117    if ($(window).width() > 991) {
118        $('.header-slide').on('click', function () {
119            $(this).toggleClass('active');
120            $('.header').toggleClass('slide');
121            $('.header').toggleClass('open');
122            if ($(this).attr('aria-expanded') === 'true') {
123                $(this).attr('aria-expanded', 'false');
124            } else {
125                $(this).attr('aria-expanded', 'true');
126            }
127        })
128
129        $(window).on('scroll', function () {
130            if ($(window).scrollTop() >= 100 && !$('.header').hasClass('open')) {
131                $('.header-slide').addClass('active');
132                $('.header').addClass('slide');
133                $('.header-slide').attr('aria-expanded', 'false');
134            }
135
136            if ($(window).scrollTop() <= 100 && !$('.header').hasClass('open')) {
137                $('.header').removeClass('open');
138                $('.header').removeClass('slide');
139                $('.header-slide').removeClass('active');
140                $('.header-slide').attr('aria-expanded', 'true');
141            }
142        })
143    }
144
145    if ($(window).width() < 991) {
146        $(".header li").removeClass('active');
147
148        $(".header").prepend('<div class="mobile-menu"></div>');
149        $(".header .nav").prepend($('.header__lang'));
150        $('.mobile-menu').prepend($('.header .nav'));
151
152        $('.header-slide').on('click', function () {
153            $(this).toggleClass('active');
154            $('body').toggleClass('active');
155            $('.header').toggleClass('active');
156            $('.header .mobile-menu').stop().slideToggle('400', 'linear');
157        });
158
159        $('.menu-item-has-children > a').after('<div class="show-menu"></div>');
160        $('.menu-item-has-children').on('blur', () => {
161            $(this).classList.add('focused');
162        })
163        $('.menu-item-has-children .show-menu').on('click', function (e) {
164            e.preventDefault();
165            e.stopPropagation();
166            $(this).closest('.menu-item-has-children').toggleClass('active');
167            $(this).closest('.menu-item-has-children').find('.sub-menu').stop().slideToggle('400', 'linear');
168            $(this).closest('.menu-item-has-children').find('.sub-menu').toggleClass('active');
169        })
170    }
171    if ($(window).width() < 991) {
172        $('.footer__title').on('click', function () {
173            $(this).toggleClass('active');
174            $(this).next('.footer__list').stop().slideToggle('300', 'linear');
175            $(this).next('.footer__list').toggleClass('show');
176        })
177
178        $('.footer__aside').append($('.footer__social'));
179    }
180
181    document.querySelector('body').style.setProperty('--heightScreen', `${window.innerHeight}px`);
182
183
184    if ($('.activities-slider').length) {
185        $('.activities-slider').slick({
186            slidesToShow: 1,
187            slidesToScroll: 1,
188            autoplay: true,
189            autoplaySpeed: 2000,
190            rtl: sliderCheck,
191            cssEase: 'linear',
192            swipeToSlide: true,
193            arrows: false,
194            pauseOnHover: false,
195            infinity: true
196        }).on('beforeChange', function (event, slick, currentSlide, nextSlide) {
197            $('.activities-slider-dots li').removeClass('active');
198            $('.activities-slider-dots li').eq(nextSlide).addClass('active');
199        })
200        if ($(window).width() > 991) {
201            $('.activities-slider-dots li').hover(
202                function () {
203                    $('.activities-slider').slick('pause');
204                    $('.activities-slider').slick('slickGoTo', $(this).index());
205                }, function () {
206                    $('.activities-slider').slick('play')
207                }
208            );
209        }
210    }
211
212    //
213    if ($('.img-info').length) {
214        $('.img-info .item-btn').on('click', function () {
215            $(this).parents('.item').toggleClass('active');
216            $(this).next('.item-info').stop().slideToggle();
217        })
218        $('.img-info .item-img').on('click', function () {
219            $(this).parents('.item').toggleClass('active');
220            $(this).parents('.item').find('.item-info').stop().slideToggle();
221        });
222
223        let imgBtnInfo = [...document.querySelectorAll('.img-info .item-btn')];
224
225        imgBtnInfo.forEach((btn) => {
226            btn.addEventListener('click', () => {
227                if (btn.closest('.item').classList.contains('active')) {
228                    btn.closest('.item').setAttribute('aria-expanded', 'true');
229                    btn.closest('.item').querySelector('.item-info').setAttribute('aria-hidden', 'false');
230                } else {
231                    btn.closest('.item').setAttribute('aria-expanded', 'false');
232                    btn.closest('.item').querySelector('.item-info').setAttribute('aria-hidden', 'true');
233                }
234
235            })
236
237            $(document).keyup(function (e) {
238                if (e.key === "Enter") {
239                    if (document.activeElement.classList.contains('item-btn')) {
240                        console.log('aga');
241                        document.activeElement.click()
242
243                    }
244                }
245            });
246
247        })
248    }
249
250    if ($('.public').length && $(window).width() < 991) {
251        $('.public .item-title').on('click', function () {
252            $(this).parents('.item').toggleClass('active');
253            $(this).next('.item-text').stop().slideToggle();
254        })
255    }
256
257    //tab
258
259    $(".tab__list li").click(function () {
260        $(".tab__list li button").removeClass("active").eq($(this).index()).addClass("active");
261        $(".tab-content").hide().eq($(this).index()).fadeIn("slow")
262    }).eq(0).addClass("active");
263
264    $(".tab__list .simplebar-content > button").click(function () {
265        $(".tab__list .simplebar-content > button").removeClass("active").eq($(this).index()).addClass("active");
266        $(".tab-content").hide().eq($(this).index()).fadeIn("slow")
267    }).eq(0).addClass("active");
268    // $(".accordion .item .show").on('click', function () {
269    //   $(this).parents('.item').toggleClass('active');
270    // });
271
272    $(".accordion .item").each(function (index, item) {
273        let itemButton = $(item).find('.item-btn');
274
275        let positionItem = ($(item).offset().top - $('.header').outerHeight(true)) - 30;
276
277        $(itemButton).on("click", function () {
278            $(this).parents('.item').toggleClass('active');
279
280            positionItem = ($(item).offset().top - $('.header').outerHeight(true)) - 30;
281            window.scrollTo(0, positionItem);
282        });
283    });
284
285    $(window).on('load resize', function () {
286        if ($(window).width() < 992) {
287            $('.img-info__inner:not(.slick-initialized)').slick({
288                centerMode: true,
289                dots: false,
290                infinite: true,
291                slidesToShow: 1,
292                touchThreshold: 50,
293                rtl: sliderCheck,
294                arrows: false,
295            });
296        } else {
297            $(".img-info__inner.slick-initialized").slick("unslick");
298        }
299    });
300
301    $('.tab-section .tab-track.simplebar-vertical').append('<span class="track-line"></span>')
302
303    //Video
304    $(document).ready(function () {
305        $(".modal").css("display", "block");
306
307        $(".modal-content").click((e) => e.stopPropagation());
308
309        $(".modal").click(function (e) {
310            hideModal($(this));
311            $(".video-modal .modal-video").html('<div id="modal-video-iframe"></div>');
312        });
313
314        $(".modal-close, .js-modal-close").click(function (e) {
315            e.preventDefault();
316
317            hideModal($(this).closest(".modal"));
318            $(".video-modal .modal-video").html('<div id="modal-video-iframe"></div>');
319        });
320
321        $("[data-modal]").click(function (e) {
322            e.preventDefault();
323            e.stopPropagation();
324
325            hideModal(".modal");
326
327            if ($(this).data("modal-tab") != undefined) {
328                goToTab($(this).data("modal-tab"));
329            }
330
331            showModal($(this).data("modal"));
332        });
333
334        $("[data-video-modal]").click(function (e) {
335            e.preventDefault();
336            e.stopPropagation();
337
338            let videoId = $(this).data("video-modal");
339            let videoType = $(this).data("video-type");
340
341            if (videoType == "youtube") {
342                $("#modal-video-iframe")
343                    .removeClass("vimeo youtube")
344                    .addClass("youtube")
345                    .append('<div class="video-iframe" id="' + videoId + '"></div>');
346                createVideo(videoId, videoId);
347            } else if (videoType == "vimeo") {
348                $("#modal-video-iframe")
349                    .removeClass("vimeo youtube")
350                    .addClass("vimeo")
351                    .html(
352                        '<iframe class="video-iframe" allow="autoplay" src="https://player.vimeo.com/video/' +
353                        videoId +
354                        '?playsinline=1&autoplay=1&transparent=1&app_id=122963">'
355                    );
356            }
357
358            hideModal(".modal");
359
360            showModal("#video-modal");
361        });
362
363        var player;
364
365        function createVideo(videoBlockId, videoId) {
366            player = new YT.Player(videoBlockId, {
367                videoId: videoId,
368                playerVars: {
369                    autohide: 1,
370                    showinfo: 0,
371                    rel: 0,
372                    loop: 1,
373                    playsinline: 1,
374                    fs: 1,
375                    allowsInlineMediaPlayback: true,
376                },
377                events: {
378                    onReady: function (e) {
379                        // e.target.mute();
380                        // if ($(window).width() > 991) {
381                        setTimeout(function () {
382                            e.target.playVideo();
383                        }, 200);
384                        // }
385                    },
386                },
387            });
388        }
389    });
390
391    function getScrollWidth() {
392        // create element with scroll
393        let div = document.createElement("div");
394
395        div.style.overflowY = "scroll";
396        div.style.width = "0px";
397        div.style.height = "0px";
398
399        document.body.append(div);
400        let scrollWidth = div.offsetWidth - div.clientWidth;
401
402        div.remove();
403
404        return scrollWidth;
405    }
406
407    let bodyScrolled = 0;
408
409    function showModal(modal) {
410        $(modal).addClass("visible");
411        bodyScrolled = $(window).scrollTop();
412        $("body")
413            .addClass("active")
414            .scrollTop(bodyScrolled)
415            .css("padding-right", getScrollWidth());
416    }
417
418    function hideModal(modal) {
419        $(modal).removeClass("visible");
420        bodyScrolled = $(window).scrollTop();
421        $("body")
422            .removeClass("active")
423            .scrollTop(bodyScrolled)
424            .css("padding-right", 0);
425    }
426});
427
428
429window.addEventListener('load', function () {
430    if ($('.products-slider').length) {
431        let rtlCheck = $('html').attr('rtl') == 'ltr' ? false : true;
432
433        if ($(window).width() > 992) {
434            $('.products-slider').append($('.products-slider .list').clone());
435            $('.products-slider .list').addClass('start-slider')
436        } else {
437            $('.products-slider .list').slick({
438                slidesToShow: 1,
439                slidesToScroll: 1,
440                autoplay: true,
441                autoplaySpeed: 0,
442                speed: 3000,
443                pauseOnHover: false,
444                pauseOnFocus: false,
445                cssEase: 'linear',
446                arrows: false,
447                rtl: rtlCheck,
448                variableWidth: true,
449                swipeToSlide: true,
450                infinity: true,
451            });
452        }
453    }
454});
455
456
457function addClassTeam(element, indexes, index) {
458    indexes.forEach((i) => {
459        $(element).eq(i).addClass(`hide-${index} hide`);
460        // $(element).eq(i).addClass(`hide`);
461    })
462}
463
464
465if ($(window).width() > 991) {
466    let itemsLength = $(".team .item").length;
467    let number = 1 + Math.floor(Math.random() * itemsLength);
468
469    expandCircle(number);
470
471    let lastNumber = 0;
472
473    setInterval(function () {
474            let itemsLength = $(".team .item").length;
475            let number = Math.floor(Math.random() * itemsLength);
476
477            while (number === lastNumber) {
478                number = Math.floor(Math.random() * itemsLength) + 1;
479            }
480            expandCircle(number);
481        },
482        2600);
483}
484
485
486function expandCircle(index) {
487    let item = $(".team .item").eq(index);
488
489    item.addClass('active');
490
491    switch (index) {
492        case 0:
493            addClassTeam($(".team .item"), [7, 1], index);
494            break;
495        case 1:
496            addClassTeam($(".team .item"), [0, 2, 7, 8, 9], index);
497            break;
498        case 2:
499            addClassTeam($(".team .item"), [1, 9, 3], index);
500            break;
501        case 3:
502            addClassTeam($(".team .item"), [2, 4, 9, 10, 11], index);
503            break;
504        case 4:
505            addClassTeam($(".team .item"), [3, 5, 11], index);
506            break;
507        case 5:
508            addClassTeam($(".team .item"), [4, 6, 11, 12, 13], index);
509            break;
510        case 6:
511            addClassTeam($(".team .item"), [5, 13], index);
512            break;
513        case 7:
514            addClassTeam($(".team .item"), [0, 1, 8], index);
515            break;
516        case 8:
517            addClassTeam($(".team .item"), [1, 7, 9], index);
518            break;
519        case 9:
520            addClassTeam($(".team .item"), [1, 2, 3, 8, 10], index);
521            break;
522        case 10:
523            addClassTeam($(".team .item"), [3, 9, 11], index);
524            break;
525        case 11:
526            addClassTeam($(".team .item"), [3, 4, 5, 10, 12], index);
527            break;
528        case 12:
529            addClassTeam($(".team .item"), [5, 11, 13], index);
530            break;
531        case 13:
532            addClassTeam($(".team .item"), [5, 6, 12], index);
533            break;
534        default:
535    }
536
537    setTimeout(function () {
538        item.removeClass('active');
539        $(".team .item").removeClass('hide');
540        $(".team .item").removeClass(`hide-${index}`);
541    }, 2500)
542}
543
544//slider scroll
545
546// const slider = document.querySelector('.products__wrapper');
547// let isDown = false;
548// let startX;
549// let scrollLeft;
550
551// if(slider) {
552//   slider.addEventListener('mousedown', (e) => {
553//     isDown = true;
554//     slider.classList.add('active');
555//     startX = e.pageX - slider.offsetLeft;
556//     scrollLeft = slider.scrollLeft;
557//   });
558//   slider.addEventListener('mouseleave', () => {
559//     isDown = false;
560//   });
561//   slider.addEventListener('mouseup', () => {
562//     isDown = false;
563//   });
564//   slider.addEventListener('mousemove', (e) => {
565//     if(!isDown) return;
566//     e.preventDefault();
567//     const x = e.pageX - slider.offsetLeft;
568//     const walk = (x - startX) * 1; 
569//     slider.scrollLeft = scrollLeft - walk;
570//   });
571// }
572
573if ($('.img-info__inner').length && $(window).width() < 991) {
574    $('.img-info__inner').scrollLeft(-($('.img-info__inner .item').outerWidth()))
575}
576
577if ($('.public').length && $(window).width() < 991) {
578    $('.public__inner').scrollLeft(-($('.public .item').outerWidth()))
579}
580
581$('.tab__list').css('height', Math.ceil(28.125 * window.innerWidth / 100));
582
583if ($('.tab__list').length) {
584    
585    let heightThumb = Math.ceil(1.563 * window.innerWidth / 100);
586    new SimpleBar($('.tab__list')[0], {
587        autoHide: false,
588        classNames: {
589            track: 'tab-track',
590            scrollbar: 'tab-thumb',
591        },
592        scrollbarMaxSize: heightThumb
593    });
594    let scrbW = document.querySelector('.simplebar-content-wrapper');
595    scrbW.removeAttribute('aria-label');
596    scrbW.removeAttribute('role');
597    scrbW.removeAttribute('tabindex');
598    $('.tab-track').css('width', heightThumb);
599    $('.tab-thumb').css('width', heightThumb);
600    let tabListBtns = [...document.querySelectorAll('.tab__list button')];
601    var mousedown1 = false;
602
603
604    tabListBtns.forEach((bt) => {
605        bt.addEventListener('click', () => {
606            if (bt.classList.contains('active')) {
607                tabListBtns.forEach((bt2) => {
608                    bt2.setAttribute('aria-selected', 'false');
609                    bt2.setAttribute('tabindex', '-1');
610                })
611                bt.removeAttribute('tabindex');
612            }
613        })
614        bt.addEventListener('mousedown', () => {
615            mousedown1 = true;
616            console.log('click');
617        })
618        if (bt.classList.contains('active')) {
619            bt.setAttribute('aria-selected', 'true');
620        } else {
621            bt.setAttribute('aria-selected', 'false');
622        }
623        bt.addEventListener('focus', () => {
624            if (!mousedown1) {
625                bt.click();
626            }
627        })
628
629        // bt.addEventListener('blur', (e) => {
630        //     let lbl = bt.getAttribute('aria-controls');
631        //     let ctl = document.querySelector(`.tab-content[aria-labelledby="${lbl}"]`);
632        //     ctl.focus();
633        //     console.log('ne focus');
634        //     console.log(document.activeElement + ' aaaaaa');
635        //
636        // })
637    });
638    $(window).mouseup(function (e) {
639        mousedown1 = false;
640    })
641
642
643    $(document).keydown(function (e) {
644        if (e.key === "Tab") {
645
646            if (document.activeElement.getAttribute('role') === 'tabpanel') {
647                let idB = document.activeElement.getAttribute('aria-labelledby');
648                if (document.querySelector(`#${idB}`).nextElementSibling) {
649                    e.preventDefault();
650                    console.log('focus here');
651                    document.querySelector(`#${idB}`).nextElementSibling.focus();
652                }
653
654
655            }
656
657            
658        }
659        if (e.key === 'ArrowUp') {
660            if (document.activeElement.getAttribute('role') === 'tab') {
661                if (document.activeElement.previousElementSibling) {
662                    document.activeElement.previousElementSibling.focus();
663                }
664            }
665        }
666        if (e.key === 'ArrowDown') {
667            if (document.activeElement.getAttribute('role') === 'tab') {
668                if (document.activeElement.nextElementSibling) {
669                    document.activeElement.nextElementSibling.focus();
670                }
671            }
672        }
673    });
674
675}
676
677$('.map-list ul').css('height', Math.ceil(31.25 * window.innerWidth / 100));
678
679if ($('.map-list ul').length) {
680    let heightThumb = Math.ceil(1.563 * window.innerWidth / 100);
681    new SimpleBar($('.map-list ul')[0], {
682        autoHide: false,
683        classNames: {
684            track: 'map-track',
685            scrollbar: 'map-thumb',
686        },
687        scrollbarMaxSize: heightThumb
688    });
689    $('.map-track').css('width', heightThumb)
690    $('.map-track').append("<span class='line'></span>")
691    $('.map-thumb').css('width', heightThumb)
692    let scrbW = document.querySelector('.simplebar-content-wrapper');
693    // scrbW.setAttribute('aria-hidden', 'true');
694    scrbW.removeAttribute('aria-label');
695    scrbW.removeAttribute('role');
696    scrbW.removeAttribute('tabindex');
697}
698if ($('#video-wrapper').length > 0) {
699    var options = {
700        url: $('#video-wrapper').attr('data-desktop-video-id'),
701        autoplay: true,
702        controls: false,
703        loop: true,
704        muted: true
705        // responsive: true
706        // height: `${window.innerHeight}px`,
707        // width: `${window.innerWidth}px`
708    };
709    var videoPlayer = new Vimeo.Player('video-wrapper', options);
710
711    videoPlayer.on('playing', function () {
712        setTimeout(function () {
713            $('#video-poster').addClass('hide');
714        }, 500)
715    });
716    if (document.querySelector('.btn-pause')) {
717        document.querySelector('.btn-pause').addEventListener('click', () => {
718            document.querySelector('.btn-pause').classList.toggle('pause');
719            if (document.querySelector('.btn-pause').classList.contains('pause')) {
720                videoPlayer.pause();
721                document.querySelector('.btn-pause').setAttribute('aria-pressed', 'true');
722            } else {
723                videoPlayer.play();
724                document.querySelector('.btn-pause').setAttribute('aria-pressed', 'false');
725            }
726        })
727    }
728
729
730}
731
732function videoSize() {
733    var $windowHeight = $(window).height();
734    var $videoHeight = $(".video").outerHeight();
735    var $scale;
736    if ($(window).width() > 991) {
737        $scale = $windowHeight / $videoHeight + 2;
738    } else {
739        $scale = $windowHeight / $videoHeight + 0.5;
740    }
741
742    if ($videoHeight <= $windowHeight) {
743        $(".video").css({
744            "-webkit-transform": "scale(" + $scale + ") translateY(-50%)",
745            "transform": "scale(" + $scale + ") translateY(-50%)"
746        });
747    } else if ($videoHeight <= $windowHeight && $(window).width() < 991) {
748        $(".video").css({
749            "-webkit-transform": "scale(" + $scale + ") translateY(-50%)",
750            "transform": "scale(" + $scale + ") translateY(-50%)"
751        });
752    }
753}
754
755
756$(window).on('load resize', function () {
757    videoSize();
758});
759
760$('.contact-list__content').css('height', Math.ceil(127 * window.innerWidth / 100));
761
762if ($('.contact-list ul').length && $(window).width() < 991) {
763    let heightThumb = Math.ceil(8.333 * window.innerWidth / 100);
764    new SimpleBar($('.contact-list ul')[0], {
765        autoHide: false,
766        classNames: {
767            track: 'contact-list-track',
768            scrollbar: 'contact-list-thumb',
769        },
770        scrollbarMaxSize: heightThumb
771    });
772    $('.contact-list-track').append("<span class='line'></span>");
773    $('.contact-list-thumb').css('width', heightThumb)
774}
775
776
777if ($('#map').length) {
778
779    var locations = [];
780
781    $('#map-list .simplebar-content li').each(function (i, e) {
782        var newLocation = [$(this).find('.title').text() + '<p>' + $(this).find('.address').text() + '</p>', $(this).attr('data-lat'), $(this).attr('data-lng')];
783        locations.push(newLocation);
784    });
785
786
787    var gmarkers = [];
788
789    function initMap() {
790        map = new google.maps.Map(document.getElementById("map"), {
791            zoom: 10, // Початковий масштаб
792        });
793
794        setMarkers(map);
795
796        // Отримання границь між маркерами
797        var bounds = new google.maps.LatLngBounds();
798        for (var i = 0; i < locations.length; i++) {
799            bounds.extend(new google.maps.LatLng(locations[i][1], locations[i][2]));
800        }
801
802        // Встановлення автоматичного центру карти та масштабу
803        map.fitBounds(bounds);
804
805    }
806
807    function setMarkers(map) {
808        const image = {
809            url: $('#map').attr('data-icon'),
810            size: new google.maps.Size(22, 31),
811            origin: new google.maps.Point(0, 0),
812            anchor: new google.maps.Point(0, 31),
813        };
814
815        const shape = {
816            coords: [1, 1, 1, 20, 18, 20, 18, 1],
817            type: "poly",
818        };
819
820
821        var infowindow = new google.maps.InfoWindow;
822
823        var marker, i;
824        for (i = 0; i < locations.length; i++) {
825            const beach = locations[i];
826
827            marker = new google.maps.Marker({
828                position: new google.maps.LatLng(locations[i][1], locations[i][2]),
829                map: map,
830                shape: shape,
831                icon: image,
832                title: beach[0],
833                zIndex: beach[3],
834                // label: String(locations[i][3])
835            });
836
837            gmarkers.push(marker);
838
839            if ($(window).width() > 991) {
840                google.maps.event.addListener(marker, 'click', (function (marker, i) {
841                    return function () {
842                        infowindow.setContent(locations[i][0]);
843                        infowindow.open(map, marker);
844                    }
845                })(marker, i));
846            }
847        }
848        if ($(window).width() > 991) {
849            $('#map-list .simplebar-content li').each(function (i, e) {
850                $(e).click(function (i) {
851                    return function (e) {
852                        google.maps.event.trigger(gmarkers[i], 'click');
853                    }
854                }(i));
855            });
856        }
857    }
858
859    window.initMap = initMap;
860}
861
862
863
864
865
866
867
868

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.