PageSourceSearch

https://pushkinmuseum.art/js/scripts2024.js

js pushkinmuseum.art collected 2026-10-01 10:12:11 UTC 48,458 bytes, 1,541 lines download raw bytes

1//дебаунс для правильного ресайза
2function debounce(func, wait, immediate) {
3  var timeout;
4  return function () {
5    var context = this,
6      args = arguments;
7    var later = function () {
8      timeout = null;
9      if (!immediate) func.apply(context, args);
10    };
11    var callNow = immediate && !timeout;
12    clearTimeout(timeout);
13    timeout = setTimeout(later, wait);
14    if (callNow) func.apply(context, args);
15  };
16}
17
18//туггл для функций
19jQuery.fn.clickToggle = function (a, b) {
20  function cb() {
21    [b, a][(this._tog ^= 1)].call(this);
22  }
23  return this.on('click', cb);
24};
25
26// возвращает cookie с именем name, если есть, если нет, то undefined
27function getCookie(name) {
28  var matches = document.cookie.match(new RegExp('(?:^|; )' + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + '=([^;]*)'));
29  return matches ? decodeURIComponent(matches[1]) : undefined;
30}
31
32// устанавливает cookie с именем name и значением value
33// options - объект с свойствами cookie (expires, path, domain, secure)
34function setCookie(name, value, options) {
35  options = options || {};
36
37  var expires = options.expires;
38
39  if (typeof expires == 'number' && expires) {
40    var d = new Date();
41    d.setTime(d.getTime() + expires * 1000);
42    expires = options.expires = d;
43  }
44  if (expires && expires.toUTCString) {
45    options.expires = expires.toUTCString();
46  }
47
48  value = encodeURIComponent(value);
49
50  var updatedCookie = name + '=' + value;
51
52  for (var propName in options) {
53    updatedCookie += '; ' + propName;
54    var propValue = options[propName];
55    if (propValue !== true) {
56      updatedCookie += '=' + propValue;
57    }
58  }
59
60  document.cookie = updatedCookie;
61}
62
63// удаляет cookie с именем name
64function deleteCookie(name) {
65  setCookie(name, '', {
66    expires: -1
67  });
68}
69
70//получаем случайное число от min до max
71function getRandomInt(min, max) {
72  return Math.floor(Math.random() * (max - min + 1) + min);
73}
74
75//аккордеон
76(function ($) {
77  $.fn.vmenuModule = function (option) {
78    var obj, item;
79    var options = $.extend(
80      {
81        Speed: 220,
82        autostart: true,
83        autohide: 1
84      },
85      option
86    );
87    obj = $(this);
88
89    item = obj.find('ul').parent('li').children('button');
90    item.attr('data-option', 'off');
91
92    item.unbind('click').on('click', function (e) {
93      e.preventDefault();
94      var a = $(this);
95      if (options.autohide) {
96        a.parent()
97          .parent()
98          .find("button[data-option='on']")
99          .parent('li')
100          .children('ul')
101          .slideUp(options.Speed / 1.2, function () {
102            $(this).parent('li').children('button').attr('data-option', 'off');
103          });
104      }
105      if (a.attr('data-option') == 'off') {
106        a.parent('li')
107          .children('ul')
108          .slideDown(options.Speed, function () {
109            a.attr('data-option', 'on');
110          });
111      }
112      if (a.attr('data-option') == 'on') {
113        a.attr('data-option', 'off');
114        a.parent('li').children('ul').slideUp(options.Speed);
115      }
116    });
117    if (options.autostart) {
118      obj.find('button').each(function () {
119        $(this)
120          .parent('li')
121          .parent('ul')
122          .slideDown(options.Speed, function () {
123            $(this).parent('li').children('button').attr('data-option', 'on');
124          });
125      });
126    }
127  };
128})(jQuery);
129
130//проверка на несколько классов
131$.fn.hasAnyClass = function () {
132  for (var i = 0; i < arguments.length; i++) {
133    var classes = arguments[i].split(' ');
134    for (var j = 0; j < classes.length; j++) {
135      if (this.hasClass(classes[j])) {
136        return true;
137      }
138    }
139  }
140  return false;
141};
142
143$(document).ready(function () {
144  console.log(document.cookie);
145  //определим девайс и ОС и добавим класс к <html/>
146  var htmlTag = document.querySelector('html');
147  htmlTag.className += ' ' + platform.name.toLowerCase() + ' ' + platform.os.family.toLowerCase();
148
149  //десктоп панель настроек
150  var callControl = $('.js-call-control'),
151    mainControlsSectionBlock = $('.main-controls-section-block');
152
153  callControl.click(function (e) {
154    e.stopPropagation();
155
156    $(this).find(mainControlsSectionBlock).toggleClass('opened');
157    $(this).find('.main-controls__button').toggleClass('active');
158
159    callControl.not(this).each(function () {
160      $(this).find(mainControlsSectionBlock).removeClass('opened');
161      $(this).find('.main-controls__button').removeClass('active');
162    });
163  });
164
165  //код бэкендера для того, чтобы если страница выводится через поиск, подкрасить слово, которое искали
166  var url_param = decodeURIComponent(window.location.search);
167  var param_find = '';
168  if (url_param.indexOf('find=') >= 0) {
169    param_find = url_param.substr(url_param.indexOf('find=') + 5);
170  }
171
172  if (param_find != '') {
173    var reg = new RegExp(param_find, 'gi');
174    $('main div').each(function (i, item) {
175      item.innerHTML = item.innerHTML.replace(reg, function (str, offset, s) {
176        return '<needle>' + str + '</needle>'; //console.log("Строка " + s + "столбец " + offset);
177      });
178    });
179  }
180
181  //console.log($("section div").text());
182
183  $('.js-call-search').click(function (e) {
184    $('.form-search input').focus();
185  });
186  mainControlsSectionBlock.click(function (e) {
187    e.stopPropagation();
188  });
189  $(document).click(function () {
190    callControl.find(mainControlsSectionBlock).removeClass('opened');
191    callControl.find('.main-controls__button').removeClass('active');
192    $('.js-btn-share-block').removeClass('open');
193  });
194
195  /*      $("#term, #condition").change(function () {//console.log("jsfhskjdf");
196					 if ($("#term").is(':checked') &&
197							 $("#condition").is(':checked') ) {
198							 $('.subscribe-form-btn').attr('disabled', false);
199					 } else {
200							 $('.subscribe-form-btn').attr('disabled', true);
201					 }
202				});*/
203  $('.term, .condition, .pers').change(function () {
204    //console.log($(this).parent().siblings().find("input:checked").length);
205    if ($(this).is(':checked') && ($(this).parent().siblings().find("input:checked").length == 2)) {
206      //console.log("yes");
207      $(this).parent().siblings('input:submit').attr('disabled', false);
208    } else {
209      //console.log("no");
210      $(this).parent().siblings('input:submit').attr('disabled', true);
211    }
212  });
213
214  //если кнопка "Купить билет" снабжена таким классом, при нажатии на нее вызывается попап про необходимость QR-кода
215  /*$('.qr-code').click(function(e) {
216         e.preventDefault();
217         $('.qr_popup').show();
218         $('.qr_popup .btn').attr("href", ($(this).attr("href") == "/" ? "https://tickets.pushkinmuseum.art" : $(this).attr("href")));
219    });
220     */
221  $('.qr_popup .popup__close-btn').click(function () {
222    $('.qr_popup').hide();
223  });
224
225  //меню-бургер
226  var burger = $('.js-burger'),
227    menu = $('.menu-mobile'),
228    close = $('.js-notifs-close'),
229    notifsTop = $('.header__notifications__inner');
230  bodyOverflow = $('body'); //добавил верстальщик 14.07.18
231
232  burger.click(function () {
233    notifsTop.toggleClass('hidden');
234    burger.toggleClass('active');
235    menu.toggleClass('opened');
236    bodyOverflow.toggleClass('overflowYhidden'); //добавил верстальщик 14.07.18
237  });
238  close.click(function () {
239    notifsTop.addClass('closed');
240  });
241
242  //мобильная версия панели-настроек
243  var mobileMenu = $('.js-mobile-menu'); //console.log(mobileMenu.parent());
244  mobileMenu.click(function () {
245    var panels = $('.menu-mobile__panels'),
246      list = $('.menu-mobile__list'),
247      panelsBlock = $('.menu-mobile__panels__block'),
248      langPanel = $('.mobile-language'),
249      copyright = $('.menu-mobile__copyright');
250
251    $(this).toggleClass('active');
252    panelsBlock.removeClass('active');
253
254    var name = $(this).data('name');
255
256    $('.' + name).addClass('active');
257    mobileMenu.not(this).each(function () {
258      $(this).removeClass('active');
259    });
260    if (mobileMenu.hasClass('active')) {
261      list.addClass('hide');
262      panels.removeClass('hide');
263      copyright.addClass('absolute');
264    } else {
265      list.removeClass('hide');
266      panels.addClass('hide');
267      copyright.removeClass('absolute');
268    }
269
270    if ((name = 'mobile-search')) {
271      setTimeout(function () {
272        $('.form--mobile-search').focus();
273      }, 1);
274    }
275
276    if ((name = 'mobile-language')) {
277      if (langPanel.find('li').length > 5 && $(window).height() < 640) {
278        copyright.removeClass('absolute');
279      }
280    }
281  });
282
283  //пункт Внимание в мобильной версии /можно заменить на аккордеон/
284  $('.js-call-notifs').click(function (e) {
285    e.preventDefault();
286    var notifs = $('.mobile-notifs'),
287      notifsList = $('.mobile-notifs-list'),
288      notifsListHeight = notifsList.innerHeight();
289
290    $(this).toggleClass('active');
291    notifs.toggleClass('opened');
292
293    if (notifs.hasClass('opened')) {
294      notifs.css('height', notifsListHeight);
295    } else {
296      notifs.css('height', 0);
297    }
298  });
299
300  //закрывашка для мобильного поиска
301  $('.form--mobile-search').on('input', function () {
302    if ($(this).val().length > 0) {
303      $('.js-clear-search').addClass('show');
304    } else $('.js-clear-search').removeClass('show');
305  });
306  $('.js-clear-search').click(function () {
307    $('.form--mobile-search').val('');
308    $(this).removeClass('show');
309  });
310
311  //console.log($('.js-grid--desktop'));
312  $('.js-grid--desktop').masonry();
313
314  //слайдер на главной странице
315  /*
316	у ссылки в слайдере на событие есть data-ticket, который тянется к кнопке Купить под слайдером
317	 */
318  var mainSliderSets = {
319    autoplay: true,
320    autoplaySpeed: 3000,
321    infinite: true,
322    slidesToShow: 1,
323    slidesToScroll: 1,
324    centerMode: true,
325    adaptiveHeight: false,
326    variableWidth: true,
327    dots: true,
328    arrows: false,
329    responsive: [
330      {
331        breakpoint: 848,
332        settings: {
333          variableWidth: false,
334          centerMode: true,
335          centerPadding: '0px'
336        }
337      }
338    ]
339  };
340  var sliderWithArrowsSets = {
341    autoplay: true,
342    autoplaySpeed: 3000,
343    infinite: true,
344    slidesToShow: 1,
345    slidesToScroll: 1,
346    centerMode: true,
347    variableWidth: true,
348    dots: true,
349    arrows: true,
350    responsive: [
351      {
352        breakpoint: 848,
353        settings: {
354          variableWidth: false,
355          centerMode: true,
356          centerPadding: '0px',
357          arrows: false
358        }
359      }
360    ]
361  };
362  var sliderWithCollectionItem = {
363    infinite: true,
364    slidesToShow: 1,
365    slidesToScroll: 1,
366    centerMode: false,
367    variableWidth: false,
368    dots: true,
369    arrows: true,
370    fade: true,
371    responsive: [
372      {
373        breakpoint: 1024,
374        settings: {
375          // centerMode: true,
376          // centerPadding: '0px',
377          arrows: false
378        }
379      }
380    ]
381  };
382  var sliderFotos = {
383    infinite: true,
384    slidesToShow: 1,
385    slidesToScroll: 1,
386    centerMode: false,
387    variableWidth: false,
388    dots: true,
389    arrows: false,
390    fade: true
391    // responsive: [
392    //     {
393    //         breakpoint: 1024,
394    //         settings: {
395    //             // centerMode: true,
396    //             // centerPadding: '0px',
397    //             arrows: false
398    //         }
399    //     }
400    // ]
401  };
402
403  // новый вид слайдер, придуманный бэкендером для вывода единичной картинки без каких-либо средств листания
404  var sliderOnePicture = {
405    infinite: true,
406    slidesToShow: 1,
407    slidesToScroll: 1,
408    centerMode: false,
409    variableWidth: false,
410    dots: false,
411    arrows: false,
412    fade: true
413    // responsive: [
414    //     {
415    //         breakpoint: 1024,
416    //         settings: {
417    //             // centerMode: true,
418    //             // centerPadding: '0px',
419    //             arrows: false
420    //         }
421    //     }
422    // ]
423  };
424
425  function initSlider(initClass, sliderSets, dataAttr) {
426    var mainSlider = $(initClass)
427      .slick(sliderSets)
428      .on('afterChange', function (event, slick, currentSlide, nextSlide) {
429        var attr = $(slick.$slides.get(currentSlide)).data(dataAttr);
430        
431        //$('.slider-btn-buy').attr('href', attr);
432        
433           if (typeof attr === "string"){
434                if (attr.length < 2){
435                     $('#buy_ticket').hide();
436                     $('#buy_ticket_mob').hide();
437                } else {
438                     $('#buy_ticket').attr('href', attr);
439                     $('#buy_ticket').show();
440                     $('#buy_ticket_mob').attr('href', attr);
441                     $('#buy_ticket_mob').show();
442                }
443           }
444        $('.js-slider-title').html(attr);
445
446        var cpt_name = $(slick.$slides.get(currentSlide)).data('name');
447        var hrf = $(slick.$slides.get(currentSlide)).attr('href'); 
448        $('#desc_name').html(cpt_name);
449        $('#desc_name').attr('href', hrf);
450        $('#desc_name_mob').html(cpt_name);
451        $('#desc_name_mob').attr('href', hrf);
452
453        var cpt_date = $(slick.$slides.get(currentSlide)).data('date');
454        $('#desc_date').html(cpt_date);
455           if (typeof cpt_date === "string"){
456                if (cpt_date.length > 2){
457                     $('#desc_date_mob').html(cpt_date.replace(" – ", "<br>"));
458                }
459           }
460
461        var cpt_place = $(slick.$slides.get(currentSlide)).data('place');
462        $('#desc_place').html(cpt_place);
463        $('#desc_place_mob').html(cpt_place);
464      });
465       
466/*var iSlider = $(initClass)
467      .slick(sliderSets)
468      .on('SetPosition', function (event, slick, currentSlide, nextSlide) {*/
469    //$('.up-slider_wrapper').hide();
470    var attr = $('.slick-slide.slick-current.slick-active').data(dataAttr);
471    //$('.slider-btn-buy').attr('href', attr);
472       
473    if (typeof attr === "string"){
474                if (attr.length < 2){
475                $('#buy_ticket').hide();
476                $('#buy_ticket_mob').hide();
477           } else {
478                $('#buy_ticket').attr('href', attr);
479                $('#buy_ticket').show();
480                $('#buy_ticket_mob').attr('href', attr);
481                $('#buy_ticket_mob').show();
482           }
483    }
484
485    var cpt_name = $('.slick-slide.slick-current.slick-active').data('name');
486    var hrf = $('.slick-slide.slick-current.slick-active').attr('href'); 
487    $('#desc_name').html(cpt_name);
488    $('#desc_name').attr('href', hrf);
489    $('#desc_name_mob').html(cpt_name);
490    $('#desc_name_mob').attr('href', hrf);
491
492
493    var cpt_date = $('.slick-slide.slick-current.slick-active').data('date');
494    $('#desc_date').html(cpt_date);
495       if (typeof cpt_date === "string"){
496            if (cpt_date.length > 2){
497                 $('#desc_date_mob').html(cpt_date.replace(" – ", "<br>"));
498            }
499       }
500
501    var cpt_place = $('.slick-slide.slick-current.slick-active').data('place');
502    
503    $('#desc_place').html(cpt_place);
504       $('#desc_place_mob').html(cpt_place);
505/*});*/
506    //$('.up-slider_wrapper').show();
507    //$('.slider-btn-buy').attr('data-href', attr);
508    //код изменен бэкендером по следующей причине:
509    //при присвоении значения переменной attr, с целью дальнейшего использования его, как подписи слайда и надписи на кнопке "Купить билет"
510    //предполагалось, что на странице присутствует только один слайдер и, как следствие, только один элемент класса .slick-slide.slick-current.slick-active
511    //а когда слайдеров больше, то надо искать строго брата того элемента .js-slider-title, в который пишем текст
512    $('.js-slider-title').html($(this).parents('.main-slider__inner').find('.slick-slide.slick-current.slick-active').data(dataAttr));
513  }
514  initSlider('.js-main-slider', mainSliderSets, 'ticket');
515  //$('.js-main-slider').slick('slickGoTo',Math.ceil( ($('.js-main-slider .slick-track').children().length-4) / 2 )-1);
516  initSlider('.js-slider-with-arrows', sliderWithArrowsSets, 'title');
517  initSlider('.js-slider-fotos', sliderFotos, 'title');
518  initSlider('.js-slider-one-picture', sliderOnePicture, 'title');
519
520  function adaptiveSlider() {
521    var height = $(window).height();
522    $('.js-slider-collection-item .slick-slide').css('height', height - 55);
523    $('.js-call-dz').click(function (e) {
524      e.preventDefault();
525
526      var dzLink = $(this).attr('data-dz');
527
528      // console.log(dzLink);
529      $('.js-dz-iframe').attr('src', dzLink);
530      $('.dz-iframe').addClass('open');
531    });
532    $('.js-close-dz').click(function (e) {
533      $('.js-dz-iframe').attr('src', '');
534      $('.dz-iframe').removeClass('open');
535    });
536  }
537  initSlider('.js-slider-collection-item', sliderWithCollectionItem, 'title');
538  adaptiveSlider();
539
540  //кнопки переключеня контентом в секции, и в афише кнопка фильтра/добавление window.history
541  function contentControl() {
542    $('.js-content-control').each(function () {
543      var block = $(this),
544        btnFirst = $(this).find('.btn-first');
545
546      $(this)
547        .find('.js-content-control-btn')
548        .click(function (e) {
549          var blockName = $(this).attr('data-target');
550
551          window.history.pushState('', 'Title', blockName);
552
553          //если ссылка пуста
554          if ($(this).attr('href') == '') {
555            e.preventDefault();
556          }
557
558          var width = $(this).outerWidth(),
559            widthWindow = $(window).width(),
560            offsetLeft = $(this).offset().left,
561            offsetRight = widthWindow - (offsetLeft + width),
562            scroller = block.find('.scroller');
563
564          if (offsetRight < 30) {
565            scroller.animate({ scrollLeft: '+=' + (-offsetRight + widthWindow / 4) }, 300);
566          }
567          if (offsetLeft < 30) {
568            scroller.animate({ scrollLeft: '-=' + (-offsetLeft + widthWindow / 4) }, 300);
569          }
570
571          $(this).addClass('active');
572          block
573            .find('.js-content-control-btn')
574            .not(this)
575            .each(function () {
576              $(this).removeClass('active');
577
578              //на странице с афишей фильтр доступен всегда
579              if (!$('body').hasClass('afisha-page')) {
580                $('.js-hidden-filter').removeClass('opened');
581              }
582
583              //для ситуации двух ul меню, сборс active
584              $(this).parent().removeClass('active');
585            });
586          checkIfFirstIsActive();
587          $grid.masonry();
588        });
589
590      function checkIfFirstIsActive() {
591        if (!btnFirst.hasClass('active') && $(window).width() < 1024) {
592          btnFirst.addClass('btn--np');
593        } else btnFirst.removeClass('btn--np');
594      }
595
596      checkIfFirstIsActive();
597    });
598  }
599  contentControl();
600
601  $('.js-call-filter').click(function (e) {
602    e.preventDefault();
603    $('.js-hidden-filter').addClass('opened');
604  });
605
606  //кнопки категорий в секции афиша
607  $('.js-categories-control-btn').click(function () {
608    // e.preventDefault();
609    if (!$(this).hasClass('btn--unavailable')) {
610      $(this).toggleClass('active');
611    }
612  });
613
614  //трансформация списка в аккордион в мобиле
615  function accordion() {
616    var content = $('.accordion--mobile .accordion-content');
617
618    if ($(window).width() < 1024) {
619      $('.js-accordion--mobile').vmenuModule({
620        Speed: 400,
621        autostart: false,
622        autohide: true
623      });
624      content.removeClass('display');
625    } else {
626      content.addClass('display');
627    }
628    $('.js-accordion').vmenuModule({
629      Speed: 400,
630      autostart: false,
631      autohide: true
632    });
633  }
634  accordion();
635
636  //переключения между двумя списками кнопок управления контентом
637  function headerControl() {
638    $('.section__header__controls').each(function () {
639      var first = $(this).find('.first'),
640        second = $(this).find('.second'),
641        firstWidth = first.width(),
642        secondWidth = second.width();
643
644      $(this)
645        .find('.js-control-menu')
646        .clickToggle(
647          function () {
648            first.css('width', firstWidth);
649            setTimeout(function () {
650              first.css('width', 0);
651              second.addClass('full-width');
652              setTimeout(function () {
653                second.css('width', secondWidth);
654              }, 100);
655            }, 100);
656          },
657          function () {
658            first.css('width', firstWidth);
659            setTimeout(function () {
660              second.css('width', 0);
661              second.addClass('null-width');
662            }, 100);
663          }
664        );
665    });
666  }
667  headerControl();
668
669  //слайдер афиша с адаптивом
670  var multipleItemsSliderSets = {
671    infinite: false,
672    slidesToShow: 1,
673    slidesToScroll: 1,
674    centerMode: true,
675    variableWidth: true,
676    dots: false,
677    arrows: true,
678    responsive: [
679      {
680        breakpoint: 1024,
681        settings: {
682          arrows: true
683        }
684      }
685    ]
686  };
687  //console.log($('.js-multiple-items-slider'));
688  $('.js-multiple-items-slider').each(function () {
689    console.log($(this));
690    $(this).slick(multipleItemsSliderSets);
691  });
692
693  function multipleItemsSliderSettings() {
694    $('.js-multiple-items-slider').each(function () {
695      var $this = $(this);
696
697      function unwrap() {console.log($this);
698        $this.slick('unslick');
699        $this.find('.slide .item').unwrap();
700        $this.find('.slide').remove();
701      }
702      function reset(num) {
703        var divs = $this.find('.item');
704        for (var i = 0; i < divs.length; i += num) {
705          divs.slice(i, i + num).wrapAll("<div class='slide'></div>");
706        }
707      }
708      if ($(window).width() < 1280) {
709        unwrap();
710        reset(3);
711        $(this).slick(multipleItemsSliderSets);
712      }
713      if ($(window).width() >= 1280) {
714        unwrap();
715        reset(4);
716        $(this).slick(multipleItemsSliderSets);
717      }
718      if ($(window).width() < 1024) {
719        unwrap();
720        reset(1);
721        $(this).slick(multipleItemsSliderSets);
722      }
723    });
724  }
725  //multipleItemsSliderSettings();
726
727  //код бэкендера для того, чтобы слайды, относящиеся к прошедшим событиям, бледнели и сдвигались влево
728  $today = new Date();
729  $today.setDate($today.getDate() - 1);
730  $numToday = $today.valueOf() * 0.001; console.log($numToday);
731  $max_actual_slide = 50;
732  $('.js-bill .item--card').each(function () {
733    if ($(this).attr('data-date') < $numToday) {
734      //что раньше сегодняшнего дня, бледнеет
735      $(this).css('opacity', '0.4');
736    }
737    if ($(this).attr('data-date') >= $numToday && +$(this).parent().attr('data-slick-index') < $max_actual_slide) {
738      //сдвигаем слайдер на первое из того, что сегодня или позже
739      $max_actual_slide = +$(this).parent().attr('data-slick-index');
740    }
741  });
742  $('.js-bill').slick('slickGoTo', $max_actual_slide);
743
744  //для видео
745  function videoLoad() {
746    $('video:not(#promovideo)').mediaelementplayer({
747      features: ['']
748    });
749  }
750  videoLoad();
751
752  // $.get('content.html', function(data) {
753  //     $(".test").html(data);
754  //     call();
755  // });
756
757  // function call() {
758  //     $('.click').click(function() {
759  //         $(this).addClass('opened');
760  //     });
761  // }
762
763  function tabs() {
764    $('[data-toggle="tab"]').click(function (e) {
765      console.log('masonryForTabs');
766      e.preventDefault();
767      var $this = $(this);
768      var $grid = $('.js-grid').imagesLoaded(function () {
769        $grid.masonry({
770          // options
771
772          itemSelector: '.grid-item',
773          columnWidth: '.grid-sizer'
774        });
775      });
776
777      function masonryForDesktop() {
778        console.log('masonryForDesktop');
779        var $gridDesktop = $('.js-grid').imagesLoaded(function () {
780          $gridDesktop.masonry({
781            // options
782
783            itemSelector: '.grid-item',
784            columnWidth: '.grid-sizer'
785          });
786
787          if ($(window).width() < 1024) {
788            $gridDesktop.masonry('destroy');
789          } else $gridDesktop;
790        });
791      }
792      masonryForDesktop();
793
794      if (!$this.hasClass('loaded')) {
795        var loadUrl = $this.attr('href'),
796          target = $this.attr('data-target'),
797          preloader = $this.closest('.section--tabs').find('.preloader--content');
798        preloader.css('display', 'block');
799
800        callAjaxContent(loadUrl, target, preloader);
801        $this.addClass('loaded');
802      }
803
804      $this.tab('show');
805    });
806  }
807  tabs();
808
809  function callAjaxContent(loadUrl, target, preloader) {
810    var div = $('.tab-pane__common-content');
811    $.get(loadUrl, function (data) {
812      $(target).find(div).html(data);
813      accordion();
814      videoLoad();
815      // btnMoreText();
816      masonryForDesktop();
817      mapFloors();
818      blindVersion();
819
820      console.log(loadUrl);
821      console.log($(target).find('.slick-slider'));
822      $(target).find('.slick-slider').slick();
823    })
824      .done(function () {
825        $(preloader).css('display', 'none');
826      })
827      .fail(function () {
828        $(target).html('Что-то пошло не так...');
829        $(preloader).css('display', 'none');
830      })
831      .always(function () {});
832  }
833
834  //загружаем contents в табы / загружаем по ссылке
835  var array = ['#friends', '#tours', '#departments', '#first-floor', '#second-floor', 'gallery-2-floor', 'gallery-3-floor', '#expositions_main', '#buildings'];
836  $(function () {
837    $('.section--tabs').each(function () {
838      var preloader = $(this).closest('.section--tabs').find('.preloader--content');
839      //console.log("769");
840      $(this)
841        .find('[data-toggle="tab"]')
842        .each(function () {
843          var target = $(this).attr('data-target'),
844            hash = window.location.hash;
845
846          if (~array.indexOf(target) && target == hash) {
847            // var loadUrl = '../artmuseum/raw/' + window.location.hash.slice(1) + '.html',
848            var loadUrl = '/raw/' + window.location.hash.slice(1) + '.html',
849              div = $('[data-target="' + target + '"]'),
850              section = div.parents('.section'),
851              num = 40; //это для воздуха
852            target = hash;
853
854            callAjaxContent(loadUrl, target, preloader);
855
856            $(target).parents('.tab-content').find('.tab-pane').removeClass('active');
857
858            // $('.js-content-control-btn').removeClass('active');
859            div.parents('ul').find('.js-content-control-btn').removeClass('active');
860
861            div.addClass('active');
862            $(target).addClass('active');
863            console.log($('.js-multiple-items-slider'));
864            setTimeout(function () {
865              $('html,body').animate(
866                {
867                  scrollTop: section.offset().top - num
868                },
869                'slow'
870              );
871            }, 100);
872          } else {
873            //console.log($(this).hasClass('active'));
874            //console.log($(this));
875            if ($(this).hasClass('active') && $(this).attr('href') != '') {
876              loadUrl = $(this).attr('href');
877              target = $(this).attr('data-target');
878
879              callAjaxContent(loadUrl, target, preloader);
880            }
881          }
882        });
883    });
884  });
885
886  //
887  $(function () {
888    $('.js-select').each(function () {
889      $(this).select2({
890        minimumResultsForSearch: Infinity,
891        placeholder: $(this).attr('data-placeholder'),
892        tags: true
893      });
894    });
895  });
896  //$( '.section--with-filters__filter__inner' ).scroll(function() {
897  //    $(".js-select").select2("close");
898  //});
899
900  //подменю у главного меню
901  $(function () {
902    var menu = $('.js-main-menu-hover'),
903      under = $('.main-menu-under'),
904      dropdown = $('.js-dropdown'),
905      hoverInner = $('.hover--inner'),
906      dropdownInner = $('.dropdown--inner'),
907      headerControls = $('.header__controls'),
908      h = 0;
909
910    function reset() {
911      under.removeClass('visible');
912      dropdown.removeClass('visible');
913      dropdownInner.removeClass('visible');
914      menu.removeClass('active');
915      h = 0;
916    }
917
918    menu.on('mouseenter', function () {
919      var $this = $(this),
920        num = $this.attr('data-dropdown');
921
922      if (num != undefined) {
923        var width = $this.offset(),
924          id = $('#' + num);
925
926        $this.addClass('active');
927        dropdown.removeClass('visible');
928
929        id.addClass('visible').css('left', width.left);
930        under.addClass('visible');
931        under.css('height', id.height());
932
933        $('.main-controls__button').removeClass('active');
934        $('.main-controls-section-block').removeClass('opened');
935
936        h = id.height();
937        //console.log(h);
938      } else {
939        $this.removeClass('active');
940        reset();
941      }
942    });
943
944    menu.on('mouseout', function () {
945      menu.removeClass('active');
946    });
947
948    // код скрипта изменен бэкендером!
949    //это также потребовало внесения изменений в верстку:
950    //класс hover--inner теперь присвоен не <a>, а <li>,
951    //зато теперь меню можно наращивать сколько угодно,
952    //хотя, возможно, фронтендер напишет это более грамотно
953    hoverInner.on('mouseenter', function () {
954      var thisHeight = 0;
955      $(this).children('ul').addClass('visible');
956
957      if ($(this).children('ul').height() > h) {
958        under.css('height', $(this).children('ul').height());
959      }
960    });
961    hoverInner.on('mouseleave', function () {
962      //console.log($(this).attr("id"));
963      $(this).children('ul').removeClass('visible');
964    });
965    under.on('mouseleave', function () {
966      reset();
967    });
968    headerControls.on('mouseenter', function () {
969      reset();
970    });
971  });
972
973  var $grid = $('.js-grid--desktop').imagesLoaded(function () {
974    //console.log($('.js-grid--desktop').data('masonry'));
975    $grid.masonry({
976      // options
977
978      itemSelector: '.grid-item',
979      columnWidth: '.grid-sizer'
980    });
981  });
982
983  function masonryForDesktop() {
984    //console.log("922");
985    var $gridDesktop = $('.js-grid--desktop').imagesLoaded(function () {
986      //console.log($('.js-grid--desktop').data('masonry'));
987      $gridDesktop.masonry({
988        // options
989
990        itemSelector: '.grid-item',
991        columnWidth: '.grid-sizer'
992      });
993
994      if ($(window).width() < 1024) {
995        $gridDesktop.masonry('destroy');
996      } else $gridDesktop;
997    });
998  }
999  masonryForDesktop();
1000
1001  function blindVersion() {
1002    var html = $('html'),
1003      body = $('body'),
1004      img = $('img'),
1005      contrast = $('.js-contrast-version'),
1006      normal = $('.js-normal-version'),
1007      font = $('.js-font'),
1008      contrastCookie = getCookie('contrast'),
1009      imgCookie = getCookie('img'),
1010      fontCookie = getCookie('font');
1011
1012    function show() {
1013      $('img').show();
1014      $('svg').show();
1015      $('.video-container').show();
1016      $('.video-preview').show();
1017    }
1018    function hide() {
1019      $('svg').hide();
1020      $('img').hide();
1021      $('.video-container').hide();
1022      $('.video-preview').hide();
1023    }
1024
1025    contrast.on('click', function () {
1026      html.addClass('contrast');
1027      $(this).addClass('active');
1028      normal.removeClass('active');
1029      hide();
1030      setCookie('contrast', 'on');
1031
1032      $grid.masonry();
1033    });
1034    normal.on('click', function () {
1035      html.removeClass('contrast');
1036      $(this).addClass('active');
1037      contrast.removeClass('active');
1038      show();
1039      setCookie('contrast', 'off');
1040
1041      $grid.masonry();
1042    });
1043
1044    if (contrastCookie == 'on') {
1045      contrast.addClass('active');
1046      normal.removeClass('active');
1047      html.addClass('contrast');
1048      // img.hide();
1049      hide();
1050      $grid.masonry();
1051    } else {
1052      contrast.removeClass('active');
1053      normal.addClass('active');
1054      html.removeClass('contrast');
1055      show();
1056      $grid.masonry();
1057    }
1058  }
1059  blindVersion();
1060
1061  function adaptiveText() {
1062    var textAdditional = $('.text-additional'),
1063      textAdditionalHtml = textAdditional.html(),
1064      textMain = $('.js-text-main'),
1065      textMainHtml = textMain.html();
1066
1067    /*if ($('.additional-text').length > 0) {
1068			if ($(window).width() < 1024) {
1069				if ($('.add').length < 1) {
1070					textMain.append('<div class="add">' + textAdditionalHtml + '</div>');
1071					textMain.children('p,div').not(':first-child').wrapAll('<div class="wrapit" />');
1072					textMain.children('p:first-child').append('<button class="underline-text more-text color-warm-grey-two js-btn-more-text"><span class="text">ЧИТАТЬ ДАЛЬШЕ</span></button>');
1073				}
1074				$('.js-btn-more-text').on('click', function () {
1075					$('.wrapit').addClass('show');
1076					$(this).addClass('hide');
1077				});
1078			}
1079			if ($(window).width() >= 1024) {
1080				textMain.children('.wrapit').children().unwrap();
1081				$('.add').remove();
1082				$('.js-btn-more-text').remove();
1083			}
1084		}*/
1085  }
1086
1087  adaptiveText();
1088
1089  var lightGallery = $('.js-gallery').lightGallery({
1090    selector: '.js-gallery-item',
1091    counter: false,
1092    download: false,
1093    pager: true,
1094    actualSize: false,
1095    zoom: false,
1096    thumbnail: false,
1097    share: false,
1098    fullScreen: false,
1099    autoplayControls: false,
1100    enableSwipe: false,
1101    enableDrag: true,
1102    hideBarsDelay: 999999
1103  });
1104
1105  function adaptiveLightGallery() {
1106    if ($(window).width() < 580) {
1107      function logic() {
1108        $('.lg-sub-html').wrapInner('<div class="lg-sub-html__inner js-lg-info"></div>');
1109        $('.lg-sub-html').prepend('<div class="lg-sub-html__badge js-lg-info-call">i</div>');
1110        $('.lg-sub-html__inner').prepend('<div class="close js-lg-info-close"></div><div class="lg-sub-html__head">Информация</div> ');
1111        $('.js-lg-info-call').on('click', function () {
1112          $('.js-lg-info').addClass('show');
1113          $('.lg-outer').addClass('lg-outer-back');
1114        });
1115        $('.js-lg-info-close').on('click', function () {
1116          $('.js-lg-info').removeClass('show');
1117          $('.lg-outer').removeClass('lg-outer-back');
1118        });
1119      }
1120      lightGallery.on('onAferAppendSlide.lg', function () {
1121        if ($('.js-lg-info').length < 1) {
1122          logic();
1123        }
1124      });
1125      lightGallery.on('onAfterSlide.lg', function () {
1126        if ($('.js-lg-info').length < 1) {
1127          logic();
1128        }
1129      });
1130    }
1131  }
1132  adaptiveLightGallery();
1133
1134  //кнопка вернуться назад
1135  $('.js-go-to-prev').on('click', function (e) {
1136    e.preventDefault();
1137    window.history.go(-1);
1138  });
1139
1140  //выбираем случайный фон для страницы 404, сам объект pageNotFoundObj находится на странице
1141  function setRandomBackground() {
1142    if (typeof pageNotFoundObj != 'undefined') {
1143      var randomNum = getRandomInt(0, pageNotFoundObj.length - 1);
1144      //console.log(pageNotFoundObj[randomNum].pic);
1145      $('.js-full-page-background').css('background-image', 'url(' + pageNotFoundObj[randomNum].pic + ')');
1146      $('.js-full-page-background-title').html(pageNotFoundObj[randomNum].desc);
1147    }
1148  }
1149  setRandomBackground();
1150
1151  //кнопка показать больше текста
1152  function btnMoreText() {
1153    // $(".js-more-text").on('click',  function(){
1154    $(document).on('click', '.js-more-text', function () {
1155      //console.log("btn");
1156      $(this).prev('.js-additional-text').slideToggle(400);
1157      $(this).toggleClass('no-underline');
1158      $(this).find('.icon').toggleClass('show');
1159      buf = $(this).attr('rel');
1160      $(this).attr('rel', $(this).find('.text').text());
1161      $(this).children('.text').text(buf);
1162    });
1163  }
1164  btnMoreText();
1165
1166  //вызов попапа с описанием в мобильной версии на странице предмета коллекции
1167  $('.js-popup-description-call').on('click', function () {
1168    $(this).next('.js-popup-description').addClass('open');
1169  });
1170  $('.js-popup-description-close').on('click', function () {
1171    $(this).parent('.js-popup-description').removeClass('open');
1172  });
1173
1174  //плавный фокус на области со слайдером на странице предмета коллекции
1175  (function ($) {
1176    $(function () {
1177      var div = $('.slider--collection-item'),
1178        divHeight = div.height(),
1179        offset = div.offset(),
1180        windowPosition = $(window).scrollTop();
1181
1182      $(window).scroll(function () {
1183        clearTimeout($.data(this, 'scrollCheck'));
1184        windowPosition = $(window).scrollTop();
1185        $.data(
1186          this,
1187          'scrollCheck',
1188          setTimeout(function () {
1189            if (div.length > 0 && windowPosition > offset.top - 100 && windowPosition < offset.top + divHeight / 4) {
1190              $('html, body').animate({ scrollTop: offset.top });
1191            }
1192          }, 550)
1193        );
1194      });
1195    });
1196  })(jQuery);
1197
1198  //логика работы с картой этажей
1199  function mapFloors() {
1200    $('.floor-map').each(function () {
1201      var hall = $('.map-hall'),
1202        link = $('.map-link'),
1203        num = $('.num-link'),
1204        linksBlock = $('.map-links'),
1205        hallsBlock = $('.map-svg'),
1206        html = $('html');
1207
1208      function linkChangeColor(id, $this) {
1209        $('.map-hall[data-hall="' + id + '"]')
1210          .addClass('hover')
1211          .addClass('active');
1212        $this.addClass('hover');
1213        $this.addClass('active');
1214      }
1215
1216      function hallChangeColor(id, $this) {
1217        // console.log(id);
1218        linksBlock
1219          .find('#' + id)
1220          .addClass('hover')
1221          .addClass('active');
1222        $this.addClass('hover');
1223        $this.addClass('active');
1224      }
1225
1226      function mapChangeColorReset() {
1227        hall.removeClass('hover').removeClass('active');
1228        link.removeClass('hover').removeClass('active');
1229      }
1230
1231      if (html.hasAnyClass('ios', 'mobile', 'android')) {
1232        link.click(function (e) {
1233          if ($(this).hasClass('active') == true) {
1234            return true;
1235          } else {
1236            e.preventDefault();
1237            mapChangeColorReset();
1238            var $this = $(this),
1239              id = $this.attr('id');
1240
1241            linkChangeColor(id, $this);
1242          }
1243        });
1244        hall.click(function (e) {
1245          if ($(this).hasClass('active') == true) {
1246            return true;
1247          } else {
1248            e.preventDefault();
1249            mapChangeColorReset();
1250            var $this = $(this),
1251              id = $this.attr('data-hall');
1252
1253            hallChangeColor(id, $this);
1254          }
1255        });
1256      } else {
1257        link.hover(
1258          function () {
1259            var $this = $(this),
1260              id = $this.attr('id');
1261
1262            linkChangeColor(id, $this);
1263          },
1264          function () {
1265            mapChangeColorReset();
1266          }
1267        );
1268        num.hover(
1269          function () {
1270            var $this = $(this),
1271              id = $this.attr('data-num');
1272
1273            $('#' + id).addClass('hover');
1274
1275            linkChangeColor(id, $this);
1276          },
1277          function () {}
1278        );
1279        hall.hover(
1280          function () {
1281            var $this = $(this),
1282              id = $this.attr('data-hall');
1283            hallChangeColor(id, $this);
1284          },
1285          function () {
1286            mapChangeColorReset();
1287          }
1288        );
1289      }
1290    });
1291  }
1292
1293  //логика работы с кварталом, объект objQuarter на странице
1294  function mapQuarter() {
1295    var building = $('.quarter-building'),
1296      svg = $('.quarter-map'),
1297      popup = $('.quarter-popup'),
1298      name = $('.quarter-popup__name'),
1299      description = $('.quarter-popup__desc'),
1300      html = $('html');
1301
1302    if (html.hasAnyClass('ios', 'mobile', 'android')) {
1303      building.click(function (e) {
1304        if ($(this).hasClass('active') == true) {
1305          return true;
1306        } else {
1307          building.removeClass('active').removeClass('filled');
1308          e.preventDefault();
1309          var $this = $(this),
1310            svgOffsetTop = svg.offset().top,
1311            id = $this.attr('data-quarter');
1312          var offsetLeft = $this.position().left;
1313          var offsetTop = $this.position().top;
1314          //console.log(objQuarter[id].name, $this);
1315          $this.addClass('filled');
1316          name.html(objQuarter[id].name);
1317          description.html(objQuarter[id].description);
1318          var height = popup.innerHeight();
1319          popup.css({ top: offsetTop - svgOffsetTop - height + 50, left
1319: offsetLeft - 150 }).addClass('visible');
1320
1321          $this.addClass('active');
1322        }
1323      });
1324    } else {
1325      building.hover(
1326        function () {
1327          var $this = $(this),
1328            svgOffsetTop = svg.offset().top,
1329            id = $this.attr('data-quarter');
1330
1331          // linkChangeColor(id, $this);
1332          var offsetLeft = $this.position().left;
1333          var offsetTop = $this.position().top;
1334          //console.log(objQuarter[id].name, $this);
1335          $this.addClass('filled');
1336          name.html(objQuarter[id].name);
1337          description.html(objQuarter[id].description);
1338          var height = popup.innerHeight();
1339          popup.css({ top: offsetTop - svgOffsetTop - height + 50, left: offsetLeft - 150 }).addClass('visible');
1340        },
1341        function () {
1342          popup.removeClass('visible');
1343          building.removeClass('filled');
1344        }
1345      );
1346    }
1347  }
1348  mapQuarter();
1349
1350  var arrResult = [];
1351  /* $('.form-search').on('submit', function (e) {
1352			 e.preventDefault();
1353			 var val = $(this).find('input').val();
1354
1355			 arrResult.push(val);
1356
1357			 search('/php/search.php');
1358
1359			 notifsTop.removeClass('hidden');
1360			 burger.removeClass("active");
1361			 menu.removeClass("opened");
1362
1363
1364			 //console.log(arrResult);
1365	 });*/
1366
1367  function search(loadUrl, target, preloader) {
1368    var div = $('.search--section');
1369    $.get(loadUrl, { lang: 'ru', needle: arrResult[0] }, function (data) {
1370      div.html(data);
1371      // tabs();
1372      $('[data-toggle="tab"]').click(function (e) {
1373        $(this).tab('show');
1374      });
1375      contentControl();
1376
1377      //searchResultsMore();
1378      $('.search-val').html(arrResult[0]);
1379    })
1380      .done(function () {
1381        $(preloader).css('display', 'none');
1382      })
1383      .fail(function () {
1384        $(target).html('Что-то пошло не так...');
1385        $(preloader).css('display', 'none');
1386      })
1387      .always(function () {});
1388  }
1389
1390  function searchResultsMore() {
1391    var item = $('.search-results li'),
1392      btn = $('.js-btn-more-items'),
1393      num = 20;
1394
1395    if (item.length <= num) {
1396      btn.hide();
1397    }
1398
1399    item.slice(0, num).show();
1400
1401    var clicks = num / 2;
1402
1403    btn.click(function (e) {
1404      e.preventDefault();
1405
1406      clicks = clicks * 2; //
1407      $('.search-results li:hidden').slice(0, clicks).show().addClass('animated slideInUp');
1408      if ($('.search-results li:hidden').length == 0) {
1409        $(this).hide();
1410      }
1411    });
1412  }
1413
1414  $(function () {
1415    var wrap = $('.js-marquee-wrap'),
1416      block = $('.js-marquee'),
1417      blockWidth = block.width(),
1418      wrapWidth = wrap.width();
1419       
1420    console.log(blockWidth, wrapWidth);
1421       if (blockWidth < wrapWidth) {
1422      diffWidth = wrapWidth + 400 - blockWidth;
1423       }
1424    //if (blockWidth >= wrapWidth) {
1425      //console.log('ads');
1426      wrap.addClass('marquee-on');
1427      block.marquee({
1428        //speed in milliseconds of the marquee
1429        duration: 80000,
1430        //gap in pixels between the tickers
1431        gap: blockWidth < wrapWidth ? diffWidth : 400,
1432        //time in milliseconds before the marquee will start animating
1433        delayBeforeStart: 500,
1434        //'left' or 'right'
1435        direction: 'left',
1436        pauseOnHover: true,
1437        startVisible: true,
1438        //true or false - should the marquee be duplicated to show an effect of continues flow
1439        duplicated: true
1440      });
1441    //}
1442  });
1443
1444  if (window.location.toString().indexOf('/site/') == 0) {
1445    //console.log("0");
1446    //текст кнопок для шеринга
1447    //$('.ya-share2__item_service_facebook .ya-share2__title').html('Поделиться в Facebook');
1448    $('.ya-share2__item_service_vkontakte .ya-share2__title').html('Поделиться в Vk.com');
1449    $('.ya-share2__item_service_telegram .ya-share2__title').html('Поделиться в Telegram');
1450    //$('.ya-share2__item_service_twitter .ya-share2__title').html('Поделиться в Twitter');
1451
1452    $('.js-btn-share').click(function (e) {
1453      e.stopPropagation(); //console.log("share");
1454      $(this).next('.js-btn-share-block').toggleClass('open');
1455      $(this).toggleClass('color-greyish-brown');
1456    });
1457  } else {
1458    //console.log(window.location.toString().indexOf("/site/"));
1459  }
1460
1461  //определяем размеры картинок лого партнеров
1462  $('.js-pics-count').each(function () {
1463    var $this = $(this).find('.logo-partner');
1464
1465    if ($this.length > 1) {
1466      $this.addClass('logo-partner--several');
1467    }
1468  });
1469
1470  //правильный пересчет функций на ресайз
1471  var resizeFn = debounce(function () {
1472    accordion();
1473    adaptiveText();
1474    multipleItemsSliderSettings();
1475    masonryForDesktop();
1476    //console.log('Ресайз окна, слайдер встал на место');
1477  }, 300);
1478
1479  //resizeFn();
1480
1481  $(window).on('resize', resizeFn);
1482  //$(document).ready(resizeFn);
1483  //$(document).on("page:load", resizeFn);
1484  //$(window).load(resizeFn);
1485});
1486
1487/* Для страницы друзья музея */
1488$('.cards-full-info').next().hide();
1489$('.cards-full-info').click(function () {
1490  //console.log($(this).next());
1491  $(this).next().slideToggle(); //console.log($('.cards-full-info').not(this).next().stop(true, true));
1492  $('.cards-full-info').not(this).next().stop(true, true).slideUp();
1493});
1494
1495$('.menu-mobile__list li .stop-event').one('click', false);
1496$('.hidden-submenu li a').trigger('click');
1497
1498/* Скрипт для кнопки, которая скрывает следующий за ним блок */
1499$('.custom-filter-btn').next().hide();
1500
1501$('.custom-filter-btn').click(function () {
1502  $(this).next().toggle();
1503  $('.custom-filter-btn').not(this).next().stop(true, true).slideUp();
1504  $(this).toggleClass('opened');
1505});
1506
1507//Подсветка филиалов
1508
1509$('a').on('mouseenter', function () {
1510  $(`[data-id="${$(this).attr('id')}"`).css('fill', '#5323AD');
1511});
1512$('a').on('mouseleave', function () {
1513  $(`[data-id="${$(this).attr('id')}"`).css('fill', '#fff');
1514});
1515
1516//для popup с видео
1517$('.popup-video').magnificPopup({
1518  type: 'iframe',
1519  mainClass: 'mfp-fade',
1520  removalDelay: 160,
1521  preloader: false,
1522
1523  fixedContentPos: false
1524});
1525jQuery(window).on('load', function () {
1526  jQuery(window).resize();
1527});
1528
1529if (document.querySelector('.scroll-top')) {
1530  window.addEventListener('scroll', scrollHeaderFunction);
1531
1532  function scrollHeaderFunction() {
1533    let scrollValue = window.scrollY;
1534    const header = document.querySelector('.header');
1535    if (scrollValue > 500) {
1536      document.querySelector('.scroll-top').style.display = 'block';
1537    } else {
1538      document.querySelector('.scroll-top').style.display = 'none';
1539    }
1540  }
1541}

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.