PageSourceSearch

https://yes-auto.ru/local/templates/.default/components/bitrix/cat…/buy.catalog/script.js?15165877327949

js yes-auto.ru collected 2026-09-28 08:44:38 UTC 7,949 bytes, 349 lines download raw bytes

1(function() {
2	'use strict';
3
4	if (!!window.JCCatalogSectionComponent)
5		return;
6
7	window.JCCatalogSectionComponent = function(params) {
8		this.formPosting = false;
9		this.siteId = params.siteId || '';
10		this.ajaxId = params.ajaxId || '';
11		this.template = params.template || '';
12		this.componentPath = params.componentPath || '';
13		this.parameters = params.parameters || '';
14
15		if (params.navParams)
16		{
17			this.navParams = {
18				NavNum: params.navParams.NavNum || 1,
19				NavPageNomer: parseInt(params.navParams.NavPageNomer) || 1,
20				NavPageCount: parseInt(params.navParams.NavPageCount) || 1
21			};
22		}
23
24		this.bigData = params.bigData || {enabled: false};
25		this.container = document.querySelector('[data-entity="' + params.container + '"]');
26		this.showMoreButton = null;
27		this.showMoreButtonMessage = null;
28
29		if (this.bigData.enabled && BX.util.object_keys(this.bigData.rows).length > 0)
30		{
31			BX.cookie_prefix = this.bigData.js.cookiePrefix || '';
32			BX.cookie_domain = this.bigData.js.cookieDomain || '';
33			BX.current_server_time = this.bigData.js.serverTime;
34
35			BX.ready(BX.delegate(this.bigDataLoad, this));
36		}
37
38		if (params.initiallyShowHeader)
39		{
40			BX.ready(BX.delegate(this.showHeader, this));
41		}
42
43		if (params.deferredLoad)
44		{
45			BX.ready(BX.delegate(this.deferredLoad, this));
46		}
47
48		if (params.lazyLoad)
49		{
50			this.showMoreButton = document.querySelector('[data-use="show-more-' + this.navParams.NavNum + '"]');
51			this.showMoreButtonMessage = this.showMoreButton.innerHTML;
52			BX.bind(this.showMoreButton, 'click', BX.proxy(this.showMore, this));
53		}
54
55		if (params.loadOnScroll)
56		{
57			BX.bind(window, 'scroll', BX.proxy(this.loadOnScroll, this));
58		}
59	};
60
61	window.JCCatalogSectionComponent.prototype =
62	{
63		checkButton: function()
64		{
65			if (this.showMoreButton)
66			{
67				if (this.navParams.NavPageNomer == this.navParams.NavPageCount)
68				{
69					BX.remove(this.showMoreButton);
70				}
71				else
72				{
73					this.container.appendChild(this.showMoreButton);
74				}
75			}
76		},
77
78		enableButton: function()
79		{
80			if (this.showMoreButton)
81			{
82				BX.removeClass(this.showMoreButton, 'disabled');
83				this.showMoreButton.innerHTML = this.showMoreButtonMessage;
84			}
85		},
86
87		disableButton: function()
88		{
89			if (this.showMoreButton)
90			{
91				BX.addClass(this.showMoreButton, 'disabled');
92				this.showMoreButton.innerHTML = BX.message('BTN_MESSAGE_LAZY_LOAD_WAITER');
93			}
94		},
95
96		loadOnScroll: function()
97		{
98			var scrollTop = BX.GetWindowScrollPos().scrollTop,
99				containerBottom = BX.pos(this.container).bottom;
100
101			if (scrollTop + window.innerHeight > containerBottom)
102			{
103				this.showMore();
104			}
105		},
106
107		showMore: function()
108		{
109			if (this.navParams.NavPageNomer < this.navParams.NavPageCount)
110			{
111				var data = {};
112				data['action'] = 'showMore';
113				data['PAGEN_' + this.navParams.NavNum] = this.navParams.NavPageNomer + 1;
114
115				if (!this.formPosting)
116				{
117					this.formPosting = true;
118					this.disableButton();
119					this.sendRequest(data);
120				}
121			}
122		},
123
124		bigDataLoad: function()
125		{
126			var url = 'https://analytics.bitrix.info/crecoms/v1_0/recoms.php',
127				data = BX.ajax.prepareData(this.bigData.params);
128
129			if (data)
130			{
131				url += (url.indexOf('?') !== -1 ? '&' : '?') + data;
132			}
133
134			var onReady = BX.delegate(function(result){
135				this.sendRequest({
136					action: 'deferredLoad',
137					bigData: 'Y',
138					items: result && result.items || [],
139					rid: result && result.id,
140					count: this.bigData.count,
141					rowsRange: this.bigData.rowsRange,
142					shownIds: this.bigData.shownIds
143				});
144			}, this);
145
146			BX.ajax({
147				method: 'GET',
148				dataType: 'json',
149				url: url,
150				timeout: 3,
151				onsuccess: onReady,
152				onfailure: onReady
153			});
154		},
155
156		deferredLoad: function()
157		{
158			this.sendRequest({action: 'deferredLoad'});
159		},
160
161		sendRequest: function(data)
162		{
163			var defaultData = {
164				siteId: this.siteId,
165				template: this.template,
166				parameters: this.parameters
167			};
168
169			if (this.ajaxId)
170			{
171				defaultData.AJAX_ID = this.ajaxId;
172			}
173
174			BX.ajax({
175				url: this.componentPath + '/ajax.php' + (document.location.href.indexOf('clear_cache=Y') !== -1 ? '?clear_cache=Y' : ''),
176				method: 'POST',
177				dataType: 'json',
178				timeout: 60,
179				data: BX.merge(defaultData, data),
180				onsuccess: BX.delegate(function(result){
181					if (!result || !result.JS)
182						return;
183
184					BX.ajax.processScripts(
185						BX.processHTML(result.JS).SCRIPT,
186						false,
187						BX.delegate(function(){this.showAction(result, data);}, this)
188					);
189				}, this)
190			});
191		},
192
193		showAction: function(result, data)
194		{
195			if (!data)
196				return;
197
198			switch (data.action)
199			{
200				case 'showMore':
201					this.processShowMoreAction(result);
202					break;
203				case 'deferredLoad':
204					this.processDeferredLoadAction(result, data.bigData === 'Y');
205					break;
206			}
207		},
208
209		processShowMoreAction: function(result)
210		{
211			this.formPosting = false;
212			this.enableButton();
213
214			if (result)
215			{
216				this.navParams.NavPageNomer++;
217				this.processItems(result.items);
218				this.processPagination(result.pagination);
219				this.checkButton();
220			}
221		},
222
223		processDeferredLoadAction: function(result, bigData)
224		{
225			if (!result)
226				return;
227
228			var position = bigData ? this.bigData.rows : {};
229
230			this.processItems(result.items, BX.util.array_keys(position));
231		},
232
233		processItems: function(itemsHtml, position)
234		{
235			if (!itemsHtml)
236				return;
237
238			var processed = BX.processHTML(itemsHtml, false),
239				temporaryNode = BX.create('DIV');
240
241			var items, k, origRows;
242
243			temporaryNode.innerHTML = processed.HTML;
244			items = temporaryNode.querySelectorAll('[data-entity="items-row"]');
245
246			if (items.length)
247			{
248				this.showHeader(true);
249
250				for (k in items)
251				{
252					if (items.hasOwnProperty(k))
253					{
254						origRows = position ? this.container.querySelectorAll('[data-entity="items-row"]') : false;
255						items[k].style.opacity = 0;
256
257						if (origRows && BX.type.isDomNode(origRows[position[k]]))
258						{
259							origRows[position[k]].parentNode.insertBefore(items[k], origRows[position[k]]);
260						}
261						else
262						{
263							this.container.appendChild(items[k]);
264						}
265					}
266				}
267
268				new BX.easing({
269					duration: 2000,
270					start: {opacity: 0},
271					finish: {opacity: 100},
272					transition: BX.easing.makeEaseOut(BX.easing.transitions.quad),
273					step: function(state){
274						for (var k in items)
275						{
276							if (items.hasOwnProperty(k))
277							{
278								items[k].style.opacity = state.opacity / 100;
279							}
280						}
281					},
282					complete: function(){
283						for (var k in items)
284						{
285							if (items.hasOwnProperty(k))
286							{
287								items[k].removeAttribute('style');
288							}
289						}
290					}
291				}).animate();
292			}
293
294			BX.ajax.processScripts(processed.SCRIPT);
295		},
296
297		processPagination: function(paginationHtml)
298		{
299			if (!paginationHtml)
300				return;
301
302			var pagination = document.querySelectorAll('[data-pagination-num="' + this.navParams.NavNum + '"]');
303			for (var k in pagination)
304			{
305				if (pagination.hasOwnProperty(k))
306				{
307					pagination[k].innerHTML = paginationHtml;
308				}
309			}
310		},
311
312		showHeader: function(animate)
313		{
314			var parentNode = BX.findParent(this.container, {attr: {'data-entity': 'parent-container'}}),
315				header;
316
317			if (parentNode && BX.type.isDomNode(parentNode))
318			{
319				header = parentNode.querySelector('[data-entity="header"');
320
321				if (header && header.getAttribute('data-showed') != 'true')
322				{
323					header.style.display = '';
324
325					if (animate)
326					{
327						new BX.easing({
328							duration: 2000,
329							start: {opacity: 0},
330							finish: {opacity: 100},
331							transition: BX.easing.makeEaseOut(BX.easing.transitions.quad),
332							step: function(state){
333								header.style.opacity = state.opacity / 100;
334							},
335							complete: function(){
336								header.removeAttribute('style');
337								header.setAttribute('data-showed', 'true');
338							}
339						}).animate();
340					}
341					else
342					{
343						header.style.opacity = 100;
344					}
345				}
346			}
347		}
348	};
349})();

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.