PageSourceSearch

https://www.barrier.ru/local/templates/barrier/components/bitrix/c…/main.slider/script.js?16511341309324

js barrier.ru collected 2026-09-24 11:49:03 UTC 9,324 bytes, 398 lines download raw bytes

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

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.