1$(document).ready(function(){ 2 $(document).on('click','.js-catalogItem__changeOffer',change_off); 3 $(document).on('click','.js-show-archive',function(e){ 4 var $archiveContainer = $(this).closest('.catalogSection__list--archive'); 5 var $wrapper = $(this).closest('.js-catalog-wrapper'); 6 var $mainPagination = $wrapper.find('.js-paginationWrapper[data-pagination-scope="main"]'); 7 var $archivePagination = $wrapper.find('.js-paginationWrapper[data-pagination-scope="archive"]'); 8 $archiveContainer.addClass('_show'); 9 var paginationItems = $archivePagination.length ? $archivePagination.find('.pagination__item') : $wrapper.find('.pagination__item'); 10 paginationItems.show(); 11 paginationItems.removeClass('hidden'); 12 paginationItems.each(function () { 13 $(this).find('.pagination__link').show(); 14 $(this).find('.pagination__link').removeClass("hidden"); 15 }); 16 if ($archivePagination.length) { 17 $mainPagination.hide(); 18 $archivePagination.removeAttr('style').show(); 19 $archivePagination.find('.paginationShowMoreWrapper').show(); 20 $archivePagination.find('.js-showMore').show(); 21 $archivePagination.find('.pagination__link--dots').show(); 22 $archivePagination.find('.pagination__next').show(); 23 } else { 24 $wrapper.find('.paginationShowMoreWrapper').show(); 25 $wrapper.find('.js-showMore').show(); 26 $wrapper.find('.pagination__link--dots').show(); 27 $wrapper.find('.pagination__next').show(); 28 } 29 $(this).remove(); 30 if(typeof calcMaxCardHeight === 'function'){ 31 calcMaxCardHeight($archiveContainer); 32 } 33 updateArchivePreviewHeight($archiveContainer); 34 }); 35 36 initArchivePreviewHeightWatcher(); 37}); 38 39function initArchivePreviewHeightWatcher() { 40 var updateHandler = function() { 41 updateArchivePreviewHeight(); 42 }; 43 44 updateHandler(); 45 $(window) 46 .off('.archivePreview') 47 .on('load.archivePreview resize.archivePreview', updateHandler); 48} 49 50function updateArchivePreviewHeight($context) { 51 var $containers = ($context && $context.length) ? $context : $('.catalogSection__list--archive'); 52 53 $containers.each(function() { 54 var $archive = $(this); 55 if ($archive.hasClass('_show')) { 56 $archive.css('--archive-preview-height', ''); 57 return; 58 } 59 60 var $wrap = $archive.find('.js-catalogSection__listWrap'); 61 var $items = $wrap.find('.js-catalogItem:visible'); 62 63 if (!$items.length) { 64 $archive.css('--archive-preview-height', ''); 65 return; 66 } 67 68 var firstRowTop = null; 69 var firstRowBottom = 0; 70 71 $items.each(function() { 72 var topPosition = $(this).position().top; 73 74 if (firstRowTop === null || topPosition < firstRowTop) { 75 firstRowTop = topPosition; 76 } 77 }); 78 79 if (firstRowTop === null) { 80 return; 81 } 82 83 $items.each(function() { 84 var $item = $(this); 85 var topPosition = $item.position().top; 86 87 if (Math.abs(topPosition - firstRowTop) <= 2) { 88 var bottom = topPosition + $item.outerHeight(true); 89 if (bottom > firstRowBottom) { 90 firstRowBottom = bottom; 91 } 92 } 93 }); 94 95 if (firstRowBottom > 0) { 96 $archive.css('--archive-preview-height', firstRowBottom + 'px'); 97 } 98 }); 99}
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.