PageSourceSearch

https://csk66.ru/local/components/dev/bx.catalog.section/templates/hits/script.js?17650441098956

js csk66.ru collected 2026-10-07 15:47:39 UTC 8,956 bytes, 370 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['origin_url'] = window.location.pathname;
114				data['PAGEN_' + this.navParams.NavNum] = this.navParams.NavPageNomer + 1;
115
116				if (!this.formPosting)
117				{
118					this.formPosting = true;
119					this.disableButton();
120					this.sendRequest(data);
121				}
122			}
123		},
124
125		bigDataLoad: function()
126		{
127			var url = 'https://analytics.bitrix.info/crecoms/v1_0/recoms.php',
128				data = BX.ajax.prepareData(this.bigData.params);
129
130			if (data)
131			{
132				url += (url.indexOf('?') !== -1 ? '&' : '?') + data;
133			}
134
135			var onReady = BX.delegate(function(result){
136				this.sendRequest({
137					action: 'deferredLoad',
138					bigData: 'Y',
139					items: result && result.items || [],
140					rid: result && result.id,
141					count: this.bigData.count,
142					rowsRange: this.bigData.rowsRange,
143					shownIds: this.bigData.shownIds
144				});
145			}, this);
146
147			BX.ajax({
148				method: 'GET',
149				dataType: 'json',
150				url: url,
151				timeout: 3,
152				onsuccess: onReady,
153				onfailure: onReady
154			});
155		},
156
157		deferredLoad: function()
158		{
159			this.sendRequest({action: 'deferredLoad'});
160		},
161
162		sendRequest: function(data)
163		{
164			var defaultData = {
165				siteId: this.siteId,
166				template: this.template,
167				parameters: this.parameters
168			};
169
170			if (this.ajaxId)
171			{
172				defaultData.AJAX_ID = this.ajaxId;
173			}
174			
175			console.log(BX.merge(defaultData, data))
176			BX.ajax({
177				url: this.componentPath + '/ajax.php' + (document.location.href.indexOf('clear_cache=Y') !== -1 ? '?clear_cache=Y' : ''),
178				method: 'POST',
179				dataType: 'json',
180				timeout: 60,
181				data: BX.merge(defaultData, data),
182				onsuccess: BX.delegate(function(result){
183					if (!result || !result.JS)
184						return;
185
186					BX.ajax.processScripts(
187						BX.processHTML(result.JS).SCRIPT,
188						false,
189						BX.delegate(function(){this.showAction(result, data);}, this)
190					);
191				}, this)
192			});
193		},
194
195		showAction: function(result, data)
196		{
197			if (!data)
198				return;
199
200			switch (data.action)
201			{
202				case 'showMore':
203					this.processShowMoreAction(result);
204					break;
205				case 'deferredLoad':
206					this.processDeferredLoadAction(result, data.bigData === 'Y');
207					break;
208			}
209		},
210
211		processShowMoreAction: function(result)
212		{
213			this.formPosting = false;
214			this.enableButton();
215
216			if (result)
217			{
218				this.navParams.NavPageNomer++;
219				this.processItems(result.items);
220				this.processPagination(result.pagination);
221				this.processEpilogue(result.epilogue);
222				this.checkButton();
223			}
224		},
225
226		processDeferredLoadAction: function(result, bigData)
227		{
228			if (!result)
229				return;
230
231			var position = bigData ? this.bigData.rows : {};
232
233			this.processItems(result.items, BX.util.array_keys(position));
234		},
235
236		processItems: function(itemsHtml, position)
237		{
238			if (!itemsHtml)
239				return;
240
241			var processed = BX.processHTML(itemsHtml, false),
242				temporaryNode = BX.create('DIV');
243
244			var items, k, origRows;
245
246			temporaryNode.innerHTML = processed.HTML;
247			items = temporaryNode.querySelectorAll('[data-entity="items-row"]');
248			if (items.length)
249			{
250				this.showHeader(true);
251
252				for (k in items)
253				{
254					if (items.hasOwnProperty(k))
255					{
256						origRows = position ? this.container.querySelectorAll('[data-entity="items-row"]') : false;
257						items[k].style.opacity = 0;
258
259						if (origRows && BX.type.isDomNode(origRows[position[k]]))
260						{
261							origRows[position[k]].parentNode.insertBefore(items[k], origRows[position[k]]);
262						}
263						else
264						{
265							this.container.appendChild(items[k]);
266						}
267					}
268				}
269
270				new BX.easing({
271					duration: 2000,
272					start: {opacity: 0},
273					finish: {opacity: 100},
274					transition: BX.easing.makeEaseOut(BX.easing.transitions.quad),
275					step: function(state){
276						for (var k in items)
277						{
278							if (items.hasOwnProperty(k))
279							{
280								items[k].style.opacity = state.opacity / 100;
281							}
282						}
283					},
284					complete: function(){
285						for (var k in items)
286						{
287							if (items.hasOwnProperty(k))
288							{
289								items[k].removeAttribute('style');
290							}
291						}
292					}
293				}).animate();
294			}
295			
296			window['catalog-pagination'] = parseInt(this.navParams.NavPageNomer);
297			if (!$.isNumeric(window['catalog-pagination'])) {
298				window['catalog-pagination'] = 1;
299			}
300			
301			processed.SCRIPT.push({
302				JS: 'YmController.ecommerceProcessShownList()',
303				bRunFirst: false,
304				isInternal: true,
305			});
306			BX.ajax.processScripts(processed.SCRIPT);
307		},
308
309		processPagination: function(paginationHtml)
310		{
311			if (!paginationHtml)
312				return;
313
314			var pagination = document.querySelectorAll('[data-pagination-num="' + this.navParams.NavNum + '"]');
315			for (var k in pagination)
316			{
317				if (pagination.hasOwnProperty(k))
318				{
319					pagination[k].innerHTML = paginationHtml;
320				}
321			}
322		},
323
324		processEpilogue: function(epilogueHtml)
325		{
326			if (!epilogueHtml)
327				return;
328
329			var processed = BX.processHTML(epilogueHtml, false);
330			BX.ajax.processScripts(processed.SCRIPT);
331		},
332
333		showHeader: function(animate)
334		{
335			var parentNode = BX.findParent(this.container, {attr: {'data-entity': 'parent-container'}}),
336				header;
337
338			if (parentNode && BX.type.isDomNode(parentNode))
339			{
340				header = parentNode.querySelector('[data-entity="header"]');
341
342				if (header && header.getAttribute('data-showed') != 'true')
343				{
344					header.style.display = '';
345
346					if (animate)
347					{
348						new BX.easing({
349							duration: 2000,
350							start: {opacity: 0},
351							finish: {opacity: 100},
352							transition: BX.easing.makeEaseOut(BX.easing.transitions.quad),
353							step: function(state){
354								header.style.opacity = state.opacity / 100;
355							},
356							complete: function(){
357								header.removeAttribute('style');
358								header.setAttribute('data-showed', 'true');
359							}
360						}).animate();
361					}
362					else
363					{
364						header.style.opacity = 100;
365					}
366				}
367			}
368		}
369	};
370})();

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.