PageSourceSearch

https://brandme.in.ua/wp-content/themes/brand.me/js/shared.js?ver=1789985770

js brandme.in.ua collected 2026-10-06 20:03:35 UTC 33,975 bytes, 863 lines download raw bytes

1function Clipboard_CopyTo(value) {
2    var tempInput = document.createElement("input");
3    tempInput.value = value;
4    document.body.appendChild(tempInput);
5    tempInput.select();
6    document.execCommand("copy");
7    document.body.removeChild(tempInput);
8}
9function ShareToTelegram(value, desc) {
10    var win = window.open("https://t.me/share/url?url="+encodeURIComponent(value)+'&text='+encodeURIComponent('\n'+desc), '_blank');
11    win.focus();
12}
13function ShareToViber(value, desc) {
14    var win = window.open("viber://forward?text="+encodeURIComponent(desc+'\n\n')+encodeURIComponent(value), '_blank');
15    win.focus();
16}
17function ShareByEmail(value, desc) {
18    var win = window.open('mailto:?subject='+desc+'&body='+encodeURIComponent(value), '_blank');
19    win.focus();
20}
21$(function () {
22    // Hover menu item
23    const menuItem = $('.main-header .hover-menu__item');
24    menuItem.children('.hover-menu__item__sub')
25        .on("animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd",
26            function(e) {
27                if (!$(this).hasClass('active-item')) {
28                    $(this).addClass('hidden');
29                }
30            });
31
32    menuItem.hover(function(e) {
33        $(this).children('.hover-menu__item__sub').removeClass('hidden');
34        $(this).children('.hover-menu__item__sub').addClass('active-item');
35    }, function () {
36        $(this).children('.hover-menu__item__sub').removeClass('active-item');
37    });
38
39    // Open mobile menu item
40    const mobileMenuBtn = $('.mobile-menu__item__btn');
41    mobileMenuBtn.on('click', function(e) {
42        const currentSubMenu = $(this).siblings('.mobile-menu__item__sub');
43        $('.mobile-menu__item__sub').each(function () {
44            if(!$(this).is(currentSubMenu))
45                $(this).slideUp('300');
46        });
47        currentSubMenu.slideToggle('300');
48    });
49
50    // MODAL EVENTS
51
52    // Add and remove special body modal class
53    function toggleBodyClass(name) {
54        $('#' + name +'_popup').on('show.bs.modal', function (e) {
55            $('body').addClass(name + '-modal-open');
56        }).on('hidden.bs.modal', function (e) {
57            $('body').removeClass(name + '-modal-open');
58        });
59    }
60    toggleBodyClass('portfolio');
61    toggleBodyClass('menu');
62
63    const body = $('body');
64    $('#order_design_popup, #order_popup').on('hidden.bs.modal', function (e) {
65        // Add modal open class to body when mobile menu is opened
66        if (body.hasClass('menu-modal-open')) {
67            body.addClass("modal-open");
68        }
69    });
70    
71    $('#order_popup').on('show.bs.modal', function (e) {
72        $(e.relatedTarget).closest('#portfolio_popup.modal').modal('hide');
73        var invoker = $(e.relatedTarget);
74        var image = $(invoker).closest('.popup__content').find('.popup-img-container img');
75        image = image.length ? image.attr('src') : '';
76        $(this).find('.wpcf7-form input[name="ordered-product"]').prop('value', image);
77    });
78
79    // Hide modal backdrop before remove
80    function hideBackdrop(selector) {
81        $(selector).on('hide.bs.modal', function (e) {
82            if($(this).is('#menu_popup') || !(body.hasClass('menu-modal-open'))) {
83                $('.modal-backdrop').not('.modal-backdrop ~ .modal-backdrop').removeClass('show');
84            }
85        });
86    }
87
88    hideBackdrop('#order_design_popup, #order_popup');
89    hideBackdrop('#menu_popup');
90    hideBackdrop('#portfolio_popup');
91
92    $( window ).resize(function() {
93        if(window.matchMedia("(min-width: 480px)").matches){
94            $('#menu_popup').modal('hide');
95        }
96    });
97
98
99    // Move top button action
100    const goTopBtn = $('.top-btn');
101
102    goTopBtn.on('click', function(e) {
103        e.preventDefault();
104        $('html, body').animate({
105            scrollTop:0
106        }, '300');
107    });
108
109    function getProjectData($portfolio_id, $project_id, $project_prev, $project_next) {
110        if ($('#'+$portfolio_id).hasClass('gallery_pictures')) {
111            $action = 'ajax_project_gallery_function';
112        } else {
113            $action = 'ajax_project_function';
114        }
115        $('#portfolio_popup .modal-dialog').html('');
116        $('body').addClass('loading');
117        $.ajax({
118            url: '/wp-admin/admin-ajax.php',
119            method: 'POST',
120            data: {
121                portfolio_id: $portfolio_id,
122                project_id: $project_id,
123                project_prev: $project_prev,
124                project_next: $project_next,
125                action: $action,
126            },
127            success: function(response){
128                $('#portfolio_popup .modal-dialog').removeClass('loading');
129                $('#portfolio_popup .modal-dialog').html(response);
130                $('body').removeClass('loading');
131            },
132            error: function(response){
133                $('#portfolio_popup .modal-dialog').removeClass('loading');
134                $('#portfolio_popup .modal-dialog').html('<div class="popup-img-container"> </div> <div class="popup-img-info"> <div class="popup-img-info__text"> <span> Помилка завантаження! Спробуйте будь ласка пізніше. </span> </div> </div>');
135                $('body').removeClass('loading');
136            }
137        });
138    }
139
140    // Завантаження попапу при кліку на проект
141    $(document).on('click', '.pictures a:not(.direct-link)', function(event) {
142        event.preventDefault();
143        $portfolio_id = $(this).closest('.pictures').attr('id');
144        $project_id = $(this).data('project_id');
145        $project_prev = $(this).closest('.picture').prevAll('.picture-modal').first().find('a').data('project_id');
146        $project_next = $(this).closest('.picture').nextAll('.picture-modal').first().find('a').data('project_id');
147        getProjectData($portfolio_id, $project_id, $project_prev, $project_next);
148    });
149    // Переключення проектів стрілками
150    $(document).on('click', '.popup-nav:not(.disabled)', function(event) {
151        event.preventDefault();
152        $project_id = $(this).data('target');
153        $portfolio_id = $(this).closest('.popup--portfolio').data('portfolio_id');
154        $project_prev = $('#'+$portfolio_id).find('.picture a[data-project_id="'+$project_id+'"]').parent().prevAll('.picture-modal').first().find('a').data('project_id');
155        $project_next = $('#'+$portfolio_id).find('.picture a[data-project_id="'+$project_id+'"]').parent().nextAll('.picture-modal').first().find('a').data('project_id')
156        getProjectData($portfolio_id, $project_id, $project_prev, $project_next);
157    });
158    // Переключення між зображеннями проекту
159    $(document).on('click', '.popup-picture', function(e) {
160        e.preventDefault();
161
162        $(this).closest('.popup-img-info__pictures').find('.popup-picture').removeClass('active');
163        $(this).addClass('active');
164
165        const imgContainer = $('.popup-img-container');
166        const chosenImg = $(this).children('img');
167        const currImg = imgContainer.children('img');
168
169        if (currImg.attr('src') !== chosenImg.attr('src')) {
170            imgContainer.animate({
171                opacity: 0
172            }, 100, function () {
173                // imgContainer.children('img').attr('src', chosenImg);
174                currImg.replaceWith(chosenImg.clone());
175            });
176            imgContainer.animate({
177                opacity: 1
178            }, 100);
179        }
180    });
181
182    $(document).on('click', '.popup-img-container', function(e) {
183        e.preventDefault();
184
185        const imgContainer = $(this).closest('.popup__content').find('.popup-img-info__pictures');
186        const activeImg = $(this).closest('.popup__content').find('.popup-picture.active');
187        if (imgContainer.children().length > 1) {
188            if (activeImg.next().length) {
189                activeImg.next().click();
190            } else {
191                imgContainer.children()[0].click();
192            }
193        } 
194    });
195
196    // Add active class to chosen filter item
197    const filterItem = $('.pictures-filter__item:not(.popup-link)');
198    filterItem.closest('.active').prev().addClass('before-active');
199
200    filterItem.on('click', function(e) {
201        e.preventDefault();
202        if ($(this).attr('href') != '#') {
203            history.pushState(null, '', this.href);
204        }
205        $(this).closest('.pictures-filter').find('.pictures-filter__item').each(function () {
206            $(this).removeClass('active before-active');
207        });
208        $(this).addClass('active');
209        $(this).prev().addClass('before-active');
210    });
211
212    // Show and hide text in about section
213    $('.toggle-text-btn').on('click', function(e) {
214        const hiddenText = $('.hidden-text');
215        if(hiddenText.is(':visible')) {
216            hiddenText.eq(0).delay(150).slideToggle("300");
217            hiddenText.eq(1).slideToggle("300");
218            $('.toggle-text-btn').text(showMore)
219        } else {
220            hiddenText.eq(0).slideToggle("300");
221            hiddenText.eq(1).delay(150).slideToggle("300");
222            $('.toggle-text-btn').text(hide)
223        }
224    });
225
226    // Show and hide blog categories
227    $('.blog__filter')
228        .on("animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd",
229            function(e) {
230                if ($(this).hasClass('blog__filter--hidden')) {
231                    $(this).css("display", "none");
232                }
233            });
234
235    $('.blog__categories__btn').on('click', function(e) {
236        $('.blog__filter')
237            .css("display", "flex")
238            .toggleClass('blog__filter--hidden');
239    });
240
241    $(document).on('click', 'a[href="#"]', function(e) {
242        e.preventDefault();
243    })
244
245});
246
247$(function () {
248    function initPagination(pagination) {
249        const items = pagination.data('items');
250        const pages = pagination.data('pages-count');
251        const path = pagination.data('path');
252        const sufix = pagination.data('path_sufix') ? pagination.data('path_sufix') : '/';
253        const current = pagination.data('current');
254        console.log(pagination);
255        let paginationOptions = {
256            // items: 100,
257            itemsOnPage: items,
258            pages: pages,
259            ellipsePageSet: false,
260            prevText:"<div class=\"arrow-left\"><img src=\""+themeURL+"/icons/left_btn.svg\" alt=\"left-btn\"></div>",
261            nextText:"<div class=\"arrow-right\"><img src=\""+themeURL+"/icons/right_btn.svg\" alt=\"right-btn\"></div>",
262            hrefTextPrefix: path+'page/',
263            hrefTextSuffix: sufix,
264            currentPage :current
265        };
266        if(window.matchMedia("(max-width: 480px)").matches){
267            paginationOptions.displayedPages = 3;
268            paginationOptions.edges = 1;
269        } else {
270            paginationOptions.displayedPages = 4;
271            paginationOptions.edges = 4;
272        }
273        pagination.pagination(paginationOptions);
274
275        pagination.find('a[href$="page/1/"]').each(function() {
276            const originalHref = $(this).attr('href');
277            $(this).attr('href', originalHref.replace(/page\/1\/$/, ''));
278        });
279    }
280    initPagination($('#portfolio-pagination'));
281    $( window ).resize(function() {
282        if ($('#portfolio-pagination').length) {
283            const current = $(pagination).pagination('getCurrentPage');
284            paginationOptions.currentPage = current;
285            initPagination();
286        }
287    });
288
289    $(document).on('click', 'a.page-link', function(e) {
290        e.preventDefault();
291        history.pushState(null, '', this.href);
292        if ($('.pagination').hasClass('blog-pagination')) {
293            $tax_cat = $('.pagination').data('category');
294            $new_category = $('.blog__filter a.active').data('category');
295            $base_path = $('.pagination').data('path');
296            $page = $('.pagination li.active span.current').text();
297            $('body').addClass('loading');
298            $.ajax({
299                url: '/wp-admin/admin-ajax.php',
300                method: 'POST',
301                data: {
302                    cat_id: $new_category,
303                    base_path: $base_path,
304                    page: $page,
305                    tax_cat: $tax_cat,
306                    action: 'ajax_category_blog_function',
307                },
308                success: function(response){
309                    $('body').removeClass('loading');
310                    $('.blog .blog-items').remove();
311                    $('.blog .pagination-container').remove();
312                    $('.blog').append(response);
313                    initPagination($('#portfolio-pagination'));
314                },
315                error: function(response){
316                    $('body').removeClass('loading');
317                    alert('error');
318                }
319            });
320        } else if ($('.pagination').hasClass('portfolio-pagination')) {
321            $tax_cat = $('.pagination').data('category');
322            $new_category = $('.pictures-filter__item.active').data('category');
323            $base_path = $('.pagination').data('path');
324            $page = $('.pagination li.active span.current').text();
325            $filter_type = $('.pictures-filter').data('filter_type');
326            $filter_target = $('.pictures-filter').data('filter_target');
327            $per_page = $('.pictures-filter').data('per_page');
328            console.log('$per_page'+$per_page);
329            $('body').addClass('loading');
330            $.ajax({
331                url: '/wp-admin/admin-ajax.php',
332                method: 'POST',
333                data: {
334                    cat_id: $new_category,
335                    base_path: $base_path,
336                    page: $page,
337                    per_page: $per_page,
338                    filter_type: $filter_type,
339                    filter_target: $filter_target,
340                    action: 'ajax_category_portfolio_function',
341                },
342                success: function(response){
343                    $('body').removeClass('loading');
344                    $('#'+$filter_target+' + .pagination-container').remove();
345                    $('#'+$filter_target)[0].outerHTML = response;
346                    initPagination($('#'+$filter_target+' + .pagination-container #portfolio-pagination'));
347                },
348                error: function(response){
349                    $('body').removeClass('loading');
350                }
351            });
352        }
353        else if ($('.pagination').hasClass('customers-pagination')) {
354            $tax_cat = $('.pagination').data('category');
355            $new_category = $('.pictures-filter__item.active').data('category');
356            $base_path = $('.pagination').data('path');
357            $page = $('.pagination li.active span.current').text();
358            $filter_type = $('.pictures-filter').data('filter_type');
359            $filter_target = $('.pictures-filter').data('filter_target');
360            $per_page = $('.pictures-filter').data('per_page');
361
362            $('body').addClass('loading');
363            $.ajax({
364                url: '/wp-admin/admin-ajax.php',
365                method: 'POST',
366                data: {
367                    cat_id: $new_category,
368                    base_path: $base_path,
369                    page: $page,
370                    per_page: $per_page,
371                    filter_type: $filter_type,
372                    filter_target: $filter_target,
373                    action: 'ajax_category_customers_function',
374                },
375                success: function(response){
376                    $('body').removeClass('loading');
377                    $('#'+$filter_target+' + .pagination-container').remove();
378                    $('#'+$filter_target)[0].outerHTML = response;
379                    initPagination($('#'+$filter_target+' + .pagination-container #portfolio-pagination'));
380                },
381                error: function(response){
382                    $('body').removeClass('loading');
383                }
384            });
385        }
386    });
387    
388    $(document).on('click', '.blog .blog__filter a', function(e) {
389        e.preventDefault();
390        $(this).closest('.blog__filter').find('a').removeClass('active');
391        $(this).addClass('active');
392        history.pushState(null, '', this.href);
393        $new_category = $(this).data('cate
393gory');
394        $base_path = $(this).attr('href');
395        $('body').addClass('loading');
396        $.ajax({
397			url: '/wp-admin/admin-ajax.php',
398			method: 'POST',
399			data: {
400                cat_id: $new_category,
401                base_path: $base_path,
402                page: 1,
403				action: 'ajax_category_blog_function',
404			},
405			success: function(response){
406                $('body').removeClass('loading');
407                $('.blog .blog-items').remove();
408                $('.blog .pagination-container').remove();
409                $('.blog').append(response);
410                initPagination($('#portfolio-pagination'));
411			},
412			error: function(response){
413                $('body').removeClass('loading');
414                alert('error');
415			}
416		});
417    });
418
419    $(document).on('click', '.pictures-filter__item:not(.popup-link)', function(e) {
420        e.preventDefault();
421        $(this).closest('.pictures-filter').find('a').removeClass('active');
422        $(this).addClass('active');
423        if ($(this).attr('href') != '#') {
424            history.pushState(null, '', this.href);
425        }
426        
427        $new_category = $(this).data('category');
428        $base_path = $(this).attr('href').split('?')[0];
429        $filter_type = $(this).closest('.pictures-filter').data('filter_type');
430        $filter_target = $(this).closest('.pictures-filter').data('filter_target');
431        $per_page = $(this).closest('.pictures-filter').data('per_page');
432
433        if ($filter_type == 'customers') {
434            $action = 'ajax_category_customers_function';
435        } else {
436            $action = 'ajax_category_portfolio_function';
437        }
438
439        $('body').addClass('loading');
440        $.ajax({
441			url: '/wp-admin/admin-ajax.php',
442			method: 'POST',
443			data: {
444                cat_id: $new_category,
445                base_path: $base_path,
446                filter_type: $filter_type,
447                filter_target: $filter_target,
448                per_page: $per_page,
449                page: 1,
450				action: $action,
451			},
452			success: function(response){
453                $('body').removeClass('loading');
454                $('#'+$filter_target+' + .pagination-container').remove();
455                $('#'+$filter_target)[0].outerHTML = response;
456                initPagination($('#'+$filter_target+' + .pagination-container #portfolio-pagination'));
457			},
458			error: function(response){
459                $('body').removeClass('loading');
460                alert('error');
461			}
462		});
463    });
464
465    $(document).on('click', '.customers-pagination + button.main-btn', function(e){
466        e.preventDefault();
467        history.pushState(null, '', $(this).data('href'));
468
469        $tax_cat = $('.pagination').data('category');
470        $new_category = $('.pictures-filter__item.active').data('category');
471        $base_path = $('.pagination').data('path');
472        $page = $(this).data('current');
473        $prev_page = $('.pagination li.active span.current').text();
474        $filter_type = $('.pictures-filter').data('filter_type');
475        $filter_target = $('.pictures-filter').data('filter_target');
476
477        $('body').addClass('loading');
478        $.ajax({
479            url: '/wp-admin/admin-ajax.php',
480            method: 'POST',
481            data: {
482                cat_id: $new_category,
483                base_path: $base_path,
484                page: $page,
485                prev_page: $prev_page,
486                per_page: 20,
487                filter_type: $filter_type,
488                filter_target: $filter_target,
489                action: 'ajax_loadmore_customers_function',
490            },
491            success: function(response){
492                $('body').removeClass('loading');
493                $('#'+$filter_target+' + .pagination-container').remove();
494                $('#'+$filter_target)[0].outerHTML = response;
495                initPagination($('#'+$filter_target+' + .pagination-container #portfolio-pagination'));
496            },
497            error: function(response){
498                $('body').removeClass('loading');
499            }
500        });
501    });
502
503    $(document).on('click', '.blog-pagination + button.main-btn', function(e){
504        e.preventDefault();
505        history.pushState(null, '', $(this).data('href'));
506
507        $tax_cat = $('.pagination').data('category');
508        $new_category = $('.blog__filter a.active').data('category');
509        $base_path = $('.pagination').data('path');
510        $page = $(this).data('current');
511        $('body').addClass('loading');
512        $.ajax({
513            url: '/wp-admin/admin-ajax.php',
514            method: 'POST',
515            data: {
516                cat_id: $new_category,
517                base_path: $base_path,
518                page: $page,
519                tax_cat: $tax_cat,
520                action: 'ajax_loadmore_blog_function',
521            },
522            success: function(response){
523                $('body').removeClass('loading');
524                $('.blog .blog-items').remove();
525                $('.blog .pagination-container').remove();
526                $('.blog').append(response);
527                initPagination($('#portfolio-pagination'));
528            },
529            error: function(response){
530                $('body').removeClass('loading');
531                alert('error');
532            }
533        });
534        
535    });
536
537    $(document).on('click', '.portfolio-pagination + button.main-btn', function(e){
538        e.preventDefault();
539        history.pushState(null, '', $(this).data('href'));
540        
541        $tax_cat = $('.pagination').data('category');
542        $new_category = $('.pictures-filter__item.active').data('category');
543        $base_path = $('.pagination').data('path');
544        $page = $(this).data('current');
545        $filter_type = $('.pictures-filter').data('filter_type');
546        $filter_target = $('.pictures-filter').data('filter_target');
547        $per_page = $('.pictures-filter').data('per_page');
548        $('body').addClass('loading');
549        $.ajax({
550            url: '/wp-admin/admin-ajax.php',
551            method: 'POST',
552            data: {
553                cat_id: $new_category,
554                base_path: $base_path,
555                page: $page,
556                per_page: $per_page,
557                filter_type: $filter_type,
558                filter_target: $filter_target,
559                action: 'ajax_loadmore_portfolio_function',
560            },
561            success: function(response){
562                $('body').removeClass('loading');
563                $('#'+$filter_target+' + .pagination-container').remove();
564                $('#'+$filter_target)[0].outerHTML = response;
565                initPagination($('#'+$filter_target+' + .pagination-container #portfolio-pagination'));
566            },
567            error: function(response){
568                $('body').removeClass('loading');
569            }
570        });
571    });
572
573    $(document).on('click', '.wpcf7-not-valid', function(){
574        $(this).next().hide();
575    });
576    
577    $(document).on('click', 'input.wpcf7-submit', function( event ) {
578        $(this).val(sendingText);
579    });
580    document.addEventListener( 'wpcf7submit', function( event ) {
581        var id = event.detail.unitTag;
582        $('#'+id+' input[type="submit"]').val(sendText);
583    }, false );
584
585    $(document).on('click', 'header.main-header button[data-target="#order_popup"]', function(){
586		ga('send', 'event', 'КнопкаЗамовити', 'замовити');
587    });
588    $(document).on('click', 'a[data-target="#order_popup"]', function(){
589		ga('send', 'event', 'КнопкаЗамовити', 'замовити');
590	});
591    $(document).on('click', 'header.main-header button[data-target="#order_design_popup"]', function(){
592		ga('send', 'event', 'ЗамовитиСторікиДизайну', 'ЗамовитиДизайн');
593	});
594    $(document).on('click', '.page-content [data-target="#order_popup"]', function(){
595		ga('send', 'event', 'КнопкаВсерединіСторінки', 'ЗамовитиПродукцію');
596	});
597    $(document).on('click', '.page-content [data-target="#order_design_popup"]', function(){
598		ga('send', 'event', 'СторінкиДизайну', 'ЗамовитиДизайнВнутрішня');
599    });
600    $(document).on('click', '#order_popup input.wpcf7-submit', function(){
601		ga('send', 'event', 'НадсиланняФорми', 'УспішнеНадсилання');
602    });
603    $(document).on('click', '#order_design_popup input.wpcf7-submit', function(){
604		ga('send', 'event', 'ВідправкаФормиСторінкиДизайну', 'ДизайнВідправкаФорми');
605    });
606    $(document).on('click', '.b24-widget-button-block, .b24-widget-button-popup', function(){
607		ga('send', 'event', 'БітріксВідкриття', 'НатискНаФорму');
608    });
609    $(document).on('click', 'a[href^="tel"]', function(){
610		ga('send', 'event', 'НомерТелефону', 'КлікПоСайту');
611	});
612    document.addEventListener( 'wpcf7mailsent', function( event ) {
613        console.log(event);
614        $formURL = window.location.href;
615        if (event.detail.contactFormId == 11272) {
616            if (current_language == 'ru') {
617                $formName = 'КонтактнаФорма_РУС';
618            } else {
619                $formName = 'КонтактнаФорма_УКР';
620            }
621        } else if (event.detail.contactFormId == 11309 || event.detail.contactFormId == 16622) {
622            if (current_language == 'ru') {
623                $formName = 'ДизайнФорма_РУС';
624            } else {
625                $formName = 'ДизайнФорма_УКР';
626            }
627        }
628        console.log("ga( 'send', 'event', "+$formName+", "+$formURL+" );");
629    }, false );
630
631    $(document).on('click', '.pictures .picture a div', function(e){
632        e.stopPropagation();
633        e.preventDefault();
634    });
635    $(document).on('click', '.share_this svg', function(e){
636        value = $(this).closest('.popup__content').find('.popup-img-container img').attr('src');
637        desc = $(this).closest('.share_this').data('title');
638        if ($(this).hasClass('copy_icon')) {
639            navigator.clipboard.writeText(value).then(function() {
640            console.log('Async: Copying to clipboard was successful!');
641            }, function(err) {
642            console.error('Async: Could not copy text: ', err);
643            });
644        } else if ($(this).hasClass('viber_icon')) {
645            ShareToViber(value, desc);
646        } else if ($(this).hasClass('telegram_icon')) {
647            ShareToTelegram(value, desc);
648        } else if ($(this).hasClass('email_icon')) {
649            ShareByEmail(value, desc);
650        }
651    });
652    $(document).keydown(function(e) {
653        if ($("body").hasClass('portfolio-modal-open')) {
654            if(e.keyCode === 37) 
655                $('.popup-nav__prev').click();
656            else if(e.keyCode === 39) 
657                $('.popup-nav__next').click();
658        }
659    });
660
661    $(document).on("click", ".youtube-modal button", function (event) {
662        event.preventDefault();
663        var videoURL = 'https://www.youtube.com/watch?v='+$(this).attr("data-href");
664        jQuery.magnificPopup.open({
665            items: {
666                src: videoURL,
667            },
668            disableOn: 700,
669            type: "iframe",
670            mainClass: "mfp-fade",
671            removalDelay: 160,
672            preloader: false,
673            fixedContentPos: false,
674            // callbacks: {
675            //     elementParse: function(item) {
676            //         videoID = get_youtube_video_id(item.src);
677            //         window.location.hash = videoID ? videoID : '';
678            //     }
679            // }
680        });
681    });
682});
683
684$(document).ready(function(){
685    $('input[type="tel"]').mask("+38(099)999-99-99");
686    AOS.init({disable: 'mobile'});
687});
688
689$(document).on('mouseover', 'div.menu-item.menu-item-has-children', function(){
690    if ($(this).find('.hover-menu__item__sub--full').length) {
691        var height = 0;
692        var target = $(this).find('.hover-menu__item__sub--full > .sub-menu_wrapper');
693        console.log($(target).children('.sub-menu__category'));
694
695        $(target).children('.sub-menu__category').each(function(){
696            height += parseFloat($(this).css('margin-bottom')) + $(this).height();
697            // console.log('element #:' + $(this).height()); 
698        });
699        // console.log('elements:' + height); 
700
701        height += parseFloat($(target).css('padding-top'));
702        height += parseFloat($(target).css('padding-bottom'));
703        $(target).css('min-height', height+1);
704        // $(target).find('.sub-menu__category:last-child').css('margin-bottom', 0);
705
706        // console.log(height);
707    }
708});
709
710$(document).on('click', '.main-menu .main-menu-link.has-children > a', function(e){
711  e.preventDefault();
712  if (!$(this).closest('.main-menu-link').hasClass('active')) {
713    $('.main-menu .main-menu-link').removeClass('active');
714    $('body').removeClass('menu-open');
715  } else {
716    $('body').addClass('menu-open');
717  }
718  $(this).closest('.main-menu-link').toggleClass('active');
719
720  var activeTab = $(this).next('.submenu').find('button.nav-link[data-toggle="pill"].active');
721  console.log($(this));
722  if (activeTab.length) {
723    activeTab.trigger('shown.bs.tab');
724  }
725});
726
727jQuery(document).ready(function($) {
728  function hexToRgba(hex, alpha) {
729    var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
730    hex = hex.replace(shorthandRegex, function(m, r, g, b) {
731      return r + r + g + g + b + b;
732    });
733
734    var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
735    return result ? 
736      `rgba(${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(result[3], 16)}, ${alpha})` 
737      : null;
738  }
739
740  function updateTabContentBackground($tab) {
741    var style = $tab.attr('style');
742    console.log(style);
743    var match = /background-color:\s*(#[0-9a-fA-F]{3,6})/.exec(style);
744
745    if (match && match[1]) {
746      var rgba = hexToRgba(match[1], 0.1);
747      if (rgba) {
748        $('.tab-content').attr('style', 'background-color:' + rgba + ';');
749      } else {
750        $('.tab-content').removeAttr('style');
751      }
752    } else {
753      $('.tab-content').removeAttr('style');
754    }
755  }
756
757  $('button.nav-link[data-toggle="pill"]').on('shown.bs.tab', function () {
758    updateTabContentBackground($(this));
759  });
760
761  $('.main-menu .nav.nav-pills').each(function() {
762    if ($(this).find('.nav-link').length < 6) {
763      $(this).addClass('one-column');
764    } else {
765      $(this).removeClass('one-column');
766    }
767  });
768});
769
770$(document).on('click', function(e) {
771  if (!$(e.target).closest('.main-header').length) {
772    $('.main-menu .main-menu-link').removeClass('active');
773    $('body').removeClass('menu-open');
774  }
775});
776
777$(document).on('click', '.mobile-menu .menu-link.has-children', function(e){
778  e.preventDefault();
779  $(this).closest('.menu-item').next('.mobile-submenu').addClass('active');
780});
781$(document).on('click', '.mobile-menu .back-button', function(e){
782  e.preventDefault();
783  $(this).closest('.mobile-submenu').removeClass('active');
784});
785$
786$(document).on('mouseenter', '.main-menu-link > a:not(.btn)', function () {
787  $(this).closest('.main-menu-link').addClass('hover');
788});
789$(document).on('mouseleave', '.main-menu-link > a:not(.btn)', function () {
790  $(this).closest('.main-menu-link').removeClass('hover');
791});
792$(document).on('click', '.mobile-menu .main-btn', function () {
793  $('#menu_popup').modal('hide')
794});
795
796
797
798
799// function formatPhone(text) {
800//   const digits = text.replace(/\D/g, '');
801//   if (digits.length === 12 && digits.startsWith('380')) {
802//     const short = digits.slice(2);
803//     return short.replace(/(\d{3})(\d{3})(\d{2})(\d{2})/, '$1 $2 $3 $4');
804//   }
805//   return text;
806// }
807// const observer = new MutationObserver((mutations) => {
808//   mutations.forEach(({ target }) => {
809//     if (target.classList.contains('ph-phone1')) {
810//       const formatted = formatPhone(target.textContent);
811//       if (formatted !== target.textContent) {
812//         target.textContent = formatted;
813//       }
814//     }
815//   });
816// });
817// observer.observe(document.body, {
818//   childList: true,
819//   subtree: true,
820//   characterData: true
821// });
822
823function applySendPulseCustomStyles() {
824  const spContainer = document.querySelector('sp-popups');
825  
826  if (spContainer && spContainer.shadowRoot) {
827    if (!spContainer.shadowRoot.querySelector('#custom-sp-styles')) {
828      const styleTag = document.createElement('style');
829      styleTag.id = 'custom-sp-styles';
830      styleTag.textContent = `
831        .sp-popup-widget-messenger.messenger-shadow:after {
832          bottom: -40px !important;
833          right: calc(-53.33333333 / 1920 * 100vw) !important;
834        }
835        .sp-popup-widget-messenger {
836          bottom: 3% !important;
837          padding-bottom: 21px !important;
838          right: calc(53.33333333 / 1920 * 100vw) !important;
839        }
840        .messenger-cloud {
841          margin-bottom: 21px !important;
842        }
843        @media (max-width: 480px) {
844          .sp-popup-widget-messenger {
845            padding-bottom: 11px !important;
846            right: calc(20 / 375 * 100vw) !important;
847          }
848          .sp-popup-widget-messenger.messenger-shadow:after {
849            right: calc(-20 / 375 * 100vw) !important;
850          }
851          .messenger-cloud {
852            margin-bottom: 11px !important;
853          }
854        }
855      `;
856      spContainer.shadowRoot.appendChild(styleTag);
857    }
858  }
859}
860const spObserver = new MutationObserver(function() {
861  applySendPulseCustomStyles();
862});
863spObserver.observe(document.body, { childList: true, subtree: true });

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.