PageSourceSearch

https://nlb.by/local/templates/.default/assets/js/common.js?176821675574042

js nlb.by collected 2026-10-02 04:15:37 UTC 74,042 bytes, 2,352 lines download raw bytes

1var windowWidth = window.innerWidth,
2    windowHeight = window.innerHeight,
3    mobile = false,
4    desktop = true,
5    opera12 = false,
6    apple = false,
7    loaded = false,
8    ie = 0,
9
10    scrolltop = 0;
11
12
13function isMobile() {
14    var check = false;
15    (function (a) {
16        if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true;
17    })(navigator.userAgent || navigator.vendor || window.opera);
18    return check;
19}
20
21function isTablet() {
22    return (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
23}
24
25function isApple() {
26    return (/iphone|ipad|ipod/i.test(navigator.userAgent.toLowerCase()));
27}
28
29function isAndroid() {
30    return (/android/i.test(navigator.userAgent.toLowerCase()));
31}
32
33function isOpera12() {
34    if (navigator.userAgent.indexOf('Opera') !== -1 && navigator.userAgent.indexOf('OPR/') === -1) {
35        var version = navigator.userAgent.substring(navigator.userAgent.indexOf('Version/') + 8);
36        if (version.indexOf('12.') !== false) return true;
37        return false;
38    }
39    return false;
40}
41
42function isIE() {
43    var myNav = navigator.userAgent.toLowerCase();
44    return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : false;
45}
46
47
48mobile = isMobile();
49tablet = isTablet();
50desktop = (isMobile() || isTablet()) ? false : true;
51apple = isApple();
52opera12 = isOpera12();
53ie = isIE();
54
55windowWidth = window.innerWidth ? window.innerWidth : $(window).width();
56windowHeight = window.innerHeight ? window.innerHeight : $(window).height();
57
58if (desktop === false) {
59    $('body').removeClass('desktop');
60    $('body').addClass('device');
61}
62
63if (opera12 === true) {
64    $('body').addClass('opera12');
65}
66
67if (isAndroid()) {
68    $('body').addClass('android');
69}
70
71if (apple === true) {
72    $('body').addClass('apple');
73}
74
75if (desktop === true) {
76    $('body').addClass('desktop');
77}
78
79if (tablet === true && mobile === false) {
80    $('body').addClass('tablet');
81}
82
83if (mobile === true) {
84    $('body').addClass('mobile');
85}
86
87if (ie !== false) {
88    $('body').addClass('ie');
89}
90
91if (ie !== false && ie <= 9) {
92    $('body').addClass('ie9');
93}
94
95if (ie !== false && ie === 10) {
96    $('body').addClass('ie10');
97}
98
99$(window).scroll(function () {
100    scrolltop = $(window).scrollTop();
101
102    if (scrolltop > 150) {
103        $('#gotop').fadeIn();
104    } else {
105        $('#gotop').fadeOut();
106    }
107});
108
109function resizeHandler() {
110    windowWidth = (document.documentElement.clientWidth) ? document.documentElement.clientWidth : $(window).width();
111    windowHeight = (document.documentElement.clientHeight) ? document.documentElement.clientHeight : $(window).height();
112}
113
114$(window).resize(function () {
115    resizeHandler();
116});
117
118
119if (desktop === false) {
120    window.addEventListener("orientationchange", function () {
121        resizeHandler();
122    });
123}
124
125window.onload = function () {
126
127    // if (ie === 9) {
128    // 	var ieflex = document.querySelectorAll('.flex-row');
129
130    // 	$.each(ieflex, function(index, val) {
131    // 		flexibility(val);
132    // 	});
133    // }
134
135}
136
137var siteLang;
138
139$(document).ready(function () {
140
141    siteLang = $('head').attr('lang');
142
143    langCurrent();
144
145    if ($('.js-l-pub').length > 0) {
146        pubLayout();
147    }
148
149    if ($('.l-infoblock').length > 0) {
150        infoLayout();
151    }
152
153    if ($('.sitemap__list').length > 0 || $('.js-sitemap').length > 0) {
154        siteMapLayout();
155    }
156
157    $('.logo').addClass('svg-logo--open');
158
159    if ($('.input').length > 0) {
160        inputEffect();
161    }
162
163    asideShareLinks();
164
165    if ($('.js-years-list').length > 0) {
166        yearsList();
167    }
168
169    if ($('.flatpickr').length > 0) {
170        datePicker();
171    }
172
173    if ($('.js-attention').length > 0) {
174        jsAttention();
175    }
176
177    if ($('.article__content').length > 0) {
178        articleGallery();
179    }
180
181    $('.video-link').lightGallery({
182        selector: 'this',
183        thumbnail: false,
184        autoplay: false,
185        controls: true,
186        download: false,
187        counter: false,
188        hash: false,
189        share: false,
190        zoom: false,
191        fullScreen: false,
192        videoMaxWidth: '90%'
193    });
194
195    if ($('.js-reg-form').length > 0) {
196        regFormInit()
197    }
198
199    if ($('.js-form').length > 0) {
200        jsForm()
201    }
202
203
204    // if (ie < 12) {
205    // 	objectFitImages('img', {watchMQ: true});
206    // }
207
208
209    $(function () {
210        $('iframe[src*="youtube"]').parent().fitVids();
211    });
212
213    if ($('.js-show-comments').length > 0) {
214        $('.js-show-comments').on('click', function (event) {
215            event.preventDefault();
216            $(this).next().slideToggle(200);
217        });
218    }
219
220    if ($('.context-search').length > 0) {
221        var elem = $('.context-search');
222        $.each(elem, function (index, val) {
223            formReset(val);
224        });
225
226    }
227
228    $('#gotop').on('click', function (event) {
229        event.preventDefault();
230        $.scrollTo(0, 800);
231    });
232
233    $('.mobmenu select').on('change', function (event) {
234        event.preventDefault();
235        var href = $(this).val();
236        window.location.href = href;
237    });
238
239    $('.usercontent table').wrap('<div class="table-wrap"></div>');
240
241    if ($('.input-date').length > 0) {
242        var cleave = new Cleave('.input-date', {
243            delimiter: '.',
244            date: true,
245            datePattern: ['d', 'm', 'Y']
246        });
247    }
248    if ($('[data-mask="phone"]').length > 0) {
249        // $.inputmask('\+375 (99) 999−99−99', {placeholder: "\+375 (__) ___−__−__"});
250
251        var cleave1 = new Cleave('[data-mask="phone"]', {
252            delimiters: [" ", '-'],
253            blocks: [2, 3, 2, 2]
254        });
255    }
256
257    if ($('.select').length) {
258        $('.select select').selectize({
259            onInitialize: function () {
260
261                var check = $(this)[0].$input[0].firstChild.value;
262
263                if (check !== '') {
264                    $(this)[0].$wrapper.addClass('has-content');
265                }
266            },
267            onChange: function () {
268                $(this)[0].$wrapper.addClass('has-content');
269            }
270        });
271    }
272
273    Parsley.addMessages('ru', {
274        defaultMessage: "Некорректное значение.",
275        type: {
276            email: "Введите адрес электронной почты.",
277            url: "Введите URL адрес.",
278            number: "Введите число.",
279            integer: "Введите целое число.",
280            digits: "Введите только цифры.",
281            alphanum: "Введите буквенно-цифровое значение."
282        },
283        notblank: "Заполните поле.",
284        required: "Обязательное поле.",
285        pattern: "Это значение некорректно.",
286        min: "Это значение должно быть не менее чем %s.",
287        max: "Это значение должно быть не более чем %s.",
288        range: "Это значение должно быть от %s до %s.",
289        minlength: "Это значение должно содержать не менее %s символов.",
290        maxlength: "Это значение должно содержать не более %s символов.",
291        length: "Это значение должно содержать от %s до %s символов.",
292        mincheck: "Выберите не менее %s значений.",
293        maxcheck: "Выберите не более %s значений.",
294        check: "Выберите от %s до %s значений.",
295        equalto: "Это значение должно совпадать.",
296        dateiso: "Это значение должно быть корректной датой (ГГГГ-ММ-ДД).",
297        minwords: "Это значение должно содержать не менее %s слов.",
298        maxwords: "Это значение должно содержать не более %s слов.",
299        words: "Это значение должно содержать от %s до %s слов.",
300        gt: "Это значение должно быть больше.",
301        gte: "Это значение должно быть больше или равно.",
302        lt: "Это значение должно быть меньше.",
303        lte: "Это значение должно быть меньше или равно.",
304        notequalto: "Это значение должно отличаться."
305    });
306
307    Parsley.addMessages('by', {
308        defaultMessage: "Некарэктнае значэнне.",
309        type: {
310            email: "Калi ласка, увядзіце адрас email.",
311            url: "Увядзіце URL адрас.",
312            number: "Увядзіце лік.",
313            integer: "Увядзіце цэлы лік.",
314            digits: "Увядзіце толькі лічбы.",
315            alphanum: "Увядзіце літарна-лічбавае значэнне."
316        },
317        notblank: "Запоўніце поле.",
318        required: "Абавязковае поле.",
319        pattern: "Гэта значэнне некарэктна.",
320        min: "Гэта значэнне павінна быць не менш за %s.",
321        max: "Гэта значэнне павінна быць не больш за %s.",
322        range: "Гэта значэнне павінна быць ад %s да %s.",
323        minlength: "Гэта значэнне павінна змяшчаць не менш за %s знакаў.",
324        maxlength: "Гэта значэнне павінна быць ня болей за %s знакаў.",
325        length: "Гэта значэнне павінна ўтрымліваць ад %s да %s знакаў.",
326        mincheck: "Абярыце не менш% s значэнняў.",
327        maxcheck: "Абярыце не больш% s значэнняў.",
328        check: "Абярыце ад% s да% s значэнняў.",
329        equalto: "Гэта значэнне павінна супадаць.",
330        dateiso: "Гэта значэнне павінна быць карэктнай датай (ГГГГ-ММ-ДД).",
331        minwords: "Гэта значэнне павінна змяшчаць не менш за %s слоў.",
332        maxwords: "Гэта значэнне павінна быць ня болей за %s слоў.",
333        words: "Гэта значэнне павінна ўтрымліваць ад %s да %s слоў.",
334        gt: "Гэта значэнне павінна быць больш.",
335        gte: "Гэта значэнне павінна быць больш або роўна.",
336        lt: "Гэта значэнне павінна быць менш.",
337        lte: "Гэта значэнне павінна быць менш або роўна.",
338        notequalto: "Гэта значэнне павінна адрознівацца."
339    });
340
341    Parsley.setLocale(siteLang);
342
343});
344
345
346if ($('.l-service').length > 0) {
347    (function () {
348
349        var visible = false;
350
351        $('.service__expand').on('click', function (event) {
352            event.preventDefault();
353
354            if (visible === false) {
355                $('.service-hidden').css({
356                    'display': '',
357                    opacity: '1'
358                });
359                visible = true;
360
361            } else {
362
363                $('.service-hidden').css({
364                    'display': 'none',
365                    opacity: '0'
366                });
367                visible = false;
368
369            }
370
371            $(this).toggleClass('service__expand--true');
372        });
373    }());
374}
375
376
377var $pubGrid;
378
379var pubLayout = function () {
380
381    var $pub = $('.js-l-pub'),
382        $pubHead = $('.tabs__header', $pub),
383        $pubFooter = $('.tab__footer', $pub);
384
385    $pubGrid = $('.tab__content', $pub);
386
387    $pubGrid.isotope({
388        itemSelector: '.pub-item',
389        // stamp: '.pub-item-super',
390        // transitionDuration: 200,
391        // stagger: 30,
392        transitionDuration: 0,
393        stagger: 0,
394        masonry: {
395            gutter: 40
396        }
397    });
398
399    if ($('.js-pub-tabs', $pub).length > 0) {
400        var $tab = $('.js-pub-tabs', $pub).find('li').eq(0),
401            $type = $tab.children('a').attr('href');
402
403        $tab.addClass('active');
404
405        $pubHead.find('.link-all').hide();
406        $pubFooter.find('.button-loadmore').hide();
407        $pubHead.find($type).show();
408        $pubFooter.find($type).show();
409
410        $pubGrid.isotope({filter: $type});
411
412
413    }
414
415    $('.js-pub-tabs').on('click', 'a', function (event) {
416        event.preventDefault();
417        var el = $(this),
418            num = el.attr('href');
419
420        el.parent().addClass('active').siblings().removeClass('active');
421        $pubGrid.isotope({filter: num});
422
423        $pubHead.find('.link-all').hide();
424        $pubFooter.find('.button-loadmore').hide();
425        $pubHead.find(num).show();
426        $pubFooter.find(num).show();
427    });
428
429    $('.js-news-loadmore').on('click', function (event) {
430        event.preventDefault();
431
432        $.ajax({
433            url: 'ajax-pub-data.html',
434            type: 'get',
435        })
436            .success(function (result) {
437                var _data = $(result);
438                $pubGrid.isotope('insert', _data);
439            })
440            .fail(function () {
441                console.error("error");
442            });
443    });
444
445    $(window).on("debouncedresize", function (event) {
446        setTimeout(function () {
447            $pubGrid.isotope('layout');
448        }, 500);
449    });
450
451    $pubGrid.imagesLoaded(function () {
452        // console.log('pubGrid imagesLoaded');
453        $pubGrid.isotope('layout');
454    });
455
456};
457
458
459var infoLayout = function () {
460
461    //универсализировать
462
463    var $stage1 = $('.js-infoblock-1 .tab__content');
464    var $tabs1 = $('.js-tabs-1');
465
466    $stage1.isotope({
467        itemSelector: '.tab-item',
468        transitionDuration: 0,
469        // stagger: 30,
470        stagger: 0,
471        masonry: {
472            gutter: 40
473        }
474    });
475
476    $tabs1.on('click', 'a', function (event) {
477        event.preventDefault();
478        var el = $(this),
479            num = el.attr('href');
480
481        el.parent().addClass('active').siblings().removeClass('active');
482        $stage1.isotope({filter: num});
483    });
484
485    $tabs1.find('li').eq(0).find('a').click();
486
487
488    var $stage2 = $('.js-infoblock-2 .tab__content');
489    var $tabs2 = $('.js-tabs-2');
490
491    $stage2.isotope({
492        itemSelector: '.tab-item',
493        transitionDuration: 200,
494        stagger: 30,
495        masonry: {
496            gutter: 40
497        }
498    });
499
500    $tabs2.on('click', 'a', function (event) {
501        event.preventDefault();
502        var el = $(this),
503            num = el.attr('href');
504
505        el.parent().addClass('active').siblings().removeClass('active');
506        $stage2.isotope({filter: num});
507    });
508
509    $tabs2.find('li').eq(0).find('a').click();
510
511
512    $(window).on("debouncedresize", function (event) {
513        setTimeout(function () {
514            $stage1.isotope('layout');
515            $stage2.isotope('layout');
516        }, 500);
517    });
518
519
520};
521
522
523var siteMapLayout = function () {
524
525    var $grid = $('.sitemap__list');
526
527    $grid.isotope({
528        itemSelector: '.sitemap__block',
529        transitionDuration: 0,
530        masonry: {
531            gutter: 40,
532            columnWidth: '.sitemap__block--sizer'
533        }
534    });
535
536    var container = $('.js-sitemap');
537
538    TweenMax.set(container, {
539        x: '-100%',
540        opacity: 0
541    });
542
543 // Определяем главную страницу в зависимости от текущего языка
544function getHomePageUrl() {
545    const lang = $('html').attr('lang'); // Получаем lang из <html lang="...">
546    if (lang === 'by') return '/by/';
547    if (lang === 'en') return '/en/';
548    return '/'; // по умолчанию — русская версия
549}
550
551$(document).off('click', '.js-sitemap-show');
552$(document).on('click', '.js-sitemap-show', function (event) {
553    event.preventDefault();
554
555    const container = $('.js-sitemap');
556    const body = $('body');
557
558    if (body.hasClass('scrollbar-is-hidden')) {
559        // Карта открыта → закрываем её (без перехода!)
560        TweenMax.to(container, 0.25, {
561            opacity: 0,
562            onComplete: function () {
563                TweenMax.set(container, { x: '-100%' });
564                body.removeClass('scrollbar-is-hidden');
565            }
566        });
567    } else {
568        // Карта закрыта → открываем
569        TweenMax.set(container, { x: '0%' });
570        TweenMax.to(container, 0.25, {
571            opacity: 1,
572            onComplete: function () {
573                body.addClass('scrollbar-is-hidden');
574                const $grid = $('.sitemap__list');
575                if ($grid.length) {
576                    $grid.isotope('reloadItems');
577                }
578            }
579        });
580    }
581});
582
583    $('.js-sitemap-hide').on('click', function (event) {
584        event.preventDefault();
585
586        TweenMax.to(container, 0.25, {
587            opacity: 0,
588            onComplete: function () {
589                TweenMax.set(container, {
590                    x: '-100%',
591                    onComplete: function () {
592                        $('body').removeClass('scrollbar-is-hidden');
593                    }
594                });
595            }
596        });
597    });
598
599    $('.sidemap__expand').on('click', function (event) {
600        event.preventDefault();
601        var parent = $(this).parent('header');
602        var submenu = parent.next();
603
604        parent.toggleClass('sitemap--expanded');
605        submenu.slideToggle(200);
606    });
607};
608
609
610if ($('.promo__slider').length > 0) {
611
612    $(function () {
613
614        var slider = $('.promo__slider .owl-carousel');
615
616        var options;
617
618        if (ie !== false && ie < 10) {
619            console.log('ie < 10');
620            options = {
621                items: 1,
622                nav: true,
623                dots: true,
624				autoplay: true,
625				autoplayTimeout: 8000,
626				autoplayHoverPause: true,
627				loop: true,
628                mouseDrag: false,
629                pullDrag: false,
630                freeDrag: false,
631                autoHeight: true,
632                lazyLoad: false,
633                stageElement: 'ul',
634                itemElement: 'li',
635                navText: ['', '']
636            }
637        } else {
638            // console.log('okay');
639            options = {
640                items: 1,
641                nav: true,
642                dots: true,
643				autoplay: true,
644				autoplayTimeout: 8000,
645				autoplayHoverPause: true,
646				loop: true,
647                autoHeight: true,
648                lazyLoad: true,
649                stageElement: 'ul',
650                itemElement: 'li',
651                navText: ['', '']
652            }
653        }
654
655        slider.owlCarousel(options);
656
657    }());
658
659}
660
661
662if ($('.pub-accent-slider').length > 0) {
663
664    $(function () {
665
666        var slider = $('.pub-accent-slider .owl-carousel');
667
668        var options;
669
670        if (ie !== false && ie < 10) {
671            console.log('ie < 10');
672            options = {
673                items: 1,
674                nav: true,
675                dots: true,
676                mouseDrag: false,
677                pullDrag: false,
678                freeDrag: false,
679                autoHeight: true,
680                lazyLoad: false,
681                stageElement: 'ul',
682                itemElement: 'li',
683                navText: ['', '']
684            }
685        } else {
686            // console.log('okay');
687            options = {
688                items: 1,
689                nav: true,
690                dots: true,
691                autoHeight: true,
692                lazyLoad: true,
693                stageElement: 'ul',
694                itemElement: 'li',
695                navText: ['', '']
696            }
697        }
698
699        slider.owlCarousel(options);
700
701    }());
702
703}
704
705
706if ($('.p-list').length > 0) {
707
708    $('.p-list .owl-carousel').owlCarousel({
709        items: 5,
710        slideBy: 5,
711        nav: true,
712        navText: [
713            '<svg class="owl-svg" enable-background="new 0 0 32 32" height="32px" version="1.1" viewBox="0 0 32 32" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path clip-rule="evenodd" d="M11.262,16.714l9.002,8.999  c0.395,0.394,1.035,0.394,1.431,0c0.395-0.394,0.395-1.034,0-1.428L13.407,16l8.287-8.285c0.395-0.394,0.395-1.034,0-1.429  c-0.395-0.394-1.036-0.394-1.431,0l
713-9.002,8.999C10.872,15.675,10.872,16.325,11.262,16.714z" fill="#000" fill-rule="evenodd"/></svg>',
714            '<svg class="owl-svg" enable-background="new 0 0 32 32" height="32px" version="1.1" viewBox="0 0 32 32" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path clip-rule="evenodd" d="M21.698,15.286l-9.002-8.999  c-0.395-0.394-1.035-0.394-1.431,0c-0.395,0.394-0.395,1.034,0,1.428L19.553,16l-8.287,8.285c-0.395,0.394-0.395,1.034,0,1.429  c0.395,0.394,1.036,0.394,1.431,0l9.002-8.999C22.088,16.325,22.088,15.675,21.698,15.286z" fill="#000" fill-rule="evenodd"/></svg>'
715        ],
716        responsive: {
717            0: {
718                items: 1,
719                slideBy: 1
720            },
721            540: {
722                items: 2,
723                slideBy: 2
724            },
725            767: {
726                items: 3,
727                slideBy: 3
728            },
729            1024: {
730                items: 4,
731                slideBy: 4
732            },
733            1280: {
734                items: 5,
735                slideBy: 5
736            },
737        }
738    });
739
740}
741
742
743if ($('.b-calend').length > 0) {
744
745    var $c_head = $('.calend__header .owl-carousel'),
746        $c_text = $('.calend__content');
747
748    $c_head.owlCarousel({
749        itemElement: 'div',
750        items: 1,
751        nav: true,
752        mouseDrag: false,
753        touchDrag: false,
754        pullDrag: false,
755        navText: [
756            '<svg class="owl-svg" enable-background="new 0 0 32 32" height="32px" version="1.1" viewBox="0 0 32 32" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path clip-rule="evenodd" d="M11.262,16.714l9.002,8.999  c0.395,0.394,1.035,0.394,1.431,0c0.395-0.394,0.395-1.034,0-1.428L13.407,16l8.287-8.285c0.395-0.394,0.395-1.034,0-1.429  c-0.395-0.394-1.036-0.394-1.431,0l-9.002,8.999C10.872,15.675,10.872,16.325,11.262,16.714z" fill="#000" fill-rule="evenodd"/></svg>',
757            '<svg class="owl-svg" enable-background="new 0 0 32 32" height="32px" version="1.1" viewBox="0 0 32 32" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path clip-rule="evenodd" d="M21.698,15.286l-9.002-8.999  c-0.395-0.394-1.035-0.394-1.431,0c-0.395,0.394-0.395,1.034,0,1.428L19.553,16l-8.287,8.285c-0.395,0.394-0.395,1.034,0,1.429  c0.395,0.394,1.036,0.394,1.431,0l9.002-8.999C22.088,16.325,22.088,15.675,21.698,15.286z" fill="#000" fill-rule="evenodd"/></svg>'
758        ]
759    });
760
761    $c_text.owlCarousel({
762        items: 1,
763        nav: false,
764        margin: 20,
765        mouseDrag: false,
766        touchDrag: false,
767        pullDrag: false,
768        autoHeight: true
769    });
770
771    $('.calend__header .owl-next').on('click', function (event) {
772        $c_text.trigger('next.owl.carousel');
773    });
774
775    $('.calend__header .owl-prev').on('click', function (event) {
776        $c_text.trigger('prev.owl.carousel');
777    });
778
779}
780
781
782if ($('.slider-extra').length > 0) {
783
784    (function () {
785
786        var $extra = $('.slider-extra');
787
788        $extra.owlCarousel({
789            items: 3,
790            slideBy: 3,
791            nav: true,
792            mouseDrag: true,
793            touchDrag: true,
794            pullDrag: true,
795            navContainer: '.box__footer--nav',
796            dotsContainer: '.box__footer--dots',
797            navText: [
798                '<svg class="owl-svg" enable-background="new 0 0 32 32" height="32px" version="1.1" viewBox="0 0 32 32" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path clip-rule="evenodd" d="M11.262,16.714l9.002,8.999  c0.395,0.394,1.035,0.394,1.431,0c0.395-0.394,0.395-1.034,0-1.428L13.407,16l8.287-8.285c0.395-0.394,0.395-1.034,0-1.429  c-0.395-0.394-1.036-0.394-1.431,0l-9.002,8.999C10.872,15.675,10.872,16.325,11.262,16.714z" fill="#000" fill-rule="evenodd"/></svg>',
799                '<svg class="owl-svg" enable-background="new 0 0 32 32" height="32px" version="1.1" viewBox="0 0 32 32" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path clip-rule="evenodd" d="M21.698,15.286l-9.002-8.999  c-0.395-0.394-1.035-0.394-1.431,0c-0.395,0.394-0.395,1.034,0,1.428L19.553,16l-8.287,8.285c-0.395,0.394-0.395,1.034,0,1.429  c0.395,0.394,1.036,0.394,1.431,0l9.002-8.999C22.088,16.325,22.088,15.675,21.698,15.286z" fill="#000" fill-rule="evenodd"/></svg>'
800            ],
801            responsive: {
802                320: {
803                    items: 1,
804                    slideBy: 1
805                },
806                767: {
807                    items: 2,
808                    slideBy: 2
809                },
810                991: {
811                    items: 3,
812                    slideBy: 3
813                }
814            }
815        });
816
817        $('.slider-extra--next').on('click', function (event) {
818            $extra.trigger('next.owl.carousel');
819        });
820
821        $('.slider-extra--prev').on('click', function (event) {
822            $extra.trigger('prev.owl.carousel');
823        });
824
825    }());
826
827
828}
829
830
831if ($('.l-faq').length > 0) {
832    (function () {
833
834        var el;
835
836        $('.faq-q').on('click', function (event) {
837            event.preventDefault();
838            el = $(this);
839            // el.toggleClass('active');
840            el.next().slideToggle(200);
841        });
842
843    }());
844}
845
846$('.popup').on('click', function (event) {
847    event.stopPropagation();
848});
849
850$('.js-popup-show').on('click', function (event) {
851    event.preventDefault();
852    var _this = $(this),
853        _url = _this.attr('href'),
854        _width = _this.data('width');
855
856    Popup.open(_url, _width);
857});
858
859var Popup = {
860
861    open: function (url, width) {
862
863        popupTemplate(url);
864
865        $('.js-popup').fadeIn(100);
866
867        $('body').addClass('popup-is-visible');
868
869        popupEvents();
870
871        if (width !== undefined) {
872            $('.popup').css('max-width', width);
873        }
874
875    },
876
877    hide: function () {
878
879        $('.js-popup').fadeOut(100, function () {
880            $('.js-popup-content').html('');
881            $('.js-popup .popup-tabs').remove();
882            $('.js-popup .popup-title').remove();
883            $('.popup').removeAttr('style');
884        });
885
886        $('body').removeClass('popup-is-visible');
887    }
888};
889
890var popupTemplate = function (name) {
891
892    if (name.length > 0) {
893        $(name).tmpl().appendTo('.js-popup-content');
894    } else {
895        console.log('Не указано имя попап-шаблона на ссылке');
896    }
897
898    if ($('.js-popup-content .popup-title').length > 0) {
899        var popUpTitle = $('.js-popup-content .popup-title');
900        popUpTitle.remove();
901        popUpTitle.appendTo('.popup-header');
902    }
903
904};
905
906var popupEvents = function () {
907
908    $('.js-popup-hide').on('click', function (event) {
909        event.preventDefault();
910        Popup.hide();
911    });
912
913    $('.js-popup-content input').checkAndTriggerAutoFillEvent();
914
915    inputEffect();
916
917    if ($('.js-login-form').length > 0) {
918
919        var $loginForm = $('.js-login-form');
920
921        $loginForm.parsley({
922            minlength: 1,
923            trigger: 'keypress',
924            errorClass: 'input__error',
925            successClass: 'input__success',
926            errorsWrapper: '<span class="input__note note__error color--red"></span>',
927            errorTemplate: '<span></span>'
928        });
929
930        Parsley.setLocale(siteLang);
931
932        $('.js-button-login').on('click', function (event) {
933            event.preventDefault();
934
935            if ($loginForm.parsley().validate()) {
936
937                console.log('valid');
938
939                $loginForm.ajaxForm({
940
941                    //data: {web_form_apply: 'Y'},
942
943                    beforeSubmit: function (formData, jqForm, options) {
944
945                        console.log('beforeSubmit');
946
947                        $loginForm.addClass('form-busy');
948
949                        var queryString = $.param(formData);
950
951                        console.log(queryString);
952
953                        return true;
954                    },
955
956                    success: function (statusText, responseText) {
957
958                        if ($.trim(statusText) === 'false') {
959
960                            $loginForm.removeClass('form-busy');
961
962                            $('.msg--login-form-error').show();
963
964                            return false;
965
966                        }
967
968                        window.location.reload();
969
970                    }
971                });
972
973                $loginForm.submit();
974
975            }
976        });
977
978    }
979};
980
981
982if ($('#map-container').length) {
983
984    ymaps.ready(init);
985
986    var myMap,
987        myCollection,
988        myPlacemark;
989
990    myPlacemark = [];
991
992    function init() {
993        myMap = new ymaps.Map("map-container", {
994            center: [53.92371562293391, 27.512945709636973],
995            zoom: 16,
996            controls: []
997        });
998
999        myMap.controls.add('zoomControl', {position: {right: '40px', top: '50px'}});
1000        myMap.behaviors.disable('scrollZoom');
1001
1002        myCollection = new ymaps.GeoObjectCollection();
1003
1004        myPlacemark = new ymaps.Placemark([53.92371562293391, 27.512945709636973], {
1005            hintContent: 'Национальная Библиотека',
1006            balloonContent: 'Пр. Независимости'
1007        }, {
1008            iconLayout: 'default#image',
1009            iconImageHref: 'i/map-label.png',
1010            iconImageSize: [90, 80],
1011            iconImageOffset: [-26, -80]
1012        });
1013
1014        myCollection.add(myPlacemark);
1015        myMap.geoObjects.add(myCollection);
1016
1017
1018    }
1019
1020}
1021
1022
1023if ($('.sidemenu').length > 0) {
1024
1025    var el,
1026        pos = 0,
1027        submenu = $('.submenu');
1028
1029    $('.sidemenu li').on('mouseover', function () {
1030
1031        el = $(this);
1032
1033        submenu = $('.submenu:visible');
1034
1035        if (el.position().top > submenu.height()) {
1036            submenu.css('top', el.position().top - submenu.height() / 2);
1037        }
1038
1039    });
1040}
1041
1042var Regform = {
1043
1044    userCheck: function (xhr) {
1045
1046        var data = JSON.parse(xhr.responseText);
1047
1048        // console.log('userCheck: ' + !data.error);
1049
1050        return !data.error;
1051    },
1052
1053    checkCardNumber: function (xhr) {
1054
1055        var data = JSON.parse(xhr.responseText);
1056
1057        if (!data.error) {
1058
1059            var $form_section = $('.js-additional');
1060
1061            $.each(data.card, function (i, value) {
1062
1063                console.info(i, value);
1064
1065                var $input = $form_section.find(
1066                    'input[name="REGISTER[' + i + ']"], ' +
1067                    'select[name="REGISTER[' + i + ']"], ' +
1068                    'select[name="' + i + '"], ' +
1069                    'input[name="' + i + '"]'
1070                );
1071
1072                var type = $input.prop('type');
1073
1074                console.info(type);
1075
1076                switch (type) {
1077                    case 'select-one':
1078                        $input.find('option:selected').attr('selected', false);
1079                        $input.find('option[value="' + value + '"]').attr('selected', true);
1080                        break;
1081                    case 'radio':
1082                    case 'checkbox':
1083                        $input.each(function (j, element) {
1084                            var $element = $(element);
1085                            $element.attr('checked', $element.val() == value);
1086                        });
1087                        break;
1088                    default:
1089                    case 'text':
1090                        $input.val(value);
1091                        $input.addClass('has-content');
1092                        break;
1093                }
1094                $input.trigger('change');
1095            });
1096
1097        } else {
1098            this.$element.parsley().removeError('error', {updateClass: true});
1099
1100            // console.log(data.error_message.length > 0 === true);
1101
1102            if (data.error_message) {
1103
1104                this.$element.parsley().addError('error', {message: ' ' + data.error_message, updateClass: true});
1105            }
1106        }
1107
1108        console.log('checkCardNumber: ' + !data.error);
1109
1110        return !data.error;
1111    }
1112
1113};
1114
1115function addZero(digits_length, source) {
1116    var text = source + '';
1117    while (text.length < digits_length)
1118        text = '0' + text;
1119    return text;
1120}
1121
1122
1123function regFormInit() {
1124
1125    var $form = $('.js-reg-form'),
1126        $sections = $('.form-section', $form),
1127        $nav = $('.form-navigation', $form);
1128
1129	 var uf_lib_card_num = $form.find('input[name="UF_LIB_CARD_NUM"]');
1130	 var card_password = $form.find('input[name="card_password"]');
1131
1132	 uf_lib_card_num.on('input', function(event) {
1133		var required = this.value.length > 0;
1134		card_password.prop('required', required);
1135		if (!required) card_password.removeClass('input__error');
1136	 });
1137
1138    $form.parsley({
1139        trigger: 'input',
1140        errorClass: 'input__error',
1141        successClass: 'input__success',
1142        errorsWrapper: '<span class="input__note note__error color--red"></span>',
1143        errorTemplate: '<span></span>'
1144    });
1145
1146    Parsley.on('field:ajaxoptions', function (parsley, params) {
1147
1148        var inputs = this.$element.closest('.form-section').find('input
1148:not("' + this.$element.selector + '")');
1149
1150        inputs.each(function (i, item) {
1151            params.data[$(item).attr('name')] = $(item).val();
1152
1153            //Добавляем нули в читательский билет
1154            if ($(item).attr('name') === 'UF_LIB_CARD_NUM') {
1155                var text = $(item).val() + '';
1156                while (text.length < 8) {
1157                    text = '0' + text;
1158                }
1159
1160                params.data[$(item).attr('name')] = text;
1161            }
1162        });
1163    });
1164
1165    function navigateTo(index) {
1166        var atTheEnd = index >= $sections.length - 1;
1167
1168        $sections.removeClass('current').slideUp('200');
1169
1170        $sections.eq(index).addClass('current').slideDown('200', function () {
1171            if (index > 0) {
1172                $.scrollTo($('.js-reg-steps'), 400, {
1173                    offset: {
1174                        top: -30
1175                    }
1176                });
1177            }
1178        });
1179
1180        $nav.find('.js-reg-prev').toggle(index > 0);
1181
1182        $nav.find('.js-reg-next').toggle(!atTheEnd);
1183
1184        $nav.find('.js-reg-submit').toggle(atTheEnd);
1185        $('#consern_not_given').hide();
1186        $('.js-reg-steps').find('.step').removeClass('step--current').eq(index).addClass('step--current');
1187
1188        if ($('.form-section.current .has-content').length > 0) {
1189            $('.js-reg-form').parsley().whenValidate({group: 'block-' + curIndex()});
1190        }
1191    }
1192
1193    function curIndex() {
1194        return $sections.index($sections.filter('.current'));
1195    }
1196
1197    $nav.find('.js-reg-prev .button').on('click', function (event) {
1198        event.preventDefault();
1199
1200        navigateTo(curIndex() - 1);
1201    });
1202
1203    $nav.find('.js-reg-next .button').on('click', function (event) {
1204        event.preventDefault();
1205
1206        $('.js-reg-form').parsley().whenValidate({group: 'block-' + curIndex()}).done(function () {
1207            navigateTo(curIndex() + 1);
1208        });
1209
1210    });
1211
1212    //00261577
1213
1214    function goToRegisterEnd() {
1215        var url = window.location.href;
1216
1217        if (url.indexOf("?") > 0) {
1218            url = url.substring(0, url.indexOf("?"));
1219        }
1220
1221        url += "?registered=true";
1222        window.location.replace(url);
1223    }
1224
1225    $nav.find('.js-reg-submit #submit_button').on('click', function (event) {
1226        event.preventDefault();
1227
1228        var form = $('.js-reg-form');
1229
1230        var data = form.serialize() + '&finish=true&register_submit_button=true';
1231
1232        var action = form.attr('action');
1233
1234        var captcha_sid = $('.form-section.current input[name="captcha_sid"]');
1235
1236        var captcha_img = captcha_sid.prev();
1237
1238        var captcha_input = $('input[name="captcha_word"]');
1239
1240        // var captcha_input = $('.form-section.current input[name="captcha_word"]');
1241
1242        if ($('.js-reg-form').parsley().validate({group: 'block-' + curIndex()})) {
1243
1244            if (captcha_input) {
1245                captcha_input.parsley()?.removeError('wrong_captcha');
1246            }
1247            let agree_reg = $('#AGREE_REG')[0].checked;
1248            console.log(agree_reg);
1249            if(!agree_reg){
1250                $('#consern_not_given').show();
1251            }else{
1252                $('#consern_not_given').hide();
1253
1254                $nav.find('.reg-submit-button-wrap').addClass('sending');
1255
1256                showLoadingModal();
1257
1258                $.post(action, data, function (data, textStatus, xhr) {
1259                    console.log('postdata', data);
1260
1261                    var json;
1262
1263                    try {
1264                        json = jQuery.parseJSON(data);
1265                    } catch (e) {
1266                        hideLoadingModal();
1267                        goToRegisterEnd();
1268                        return;
1269                    }
1270
1271                    if (!json.success) {
1272                        console.log('json', json);
1273                        console.log('json errors', json.errors);
1274
1275
1276                        if (json.captcha) {
1277                            captcha_sid.val(json.captcha.sid);
1278                            captcha_img.attr('src', json.captcha.src);
1279                        }
1280
1281                        if (captcha_input) {
1282                            captcha_input.val('');
1283                            captcha_input.parsley()?.addError('wrong_captcha', {message: "Неверные символы"});
1284                        }
1285
1286                        showErrorModal(json.errors);
1287                        $nav.find('.reg-submit-button-wrap').removeClass('sending');
1288                    } else {
1289                        hideLoadingModal();
1290                        goToRegisterEnd();
1291                    }
1292                }).fail(function(xhr, status, error) {
1293                    console.error('Ошибка запроса:', error);
1294                    showErrorModal({'Ошибка': 'Произошла ошибка при отправке формы.<br>Попробуйте позже либо обратитесь в службу поддержки по email: webmaster@
1294nlb.by или телефону (8 017) 293 25 21.'});
1295                    $nav.find('.reg-submit-button-wrap').removeClass('sending');
1296                });
1297            }
1298        }
1299
1300    });
1301
1302    $.each($sections, function (index, section) {
1303        $(section).find(':input').attr('data-parsley-group', 'block-' + index);
1304    });
1305
1306    Parsley.addAsyncValidator('loginAvailable', Regform.userCheck);
1307    Parsley.addAsyncValidator('checkCardNumber', Regform.checkCardNumber);
1308
1309    navigateTo(0);
1310    $('.form-navigation').show();
1311}
1312
1313function showErrorModal(errors) {
1314    let errorsHtml = '<ul class="error-list">';
1315
1316    for (let key in errors) {
1317        if (errors.hasOwnProperty(key)) {
1318            errorsHtml += `<li>${errors[key]}</li>`;
1319        }
1320    }
1321
1322    errorsHtml += '</ul>';
1323
1324    const modalHtml = `
1325        <div class="custom-modal-overlay" id="errorModalOverlay">
1326            <div class="custom-modal scrollbar">
1327                <div class="custom-modal-header">
1328                    <h3>Ошибки при регистрации<
1328/h3>
1329                    <button class="custom-modal-close" id="closeErrorModal">&times;</button>
1330                </div>
1331                <div class="custom-modal-body">
1332                    ${errorsHtml}
1333                </div>
1334                <div class="custom-modal-footer">
1335                    <button class="btn btn-primary" id="confirmErrorModal">Понятно</button>
1336                </div>
1337            </div>
1338        </div>
1339    `;
1340
1341    hideLoadingModal();
1342
1343    $('#errorModalOverlay').remove();
1344    $('body').css('overflow', 'hidden');
1345    $('body').append(modalHtml);
1346
1347    $('#closeErrorModal, #confirmErrorModal, #errorModalOverlay').on('click', function(e) {
1348        if (e.target === this) {
1349            $('#errorModalOverlay').fadeOut(300, function() {
1350                $(this).remove();
1351                $('body').css('overflow', '');
1352            });
1353        }
1354    });
1355
1356    $('#errorModalOverlay').fadeIn(300);
1357}
1358
1359function showLoadingModal() {
1360    const modalHtml = `
1361        <div class="custom-modal-overlay" id="loadingModalOverlay">
1362            <div class="custom-modal loading-modal">
1363                <div class="custom-modal-body">
1364                    <div class="loading-spinner"></div>
1365                    <p class="loading-text">Идет отправка данных, ожидайте...</p>
1366                </div>
1367            </div>
1368        </div>
1369    `;
1370
1371    $('#loadingModalOverlay').remove();
1372    $('body').css('overflow', 'hidden');
1373    $('body').append(modalHtml);
1374    $('#loadingModalOverlay').fadeIn(300);
1375}
1376
1377function hideLoadingModal() {
1378    $('#loadingModalOverlay').fadeOut(300, function() {
1379        $(this).remove();
1380        if (!$('.custom-modal-overlay').length) {
1381            $('body').css('overflow', '');
1382        }
1383    });
1384}
1385
1386function jsForm() {
1387
1388    var $form = $('.js-form'),
1389        $sections = $('.form-section', $form),
1390        $nav = $('.form-navigation', $form),
1391        $steps = $('.js-steps', $form);
1392
1393    $form.parsley({
1394        trigger: 'input',
1395        errorClass: 'input__error',
1396        successClass: 'input__success',
1397        errorsWrapper: '<span class="input__note note__error color--red"></span>',
1398        errorTemplate: '<span></span>'
1399    });
1400
1401    function navigateTo(index) {
1402        var atTheEnd = index >= $sections.length - 1;
1403
1404        $sections.removeClass('current').slideUp('200');
1405
1406        $sections.eq(index).addClass('current').slideDown('200', function () {
1407            if ($steps.length > 0 && index > 0) {
1408                $.scrollTo($('.js-steps'), 400, {
1409                    offset: {
1410                        top: -30
1411                    }
1412                });
1413            }
1414        });
1415
1416        $nav.find('.js-prev').toggle(index > 0);
1417
1418        $nav.find('.js-next').toggle(!atTheEnd);
1419
1420        $nav.find('.js-submit').toggle(atTheEnd);
1421
1422        if ($steps.length > 0) $steps.find('.step').removeClass('step--current').eq(index).addClass('step--current');
1423
1424        if ($('.form-section.current .has-content').length > 0) {
1425            $form.parsley().whenValidate({group: 'block-' + curIndex()});
1426        }
1427    }
1428
1429    function curIndex() {
1430        return $sections.index($sections.filter('.current'));
1431    }
1432
1433    $nav.find('.js-prev .button').on('click', function (event) {
1434        event.preventDefault();
1435
1436        navigateTo(curIndex() - 1);
1437    });
1438
1439    $nav.find('.js-next .button').on('click', function (event) {
1440        event.preventDefault();
1441
1442        $form.parsley().whenValidate({group: 'block-' + curIndex()}).done(function () {
1443            navigateTo(curIndex() + 1);
1444        });
1445
1446    });
1447
1448    $nav.find('.js-submit input').on('click', function () {
1449        if($form.find('#AGREE_REG')){
1450            if(!$form.find('#AGREE_REG')[0].checked){
1451                $('#consern_not_given').show();
1452            }else{
1453                $('#consern_not_given').hide();
1454            }
1455        }
1456        $form.parsley().whenValidate({group: 'block-' + curIndex()}).done(function () {
1457            // navigateTo(curIndex() + 1);
1458        });
1459    });
1460
1461    $.each($sections, function (index, section) {
1462        $(section).find(':input').attr('data-parsley-group', 'block-' + index);
1463    });
1464
1465    navigateTo(0);
1466
1467    $nav.show();
1468}
1469
1470var inputEffect = function () {
1471    $.each($(".input input, .input textarea"), function (index, val) {
1472        if ($(this).val().length !== 0) {
1473            $(this).addClass("has-content");
1474        }
1475    });
1476
1477    $(".input input, .input textarea").off('focusout');
1478
1479    $(".input input, .input textarea").on('focusout', function () {
1480        if ($(this).val().length !== 0) {
1481            $(this).addClass("has-content");
1482        } else {
1483            $(this).removeClass("has-content");
1484        }
1485    });
1486};
1487
1488
1489if (mobile === false && $('.article-aside-wrap').length > 0) {
1490
1491    $.each($('.article-aside-wrap'), function (index, val) {
1492        $(this).stick_in_parent({
1493            offset_top: 100
1494        });
1495    });
1496
1497
1498}
1499
1500
1501function socialWindow(url) {
1502    var left = (screen.width - 570) / 2;
1503    var top = (screen.height - 570) / 2;
1504    var params = "menubar=no,toolbar=no,status=no,width=570,height=570,top=" + top + ",left=" + left;
1505    window.open(url, "NewWindow", params);
1506}
1507
1508function asideShareLinks() {
1509    var pageUrl = encodeURIComponent(document.URL);
1510    var title = encodeURIComponent(jQuery("meta[property='og:title']").attr("content"));
1511    var description = encodeURIComponent(jQuery("meta[property='og:description']").attr("content"));
1512    var image = encodeURIComponent(jQuery("meta[property='og:image']").attr("content"));
1513
1514    jQuery(".share-fb").on("click", function () {
1515        url = "https://www.facebook.com/sharer.php?u=" + pageUrl;
1516        socialWindow(url);
1517    });
1518
1519    jQuery(".share-vk").on("click", function () {
1520        console.log(pageUrl, title, description, image);
1521        url = "http://vkontakte.ru/share.php?url=" + pageUrl + "&title=" + title + "&image=" + image;
1522        socialWindow(url);
1523    });
1524
1525    jQuery(".share-tw").on("click", function () {
1526        url = "https://twitter.com/intent/tweet?url=" + pageUrl + "&text=" + description;
1527        socialWindow(url);
1528    });
1529}
1530
1531
1532yearsList = function () {
1533
1534    var el = $('.js-years-list');
1535
1536    var cur = $('.years-list__current', el).index();
1537
1538    if (cur == 0) {
1539        cur = 0;
1540    } else {
1541        cur = cur - 1;
1542    }
1543
1544    $('.js-years-list').slick({
1545        infinite: false,
1546        slidesToShow: 3,
1547        slidesToScroll: 3,
1548        speed: 200,
1549        initialSlide: cur,
1550        prevArrow: '<div class="years-list__item years-list__prev"><a href="#"><span class="icon-angle-left"></span></a></div>',
1551        nextArrow: '<div class="years-list__item years-list__next"><a href="#"><span class="icon-angle-right"></span></a></div>'
1552    });
1553
1554};
1555
1556
1557/**
1558 *
1559 * @param p
1560 * @param p.root all news container
1561 * @param p.newsBlock one page news container. set empty if it similar root
1562 * @param p.newsLoader object container click to be processed
1563 * @param p.ajaxLoader block which will be shown while loading
1564 * @param p.url default set it bitrix SEF_FOLDER
1565 * @param p.navResult.endPage total pages count
1566 * @param p.navResult.navNum bitrix navigation number
1567 * @constructor
1568 */
1569function AjaxPagination(p) {
1570    var o = this;
1571    this.root = $(p.root);
1572    this.newsBlockSelector = ($(p.newsBlock).length ? p.newsBlock : p.root);
1573    this.newsBlock = $(o.newsBlockSelector);
1574    this.newsLoader = $(p.newsLoader);
1575    // this.ajaxLoader = $(p.ajaxLoader);
1576    this.curPage = 1;
1577    this.url = p.url;
1578    this.navResult = (p.navResult);
1579
1580    this.loadMoreNews = function () {
1581        var loadUrl = o.url;
1582        loadUrl += (loadUrl.split('?')[1] ? '&' : '?');
1583        loadUrl += "PAGEN_" + o.navResult.navNum + "=" + (++o.curPage);
1584
1585        // o.ajaxLoader.show();
1586        o.newsLoader.addClass('loading');
1587
1588        $.ajax({
1589            url: loadUrl,
1590            type: "POST",
1591            data: {
1592                AJAX: "Y"
1593            }
1594        }).done(function (html) {
1595            var news = $(html).find(o.newsBlockSelector).html();
1596            const $targetTab = $(o.newsBlockSelector);
1597            $targetTab.isotope('insert', $(news));
1598            $targetTab.isotope('layout');
1599            $targetTab.imagesLoaded(function () {
1600                $targetTab.isotope('layout');
1601            });
1602            //o.newsBlock.last().append(news);
1603
1604            //news.ajaxLoader.hide(o.newsBlock);
1605            o.newsLoader.removeClass('loading');
1606
1607            if (o.curPage == o.navResult.endPage) {
1608                o.newsLoader.hide();
1609            }
1610        });
1611    };
1612
1613    this.init = function () {
1614        o.newsLoader.on('click', function (event) {
1615            o.loadMoreNews();
1616            event.preventDefault();
1617        });
1618    };
1619}
1620
1621$(function () {
1622    $('*[data-onclick-toggle]').click(function (event) {
1623        var selector = $(this).data('onclick-toggle');
1624        $(selector).toggle();
1625    });
1626});
1627
1628
1629function datePicker() {
1630    $('.flatpickr').flatpickr({
1631        "locale": "ru",
1632        altInput: true,
1633        altFormat: 'd.m.Y',
1634        onValueUpdate: function () {
1635            $('.flatpickr.active').addClass('has-content');
1636        }
1637    });
1638
1639    $('.flatpickr-wrap').flatpickr({
1640        "locale": "ru",
1641        wrap: true,
1642        onValueUpdate: function () {
1643            $('.flatpickr.active').addClass('has-content');
1644        }
1645    });
1646}
1647
1648$(function () {
1649    /*years slider*/
1650    var $slidersYears = $('.years-slider-js');
1651    if ($slidersYears.length) {
1652        $slidersYears.each(function () {
1653            var $thisSlider = $(this);
1654            var $wrap = $thisSlider.parent();
1655            var $thisBtnNext = $('.swiper-button-next', $wrap);
1656            var $thisBtnPrev = $('.swiper-button-prev', $wrap);
1657
1658            new Swiper($thisSlider, {
1659                loop: false,
1660                slidesPerView: 'auto',
1661                watchSlidesVisibility: true,
1662                keyboardControl: false,
1663
1664                nextButton: $thisBtnNext,
1665                prevButton: $thisBtnPrev
1666            });
1667        });
1668    }
1669});
1670
1671$(function () {
1672    /*select row date by one*/
1673    var $group = $('.step-group-js');
1674    var $row = $('.search__row', $group);
1675    var $check = $(':radio', $group);
1676    var $checked = $(':radio:checked', $group);
1677    var noActiveClass = 'no-active';
1678
1679    if ($group.length) {
1680
1681        $.each($check, function () {
1682            var $currentCheck = $(this);
1683
1684            $currentCheck.on('change', function () {
1685                var $thisCheck = $(this);
1686
1687                $row.addClass(noActiveClass);
1688                $thisCheck.closest($row).removeClass(noActiveClass);
1689            })
1690        });
1691    }
1692
1693    $checked.parents('.search__row').removeClass('no-active');
1694
1695});
1696
1697// $('.js-readmore').readmore({
1698// 	speed: 75,
1699// 	collapsedHeight: 175,
1700// 	blockCSS: '',
1701// 	moreLink: '<a href="#" class="expand-link dotted">Показать больше</a>',
1702// 	lessLink: '<a href="#" class="expand-link dotted">Свернуть</a>'
1703// });
1704
1705$(function () {
1706    var navArrowByCircle = [
1707        '<div class="slider-button-circle"><svg class="owl-svg" enable-background="new 0 0 32 32" height="32px" version="1.1" viewBox="0 0 32 32" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path clip-rule="evenodd" d="M11.262,16.714l9.002,8.999  c0.395,0.394,1.035,0.394,1.431,0c0.395-0.394,0.395-1.034,0-1.428L13.407,16l8.287-8.285c0.395-0.394,0.395-1.034,0-1.429  c-0.395-0.394-1.036-0.394-1.431,0l
1707-9.002,8.999C10.872,15.675,10.872,16.325,11.262,16.714z" fill="#000" fill-rule="evenodd"/></svg><span>Назад</span></div>',
1708        '<div class="slider-button-circle"><svg class="owl-svg" enable-background="new 0 0 32 32" height="32px" version="1.1" viewBox="0 0 32 32" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path clip-rule="evenodd" d="M21.698,15.286l-9.002-8.999  c-0.395-0.394-1.035-0.394-1.431,0c-0.395,0.394-0.395,1.034,0,1.428L19.553,16l-8.287,8.285c-0.395,0.394-0.395,1.034,0,1.429  c0.395,0.394,1.036,0.394,1.431,0l9.002-8.999C22.088,16.325,22.088,15.675,21.698,15.286z" fill="#000" fill-rule="evenodd"/></svg><span>Вперед</span></div>'
1709    ];
1710
1711    var navArrowBySide = [
1712        '<div class="slider-button-side"><svg class="owl-svg" enable-background="new 0 0 32 32" height="32px" version="1.1" viewBox="0 0 32 32" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path clip-rule="evenodd" d="M11.262,16.714l9.002,8.999  c0.395,0.394,1.035,0.394,1.431,0c0.395-0.394,0.395-1.034,0-1.428L13.407,16l8.287-8.285c0.395-0.394,0.395-1.034,0-1.429  c-0.395-0.394-1.036-0.394-1.431,0l-9.002,8.999C10.872,15.675,10.872,16.325,11.262,16.714z" fill="#000" fill-rule="evenodd"/></svg><span>Назад</span></div>',
1713        '<div class="slider-button-side"><svg class="owl-svg" enable-background="new 0 0 32 32" height="32px" version="1.1" viewBox="0 0 32 32" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path clip-rule="evenodd" d="M21.698,15.286l-9.002-8.999  c-0.395-0.394-1.035-0.394-1.431,0c-0.395,0.394-0.395,1.034,0,1.428L19.553,16l-8.287,8.285c-0.395,0.394-0.395,1.034,0,1.429  c0.395,0.394,1.036,0.394,1.431,0l9.002-8.999C22.088,16.325,22.088,15.675,21.698,15.286z" fill="#000" fill-rule="evenodd"/></svg><span>Вперед</span></div>'
1714    ];
1715
1716    function rowSlidersInit() {
1717        var $rowSliderContainer = $('.row-slider-container-js');
1718        if ($rowSliderContainer.length > 0) {
1719
1720            $.each($rowSliderContainer, function () {
1721                var $thisSliderContainer = $(this);
1722                var $thisSlider = $('.owl-carousel', $thisSliderContainer);
1723                var $navContainer = $('.outside-nav-slider-js', $thisSliderContainer);
1724                var timeout;
1725
1726                function setSameHeight() {
1727                    var options = {
1728                        byRow: true,
1729                        property: 'height',
1730                        target: null,
1731                        remove: false
1732                    };
1733
1734                    $('.owl-item', $thisSlider).matchHeight(options);
1735                }
1736
1737                $thisSlider.on('initialized.owl.carousel', function () {
1738                    setSameHeight();
1739
1740                    var $lightGallery = $('.lg-row-slider-js');
1741                    var $lightGalleryVideo = $('.lg-video-row-slider-js');
1742
1743                    if ($lightGallery.length) {
1744                        $.each($lightGallery, function () {
1745                            var $thisGallery = $(this);
1746                            lightGalleryImages($thisGallery);
1747                        })
1748                    }
1749
1750                    if ($lightGalleryVideo.length) {
1751                        $.each($lightGalleryVideo, function () {
1752                            var $thisGallery = $(this);
1753                            lightGalleryVideos($thisGallery);
1754                        })
1755                    }
1756                });
1757
1758                $thisSlider.owlCarousel({
1759                    items: 3,
1760                    slideBy: 3,
1761                    nav: true,
1762                    margin: 30,
1763                    // navContainer: $navContainer,
1764                    navText: navArrowByCircle,
1765                    responsive: {
1766                        0: {
1767                            items: 1,
1768                            slideBy: 1
1769                        },
1770                        300: {
1771                            items: 1,
1772                            slideBy: 1
1773                        },
1774                        500: {
1775                            items: 2,
1776                            slideBy: 2
1777                        },
1778                        992: {
1779                            items: 3,
1780                            slideBy: 3
1781                        }
1782                    }
1783                }).on('resized.owl.carousel', function () {
1784                    clearTimeout(timeout);
1785
1786                    timeout = setTimeout(function () {
1787                        setSameHeight();
1788                    }, 100);
1789                });
1790            })
1791
1792        }
1793    }
1794
1795    rowSlidersInit();
1796
1797    function booksSlidersInit() {
1798        var $booksSliderContainer = $('.books-slider-container-js');
1799        if ($booksSliderContainer.length > 0) {
1800
1801            $.each($booksSliderContainer, function () {
1802                var $thisSliderContainer = $(this);
1803                var $thisSlider = $('.owl-carousel', $thisSliderContainer);
1804                var $navContainer = $('.outside-nav-slider-js', $thisSliderContainer);
1805
1806                $thisSlider.owlCarousel({
1807                    items: 5,
1808                    slideBy: 5,
1809                    nav: true,
1810                    margin: 30,
1811                    lazyLoad: true,
1812                    // navContainer: $navContainer,
1813                    navText: navArrowByCircle,
1814                    URLhashListener: true,
1815                    startPosition: 'URLHash',
1816                    responsive: {
1817                        0: {
1818                            items: 1,
1819                            slideBy: 1
1820                        },
1821                        380: {
1822                            items: 2,
1823                            slideBy: 2
1824                        },
1825                        480: {
1826                            items: 2,
1827                            slideBy: 2
1828                        },
1829                        640: {
1830                            items: 3,
1831                            slideBy: 3
1832                        },
1833                        992: {
1834                            items: 4,
1835                            slideBy: 4
1836                        },
1837                        1100: {
1838                            items: 5,
1839                            slideBy: 5
1840                        }
1841                    }
1842                });
1843            })
1844
1845        }
1846    }
1847
1848    booksSlidersInit();
1849
1850    function singleSlidersInit() {
1851        var $singleSliderContainer = $('.single-slider-container-js');
1852        if ($singleSliderContainer.length > 0) {
1853
1854            $.each($singleSliderContainer, function () {
1855                var $thisSliderContainer = $(this);
1856                var $thisSlider = $('.owl-carousel', $thisSliderContainer);
1857                var $navContainer = $('.outside-nav-slider-js', $thisSliderContainer);
1858
1859                $thisSlider.owlCarousel({
1860                    items: 1,
1861                    slideBy: 1,
1862                    nav: true,
1863                    margin: 0,
1864                    // navContainer: $navContainer,
1865                    navText: navArrowByCircle
1866                });
1867            })
1868        }
1869    }
1870
1871    singleSlidersInit();
1872
1873    function tapeGalleryInit() {
1874        var $tapeGalleryContainer = $('.tape-gallery-container-js');
1875        if ($tapeGalleryContainer.length) {
1876            $tapeGalleryContainer.each(function () {
1877                var $thisContainer = $(this);
1878                var $thisSlider = $('.swiper-container', $thisContainer);
1879                var $thisBtnNext = $('.swiper-button-next', $thisContainer);
1880                var $thisBtnPrev = $('.swiper-button-prev', $thisContainer);
1881
1882                new Swiper($thisSlider, {
1883                    loop: false,
1884                    slidesPerView: 'auto',
1885                    watchSlidesVisibility: true,
1886                    keyboardControl: false,
1887                    preloadImages: false,
1888                    lazyLoading: true,
1889
1890                    nextButton: $thisBtnNext,
1891                    prevButton: $thisBtnPrev
1892                });
1893            });
1894        }
1895    }
1896
1897    tapeGalleryInit();
1898
1899    function galleryInit() {
1900        var $gallery = $('.gallery-container-js');
1901        if ($gallery.length) {
1902            $gallery.each(function () {
1903                var $thisGallery = $(this);
1904                var $images = $('.gallery-js', $thisGallery);
1905                var $titles = $('.gallery-captions-js', $thisGallery);
1906                var $thisBtnNext = $('.swiper-button-next', $thisGallery);
1907                var $thisBtnPrev = $('.swiper-button-prev', $thisGallery);
1908                var $thisPagination = $('.swiper-pagination', $thisGallery);
1909
1910                var galleryTop = new Swiper($images, {
1911                    loop: true,
1912                    // grabCursor: true,
1913                    keyboardControl: false,
1914
1915                    nextButton: $thisBtnNext,
1916                    prevButton: $thisBtnPrev,
1917                    pagination: $thisPagination,
1918                    paginationType: 'fraction'
1919                });
1920
1921                var galleryThumbs = new Swiper($titles, {
1922                    loop: true,
1923                    effect: 'fade',
1924                    fade: {
1925                        crossFade: true
1926                    }
1927                });
1928
1929                galleryTop.params.control = galleryThumbs;
1930                galleryThumbs.params.control = galleryTop;
1931            });
1932        }
1933    }
1934
1935    galleryInit();
1936
1937    function collectionSliderInit() {
1938        var $rowSliderContainer = $('.collection-slider-container-js');
1939        if ($rowSliderContainer.length > 0) {
1940
1941            $.each($rowSliderContainer, function () {
1942                var $thisSliderContainer = $(this);
1943                var $thisSlider = $('.owl-carousel', $thisSliderContainer);
1944                var $navContainer = $($thisSliderContainer);
1945
1946                var $thisSliderOwl = $thisSlider.owlCarousel({
1947                    items: 1,
1948                    slideBy: 1,
1949                    nav: true,
1950                    margin: 0,
1951                    // autoWidth:true,
1952                    navContainer: $navContainer,
1953                    navText: navArrowBySide
1954                });
1955
1956                $('.pr-collection-item__title').click(function () {
1957                    console.log(1);
1958                    setTimeout(function () {
1959                        $thisSliderOwl.trigger('refresh.owl.carousel');
1960                    }, 100)
1961                })
1962            })
1963        }
1964    }
1965
1966    collectionSliderInit();
1967
1968    function createMediaEq() {
1969        var $eqContainer = $('.eq-js');
1970        var eqLength = 50;
1971        var minSize = 0;
1972        var maxSize = 50;
1973        var eqColWidth = 100 / eqLength + '%';
1974
1975        $.each($eqContainer, function () {
1976            var $thisContainer = $(this);
1977
1978            for (var i = 0; i < eqLength; i++) {
1979                var eqColHeight = getRandomInt(minSize, maxSize);
1980                $('<span class="eq-col"></span>').appendTo($thisContainer).css({
1981                    'height': eqColHeight,
1982                    'width': eqColWidth
1983                });
1984            }
1985        });
1986
1987        function getRandomInt(min, max) {
1988            return Math.floor(Math.random() * (max - min)) + min;
1989        }
1990    }
1991
1992    createMediaEq();
1993
1994    function lightGalleryInit() {
1995        var $lightGallery = $('.lg-js');
1996        var $lightGalleryVideo = $('.lg-video-js');
1997
1998        if ($lightGallery.length) {
1999            $.each($lightGallery, function () {
2000                var $thisGallery = $(this);
2001                lightGalleryImages($thisGallery);
2002            });
2003
2004            $('img', $lightGallery).unveil(200);
2005        }
2006
2007        if ($lightGalleryVideo.length) {
2008            $.each($lightGalleryVideo, function () {
2009                var $thisGallery = $(this);
2010                lightGalleryVideos($thisGallery);
2011            })
2012        }
2013    }
2014
2015    lightGalleryInit();
2016
2017    function lightGalleryImages($thisGallery) {
2018        $thisGallery.lightGallery({
2019            thumbnail: true,
2020            animateThumb: true,
2021            showThumbByDefault: false,
2022            download: false
2023        });
2024    }
2025
2026    function lightGalleryVideos($thisGallery) {
2027        $thisGallery.lightGallery({
2028            thumbnail: true,
2029            animateThumb: true,
2030            showThumbByDefault: false,
2031            download: false,
2032            autoplayControls: false,
2033            zoom: false
2034        });
2035    }
2036
2037    function libcardFormInit() {
2038        var $libcardForm = $('.js-libcard-form'); //
2039        if ($libcardForm.length > 0) {
2040            var $button = $libcardForm.find('input[type="submit"], button[type="submit"]'),
2041                text = $button.val();
2042
2043            var $result = $libcardForm.find('.js-result');
2044            if ($result.length == 0) {
2045                $result = $libcardForm.parent().find('.js-result');
2046            }
2047            $libcardForm.ajaxForm({
2048                beforeSubmit: function (formData, $form, options) {
2049                    $button.attr('disabled', true);
2050                    $button.val('...');
2051                    $result.html('');
2052                },
2053                success: function (responseText, statusText, xhr, $form) {
2054                    $button.attr('disabled', false);
2055                    $button.val(text);
2056                    $result.html(responseText);
2057                }
2058            });
2059        }
2060    }
2061
2062    libcardFormInit();
2063
2064
2065    $('.js-light-tabs').tabs({
2066        show: {effect: 'slide', duration: 800},
2067        hide: {effect: "slide", duration: 1000},
2068        active: 0,
2069        classes: {
2070            'ui-tabs-active': 'active'
2071        }
2072    });
2073
2074    if ((typeof SHOW_AUTH_POPUP != 'undefined') && SHOW_AUTH_POPUP) {
2075        setTimeout(function () {
2076            $('.topnav__login .js-popup-show').trigger('click');
2077        }, 100);
2078    }
2079
2080    toggleableInit();
2081
2082    function toggleableInit() {
2083        var $toggleable = $('.js-toggleable');
2084
2085        if ($toggleable.length > 0) {
2086            $(document).on('click', '.js-toggleable > .js-title', function (event) {
2087                event.preventDefault();
2088
2089                $(this).closest('.js-toggleable').find('.js-content').slideToggle();
2090            });
2091        }
2092    }
2093});
2094
2095
2096var toggleGain = function () {
2097
2098    if ($('#gaincss').length > 0) {
2099
2100        $('#gaincss').remove();
2101
2102        Cookies.set('gain-lib', "false", {domain: 'nlb.by'});
2103
2104    } else {
2105        $("<link/>", {
2106            rel: "stylesheet",
2107            type: "text/css",
2108            href: DEFAULT_ASSETS_PATH + "/css/contrast.css",
2109            id: "gaincss"
2110        }).appendTo("body");
2111
2112        Cookies.set('gain-lib', "true", {domain: 'nlb.by'});
2113
2114        if (ie !== false && ie >= 10) {
2115            grayscaleIE()
2116        }
2117    }
2118
2119    if ($pubGrid) {
2120        setTimeout(function () {
2121            $pubGrid.isotope('layout');
2122            $pubGrid.imagesLoaded(function () {
2123                $pubGrid.isotope('layout');
2124            });
2125        }, 1000);
2126    }
2127};
2128
2129$('.js-topnav-gain').on('click', function (event) {
2130    event.preventDefault();
2131    toggleGain();
2132
2133    if (ie !== false && ie < 12) {
2134        location.reload()
2135    }
2136});
2137
2138var checkGainCookie = function () {
2139    if (Cookies.get('gain-lib') === "true") {
2140        toggleGain();
2141    }
2142}();
2143
2144
2145function grayscaleIE() {
2146
2147    $('.usercontent img, .l-layout img').each(function () {
2148        var el = $(this);
2149        el.css({"position": "absolute"}).wrap("<div class='img_wrapper' style='display: inline-block'>").clone().addClass('img_grayscale').css({
2150            "position": "absolute",
2151            "z-index": "5",
2152            "opacity": "0"
2153        }).insertBefore(el).queue(function () {
2154            var el = $(this);
2155            el.parent().css({"width": this.width, "height": this.height});
2156            el.dequeue();
2157        });
2158        this.src = grayscaleIE10(this.src);
2159    });
2160
2161
2162    function grayscaleIE10(src) {
2163        var canvas = document.createElement('canvas');
2164        var ctx = canvas.getContext('2d');
2165        var imgObj = new Image();
2166        imgObj.crossOrigin = '';
2167        imgObj.src = src;
2168        canvas.width = imgObj.width;
2169        canvas.height = imgObj.height;
2170        ctx.drawImage(imgObj, 0, 0);
2171        var imgPixels = ctx.getImageData(0, 0, canvas.width, canvas.height);
2172        for (var y = 0; y < imgPixels.height; y++) {
2173            for (var x = 0; x < imgPixels.width; x++) {
2174                var i = (y * 4) * imgPixels.width + x * 4;
2175                var avg = (imgPixels.data[i] + imgPixels.data[i + 1] + imgPixels.data[i + 2]) / 3;
2176                imgPixels.data[i] = avg;
2177                imgPixels.data[i + 1] = avg;
2178                imgPixels.data[i + 2] = avg;
2179            }
2180        }
2181        ctx.putImageData(imgPixels, 0, 0, 0, 0, imgPixels.width, imgPixels.height);
2182        return canvas.toDataURL();
2183    };
2184}
2185
2186
2187
2188function initInputMask() {
2189    $('[data-mask="phone"]').inputmask('\+375 (99) 999−99−99', {placeholder: "\+375 (__) ___−__−__"});
2190}
2191
2192// initInputMask();
2193
2194
2195function formReset(elem) {
2196    var form = elem,
2197        input = $('input:not([type="reset"], [type="submit"])', form),
2198        reset = $('input[type="reset"]', form),
2199        select = $('.select select', form);
2200
2201    reset.on('click', function (event) {
2202        $.each(input, function (index, val) {
2203            $(val).attr('value', '');
2204            $(val).blur();
2205            $(val).removeClass('has-content');
2206        });
2207
2208        $.each(select, function (index, val) {
2209            $(val)[0].selectize.setValue(0, 1);
2210            $(val).next().removeClass('has-content');
2211        });
2212    });
2213}
2214
2215// if ($('.select').length) {
2216// 	$('.select select').selectize({
2217// 		onInitialize: function() {
2218
2219// 			var check = $(this)[0].$input[0].firstChild.value;
2220
2221// 			if (check !== '') {
2222// 				$(this)[0].$wrapper.addClass('has-content');
2223// 			}
2224// 		},
2225// 		onChange: function() {
2226// 			$(this)[0].$wrapper.addClass('has-content');
2227// 		}
2228// 	});
2229// }
2230
2231function langCurrent() {
2232    var cur = $('.lang-current')
2233    lnk = $('.js-lang-current');
2234    cur.html(lnk.html());
2235    lnk.parent().hide(0);
2236}
2237
2238
2239function jsAttention() {
2240
2241    var attention = $('.js-attention');
2242
2243    var attention_id = attention.data('id');
2244
2245    var close = $('.js-attention-close', attention);
2246
2247    var open = $('.js-attention-open', attention);
2248
2249    var info = $('.attention-info', attention);
2250
2251    var domain = 'nlb.by';
2252
2253    var expires = 7;
2254
2255    var started = false;
2256
2257    var marqueeStart = function () {
2258
2259        started = true;
2260
2261        info.marquee({
2262            allowCss3Support: true,
2263            duplicated: true,
2264            duration: 10000,
2265            pauseOnHover: false
2266        });
2267    }
2268
2269    if (attention_id !== undefined && Cookies.get("attention-id") === attention_id) {
2270
2271        attention.addClass('attention-is-collapsed');
2272
2273    } else {
2274
2275        attention.removeClass('attention-is-collapsed');
2276
2277        marqueeStart();
2278    }
2279
2280
2281    close.on('click', function (event) {
2282        event.preventDefault();
2283
2284        attention.addClass('attention-is-collapsed');
2285
2286        Cookies.set("attention-id", attention_id, {expires: expires, domain: domain});
2287    });
2288
2289    open.on('click', function (event) {
2290        event.preventDefault();
2291
2292        attention.removeClass('attention-is-collapsed');
2293
2294        if (!started) marqueeStart();
2295
2296        Cookies.remove("attention-id", {domain: domain});
2297
2298    });
2299}
2300
2301
2302function articleGallery() {
2303
2304    var content = $('.article__content');
2305    var images = $('a > img', content).length;
2306
2307    if (images > 0) {
2308        $('.article__content').lightGallery({
2309            selector: '.picture',
2310            speed: 300,
2311            download: false,
2312            autoplay: false,
2313            fullScreen: false,
2314            zoom: false,
2315            hash: false,
2316            share: false,
2317            autoplay: false
2318        });
2319    }
2320
2321}
2322
2323function refreshCaptcha() {
2324    var captcha_img = $('#captcha_img'),
2325        refresh_button = $('.js-refresh');
2326
2327    refresh_button.on("click", function (event) {
2328        var refresh_button = $(this);
2329
2330        captcha_img.fadeTo('fast', 0.33);
2331
2332        refresh_button.addClass('disabled');
2333
2334        var separator = (window.location.href.indexOf("?") === -1) ? "?" : "&";
2335        var url = window.location.href + separator + "reload_captcha=1";
2336
2337        $.getJSON(url, function (data) {
2338            captcha_img.attr('src', '/bitrix/tools/captcha.php?captcha_sid=' + data);
2339            $('input[name="captcha_sid"]').val(data);
2340
2341            captcha_img.fadeTo('fast', 1);
2342
2343            setTimeout(function () {
2344                refresh_button.removeClass('disabled');
2345            }, 800);
2346        });
2347        return false;
2348    });
2349}
2350
2351if ($('.js-refresh').length > 0)
2352    refreshCaptcha();

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.