PageSourceSearch

https://severlesgroup.ru/bitrix/cache/js/s1/sever/page_959c5f7ce6d…dcfe9eb949094bca25a9ac_v1.js?17906857575959

js severlesgroup.ru collected 2026-10-07 19:30:25 UTC 5,959 bytes, 263 lines download raw bytes

1
2; /* Start:"a:4:{s:4:"full";s:84:"/local/templates/sever/components/bitrix/news.list/articles/script.js?17905933005605";s:6:"source";s:69:"/local/templates/sever/components/bitrix/news.list/articles/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3(function() {
4	'use strict';
5
6	if (!!window.JCNewsListComponent)
7		return;
8
9	window.JCNewsListComponent = function(params) {
10		
11		console.log(params);
12		this.formPosting = false;
13		this.siteId = params.siteId || '';
14		this.ajaxId = params.ajaxId || '';
15		this.template = params.template || '';
16		this.templatePath = params.templatePath || '';
17		this.parameters = params.parameters || '';
18
19		if (params.navParams)
20		{
21			this.navParams = {
22				NavNum: params.navParams.NavNum || 1,
23				NavPageNomer: parseInt(params.navParams.NavPageNomer) || 1,
24				NavPageCount: parseInt(params.navParams.NavPageCount) || 1
25			};
26		}
27
28	
29		this.container = document.querySelector('[data-entity="' + params.container + '"]');
30		this.showMoreButton = null;
31		this.showMoreButtonMessage = null;
32
33
34		if (params.lazyLoad)
35		{
36			this.showMoreButton = document.querySelector('[data-use="show-more-' + this.navParams.NavNum + '"]');
37			this.showMoreButtonMessage = this.showMoreButton.innerHTML;
38			BX.bind(this.showMoreButton, 'click', BX.proxy(this.showMore, this));
39		}
40
41		if (params.loadOnScroll)
42		{
43			BX.bind(window, 'scroll', BX.proxy(this.loadOnScroll, this));
44		}
45	};
46
47	window.JCNewsListComponent.prototype =
48	{
49		checkButton: function()
50		{
51			if (this.showMoreButton)
52			{
53				if (this.navParams.NavPageNomer == this.navParams.NavPageCount)
54				{
55					BX.remove(this.showMoreButton);
56				}
57				else
58				{
59					this.container.appendChild(this.showMoreButton);
60				}
61			}
62		},
63
64		enableButton: function()
65		{
66			if (this.showMoreButton)
67			{
68				BX.removeClass(this.showMoreButton, 'disabled');
69				this.showMoreButton.innerHTML = this.showMoreButtonMessage;
70			}
71		},
72
73		disableButton: function()
74		{
75			if (this.showMoreButton)
76			{
77				BX.addClass(this.showMoreButton, 'disabled');
78				this.showMoreButton.innerHTML = 'Загрузка...';
79			}
80		},
81
82		loadOnScroll: function()
83		{
84			var scrollTop = BX.GetWindowScrollPos().scrollTop,
85				containerBottom = BX.pos(this.container).bottom;
86
87			if (scrollTop + window.innerHeight > containerBottom)
88			{
89				this.showMore();
90			}
91		},
92
93		showMore: function()
94		{
95			if (this.navParams.NavPageNomer < this.navParams.NavPageCount)
96			{
97				var data = {};
98				data['action'] = 'showMore';
99				data['PAGEN_' + this.navParams.NavNum] = this.navParams.NavPageNomer + 1;
100
101				if (!this.formPosting)
102				{
103					this.formPosting = true;
104					this.disableButton();
105					this.sendRequest(data);
106				}
107			}
108		},
109
110
111
112		sendRequest: function(data)
113		{
114			var defaultData = {
115				siteId: this.siteId,
116				template: this.template,
117				parameters: this.parameters
118			};
119
120			if (this.ajaxId)
121			{
122				defaultData.AJAX_ID = this.ajaxId;
123			}
124
125			BX.ajax({
126				url: this.templatePath + '/ajax.php' + (document.location.href.indexOf('clear_cache=Y') !== -1 ? '?clear_cache=Y' : ''),
127				method: 'POST',
128				dataType: 'json',
129				timeout: 60,
130				data: BX.merge(defaultData, data),
131				onsuccess: BX.delegate(function(result){
132					if (!result || !result.JS)
133						return;
134
135					BX.ajax.processScripts(
136						BX.processHTML(result.JS).SCRIPT,
137						false,
138						BX.delegate(function(){this.showAction(result, data);}, this)
139					);
140				}, this)
141			});
142		},
143
144		showAction: function(result, data)
145		{
146			if (!data)
147				return;
148
149			switch (data.action)
150			{
151				case 'showMore':
152					this.processShowMoreAction(result);
153					break;
154			}
155		},
156
157		processShowMoreAction: function(result)
158		{
159			this.formPosting = false;
160			this.enableButton();
161
162			if (result)
163			{
164				this.navParams.NavPageNomer++;
165				this.processItems(result.items);
166				this.processPagination(result.pagination);
167				this.processEpilogue(result.epilogue);
168				this.checkButton();
169			}
170		},
171
172		
173
174		processItems: function(itemsHtml, position)
175		{
176			if (!itemsHtml)
177				return;
178
179			var processed = BX.processHTML(itemsHtml, false),
180				temporaryNode = BX.create('DIV');
181
182			var items, k, origRows;
183
184			temporaryNode.innerHTML = processed.HTML;
185			items = temporaryNode.querySelectorAll('[data-entity="items-row"]');
186
187			if (items.length)
188			{
189
190				for (k in items)
191				{
192					if (items.hasOwnProperty(k))
193					{
194						origRows = position ? this.container.querySelectorAll('[data-entity="items-row"]') : false;
195						items[k].style.opacity = 0;
196
197						if (origRows && BX.type.isDomNode(origRows[position[k]]))
198						{
199							origRows[position[k]].parentNode.insertBefore(items[k], origRows[position[k]]);
200						}
201						else
202						{
203							this.container.appendChild(items[k]);
204						}
205					}
206				}
207
208				new BX.easing({
209					duration: 2000,
210					start: {opacity: 0},
211					finish: {opacity: 100},
212					transition: BX.easing.makeEaseOut(BX.easing.transitions.quad),
213					step: function(state){
214						for (var k in items)
215						{
216							if (items.hasOwnProperty(k))
217							{
218								items[k].style.opacity = state.opacity / 100;
219							}
220						}
221					},
222					complete: function(){
223						for (var k in items)
224						{
225							if (items.hasOwnProperty(k))
226							{
227								items[k].removeAttribute('style');
228							}
229						}
230					}
231				}).animate();
232			}
233
234			BX.ajax.processScripts(processed.SCRIPT);
235		},
236
237		processPagination: function(paginationHtml)
238		{
239			if (!paginationHtml)
240				return;
241
242			var pagination = document.querySelectorAll('[data-pagination-num="' + this.navParams.NavNum + '"]');
243			for (var k in pagination)
244			{
245				if (pagination.hasOwnProperty(k))
246				{
247					pagination[k].innerHTML = paginationHtml;
248				}
249			}
250		},
251
252		processEpilogue: function(epilogueHtml)
253		{
254			if (!epilogueHtml)
255				return;
256
257			var processed = BX.processHTML(epilogueHtml, false);
258			BX.ajax.processScripts(processed.SCRIPT);
259		}
260	};
261})();
262/* End */
263;; /* /local/templates/sever/components/bitrix/news.list/articles/script.js?17905933005605*/

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.