PageSourceSearch

https://nuovavita.ru/catalog/view/theme/unishop2/js/showmore-ajaxpagination.js

js nuovavita.ru collected 2026-10-09 22:43:07 UTC 3,389 bytes, 107 lines download raw bytes

1$(function() {
2	if(uniJsVars.showmore && $('.product-layout').length) {
3		let btnHtml = '<div class="show-more" style="margin:15px 0 30px;text-align:center"><button type="button" class="show-more__btn btn btn-xl btn-default"><i class="show-more__icon fas fa-arrow-rotate-right"></i><span>'+uniJsVars.showmore_text+'</span></button></div>';
4		
5		if($('.pagination').find('.active').next().length){
6			$('.pagination').before(btnHtml);
7		}
8		
9		let observer = new MutationObserver((e) => {
10			if(!$('.show-more').length) $('.pagination').before(btnHtml);
11			
12			if($('.pagination').find('.active').next().length) {
13				$('.show-more').show();
14			} else {
15				$('.show-more').hide();
16			}
17		});
18		
19		if($('.pagination-text').length) {
20			observer.observe($('.pagination-text')[0], {childList:true, subtree:true});
21		}
22		
23		$(document).on('click', '.show-more__btn', function() {
24			let pagination = $('.pagination'),
25				pagination_text = $('.pagination-text'),
26				products = $('.products-block'),
27				showmoreIcon = $(this).find('.show-more__icon'),
28				url = pagination.find('.active').next().find('a').attr('href');
29			
30			if(typeof(url) == 'undefined' || url == '') return;
31			
32			if (document.location.protocol == 'https:') url = url.replace('http:', 'https:');
33	
34			$.ajax({
35				url: url,
36				type: 'get',
37				dataType: 'html',
38				beforeSend: function() {
39					showmoreIcon.addClass('spin');
40				},
41				complete: function() {
42					$.each($('.products-block .product-thumb a'), function() {
43						$(this).attr('target', '_blank');
44					});
45				},
46				success: function(data) {
47					let result = $(data);
48						
49					result.find('.product-thumb').hide();
50					
51					products.append(result.find('.products-block').html()).find('.product-thumb').fadeIn('slow');
52					pagination.html(result.find('.pagination').html());
53					
54					let textString = result.find('.pagination-text').text();
55					
56					//if(document.location.search.indexOf('page') == -1) {
57					//	let textArr = result.find('.pagination-text').text().split(' ');
58					//	textArr[2] = 1;
59					//	textString = textArr.join(' ');
60					//}
61					
62					pagination_text.text(textString);
63					
64					showmoreIcon.removeClass('spin');
65					uniSelectView.init();
66					window.history.pushState('', '', url);
67				},
68			});
69		});
70	}
71
72	if(uniJsVars.ajax_pagination && $('.products-block').length) {
73		$(document).on('click', '.pagination a', function(e) {
74		
75			e.preventDefault();
76			
77			let pagination = $('.pagination'),
78				pagination_text = $('.pagination-text'),
79				products = $('.products-block'),
80				url = $(this).attr('href');
81			
82			if (document.location.protocol == 'https:') url = url.replace('http:', 'https:');
83	
84			$.ajax({
85				url: url,
86				type: 'get',
87				dataType: 'html',
88				beforeSend: function() {
89					$('html body').append('<div class="full-width-loading"></div>');
90				},
91				complete: function() {
92					uniSelectView.init();
93					uniScrollTo('.products-block');
94				},
95				success: function(data) {
96					products.html($(data).find('.products-block').html());
97					pagination.html($(data).find('.pagination').html());
98					pagination_text.text($(data).find('.pagination-text').text());
99				
100					$('.full-width-loading').remove();
101				
102					window.history.pushState('', '', url);
103				}
104			});
105		});
106	}
107});

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.