PageSourceSearch

https://voenchast.ru/bitrix/components/bitrix/socialnetwork.log.filter/templates/.default/script.js

js voenchast.ru collected 2026-10-09 22:41:08 UTC 15,863 bytes, 615 lines download raw bytes

1__logOnDateChange = function(sel)
2{
3	var bShowFrom=false, bShowTo=false, bShowHellip=false, bShowDays=false;
4
5	if(sel.value == 'interval')
6		bShowFrom = bShowTo = bShowHellip = true;
7	else if(sel.value == 'before')
8		bShowTo = true;
9	else if(sel.value == 'after' || sel.value == 'exact')
10		bShowFrom = true;
11	else if(sel.value == 'days')
12		bShowDays = true;
13
14	BX('flt_date_from_span').style.display = (bShowFrom? '':'none');
15	BX('flt_date_to_span').style.display = (bShowTo? '':'none');
16	BX('flt_date_hellip_span').style.display = (bShowHellip? '':'none');
17	BX('flt_date_day_span').style.display = (bShowDays? 'inline-block':'none');
18	BX('flt_date_day_text_span').style.display = (bShowDays? 'inline-block':'none');
19};
20
21function __logOnReload(log_counter)
22{
23	if (BX("menu-popup-lenta-sort-popup"))
24	{
25		var arMenuItems = BX.findChildren(BX("menu-popup-lenta-sort-popup"), { className: 'lenta-sort-item' }, true);
26
27		if (!BX.hasClass(arMenuItems[0], 'lenta-sort-item-selected'))
28		{
29			for (var i = 0; i < arMenuItems.length; i++)
30			{
31				if (i == 0)
32					BX.addClass(arMenuItems[i], 'lenta-sort-item-selected');
33				else if (i != (arMenuItems.length-1))
34					BX.removeClass(arMenuItems[i], 'lenta-sort-item-selected');
35			}
36		}
37	}
38
39	if (BX("lenta-sort-button"))
40	{
41		var menuButtonText = BX.findChild(BX("lenta-sort-button"), { className: 'lenta-sort-button-text-internal' }, true, false);
42		if (menuButtonText)
43			menuButtonText.innerHTML = BX.message('sonetLFAllMessages');
44	}
45
46	var counter_cont = BX("sonet_log_counter_preset", true);
47	if (counter_cont)
48	{
49		if (parseInt(log_counter) > 0)
50		{
51			counter_cont.style.display = "inline-block";
52			counter_cont.innerHTML = log_counter;
53		}
54		else
55		{
56			counter_cont.innerHTML = '';
57			counter_cont.style.display = "none";
58		}
59	}
60}
61
62BitrixLFFilter = function ()
63{
64	this.id = null;
65	this.filterPopup = false;
66	this.currentName = null;
67
68	this.obInputName = {};
69	this.obSearchInput = {};
70
71	this.obInputContainerName = {};
72	this.obContainerInput = {};
73
74	this.popupMenu = null;
75	this.menuItems = [];
76
77	this.actualSearchString = '';
78	this.minSearchStringLength = 2;
79};
80
81BitrixLFFilter.prototype.initLentaMenu = function(params)
82{
83	if (typeof params.menuItems != 'undefined')
84	{
85		this.menuItems = params.menuItems;
86	}
87};
88
89BitrixLFFilter.prototype.showLentaMenu = function(params)
90{
91	var
92		short = (typeof params.short != 'undefined' && params.short),
93		bindElement = (typeof params.bindElement != 'undefined' ? BX(params.bindElement) : null);
94
95	if (!bindElement)
96	{
97		return false;
98	}
99
100	if (
101		typeof params.siteTemplateId == 'undefined'
102		|| params.siteTemplateId != 'bitrix24'
103	)
104	{
105		BX.addClass(bindElement, "lenta-sort-button-active");
106	}
107
108	const items = BX.util.array_merge((!short ? BX.util.array_merge(this.menuItems.preset, this.menuItems.filter) : []), this.menuItems.actions);
109	if (!BX.Type.isArrayFilled(items))
110	{
111		return false;
112	}
113
114	this.popupMenu = BX.PopupMenu.create("lenta-sort-popup", bindElement, items, {
115		offsetTop: (params.siteTemplateId == 'bitrix24' ? -5 : 2),
116		offsetLeft: (params.siteTemplateId == 'bitrix24' ? 17 : 43),
117		angle : true,
118		events : {
119			onPopupClose : function() {
120				if (
121					typeof params.siteTemplateId != 'undefined'
122					|| params.siteTemplateId != 'bitrix24'
123				)
124				{
125					BX.removeClass(bindElement, "lenta-sort-button-active");
126				}
127			}
128		}
129	});
130	this.popupMenu.show();
131
132	return false;
133};
134
135BitrixLFFilter.prototype.initFilter = function(params)
136{
137	var version = (
138		typeof params != 'undefined'
139		&& typeof params.version != 'undefined'
140			? parseInt(params.version)
141			: 0
142	);
143
144	var filterId = (
145		typeof params != 'undefined'
146		&& typeof params.filterId != 'undefined'
147			? params.filterId
148			: 'LIVEFEED'
149	);
150
151	this.id = filterId;
152
153	if (version >= 2)
154	{
155		if (
156			typeof params != 'undefined'
157			&& typeof params.minSearchStringLength != 'undefined'
158			&& parseInt(params.minSearchStringLength) > 0
159		)
160		{
161			this.minSearchStringLength = parseInt(params.minSearchStringLength);
162		}
163
164		var filterInstance = BX.Main.filterManager.getById(filterId);
165		if (
166			filterInstance
167			&& (
168				filterInstance.getSearch().getSquares().length > 0
169				|| filterInstance.getSearch().getSearchString().length > 0
170			)
171		)
172		{
173			var pagetitleContainer = BX.findParent(BX(filterId + '_filter_container'), { className: 'pagetitle-wrap'});
174			if (pagetitleContainer)
175			{
176				BX.addClass(pagetitleContainer, "pagetitle-wrap-filter-opened");
177			}
178		}
179
180		BX.addCustomEvent("BX.Livefeed:refresh", BX.delegate(function() {
181			var filterInstance = BX.Main.filterManager.getById(filterId);
182			if (filterInstance)
183			{
184				filterInstance.getPreset().resetPreset(true);
185				filterInstance.getSearch().clearForm();
186			}
187		}, this));
188		BX.addCustomEvent("BX.Main.Filter:beforeApply", BX.delegate(function(eventFilterId, values, ob, filterPromise) {
189			if (
190				eventFilterId != filterId
191				|| (
192					this.actualSearchString.length > 0
193					&& this.actualSearchString.length < this.minSearchStringLength
194				)
195			)
196			{
197				return;
198			}
199
200			BX.onCustomEvent(window, 'BX.Livefeed.Filter:beforeApply', [values, filterPromise]);
201		}, this));
202		BX.addCustomEvent("BX.Main.Filter:apply", BX.delegate(function(eventFilterId, values, ob, filterPromise, filterParams) {
203			if (
204				eventFilterId != filterId
205				|| (
206					this.actualSearchString.length > 0
207					&& this.actualSearchString.length < this.minSearchStringLength
208				)
209			)
210			{
211				return;
212			}
213
214			BX.onCustomEvent(window, 'BX.Livefeed.Filter:apply', [values, filterPromise, filterParams]);
215		}, this));
216		BX.addCustomEvent('BX.Filter.Search:input', BX.delegate(function(eventFilterId, searchString) {
217			if (eventFilterId == filterId)
218			{
219				this.actualSearchString = (typeof searchString != 'undefined' ? BX.util.trim(searchString) : '');
220
221				if (
222					this.actualSearchString.length > 0
223					&& this.actualSearchString.length >= this.minSearchStringLength
224				)
225				{
226					BX.onCustomEvent(window, 'BX.Livefeed.Filter:searchInput', [ searchString ]);
227				}
228			}
229		}, this));
230		BX.addCustomEvent('BX.Main.Filter:blur', BX.delegate(function(filterInstance) {
231			if (
232				filterInstance.getParam('FILTER_ID') == filterId
233				&& filterInstance.getSearch().getSquares().length <= 0
234				&& filterInstance.getSearch().getSearchString().length <= 0
235			)
236			{
237				var pagetitleContainer = BX.findParent(BX(filterId + '_filter_container'), { className: 'pagetitle-wrap'});
238				if (pagetitleContainer)
239				{
240					BX.removeClass(pagetitleContainer, "pagetitle-wrap-filter-opened");
241				}
242			}
243		}));
244
245		if (BX(this.id + '_filter_container'))
246		{
247			var f = BX.delegate(function (event) {
248				var pagetitleContainer = BX.findParent(event.target, { className: 'pagetitle-wrap'});
249				if (
250					pagetitleContainer
251					&& !BX.hasClass(pagetitleContainer, "pagetitle-wrap-filter-opened")
252				)
253				{
254					BX.addClass(pagetitleContainer, "pagetitle-wrap-filter-opened");
255				}
256			}, this);
257
258			BX.bind(BX(this.id + '_search_container'), 'click', f);
259		}
260	}
261	else
262	{
263		__logOnDateChange(document.forms['log_filter'].flt_date_datesel);
264		BX('flt_date_from_span').onclick = function(){
265			BX.calendar({node: this, field: BX('flt_date_from'), bTime: false});
266		};
267		BX('flt_date_to_span').onclick = function(){
268			BX.calendar({node: this, field: BX('flt_date_to'), bTime: false});
269		};
270	}
271};
272
273BitrixLFFilter.prototype.initDestination = function(params)
274{
275	this.obInputName[params.name] = params.inputName;
276	this.obSearchInput[params.name] = BX(params.inputName);
277	this.obInputContainerName[params.name] = params.inputContainerName;
278	this.obContainerInput[params.name] = BX(params.inputContainerName);
279
280	if (
281		typeof params.items != 'undefined'
282		&& typeof params.items.department != 'undefined'
283	)
284	{
285		if (typeof params.items.extranetRoot != 'undefined')
286		{
287			for(var key in params.items.extranetRoot)
288			{
289				if (params.items.extranetRoot.hasOwnProperty(key))
290				{
291					params.items.department[key] = params.items.extranetRoot[key];
292				}
293			}
294		}
295
296		if (!params.items.departmentRelation)
297		{
298			params.items.departmentRelation = BX.SocNetLogDestination.buildDepartmentRelation(params.items.department);
299		}
300	}
301
302	BX.SocNetLogDestination.init({
303		name : params.name,
304		pathToAjax: (typeof params.pathToAjax != 'undefined' ? params.pathToAjax : false),
305		searchInput : this.obSearchInput[params.name],
306		extranetUser : !!params.extranetUser,
307		departmentSelectDisable : !!params.departmentSelectDisable,
308		bindMainPopup : {
309			node: params.bindNode,
310			offsetTop: '5px',
311			offsetLeft: '15px'
312		},
313		bindSearchPopup : {
314			node: params.bindNode,
315			offsetTop : '5px',
316			offsetLeft: '15px'
317		},
318		callback : {
319			select : BX.proxy(this.onSelectDestination, {
320				name: params.name,
321				containerInput: BX(params.inputContainerName),
322				inputContainerName: params.inputContainerName,
323				inputName: params.inputName,
324				searchInput: BX(params.inputName),
325				resultFieldName: params.resultFieldName
326			}),
327			unSelect : BX.proxy(this.onUnSelectDestination, {
328				name: params.name,
329				inputContainerName: params.inputContainerName,
330				inputName: params.inputName,
331				searchInput: BX(params.inputName)
332			})
333		},
334		items : params.items,
335		itemsLast : params.itemsLast,
336		itemsSelected : params.itemsSelected,
337		itemsSelectedUndeleted: (typeof params.itemsSelectedUndeleted != 'undefined' ? params.itemsSelectedUndeleted : {}),
338		isCrmFeed : false,
339		useClientDatabase: true,
340		destSort: params.destSort,
341		allowAddUser: false,
342		allowSearchEmailUsers: !params.extranetUser,
343		userNameTemplate: params.userNameTemplate
344	});
345	BX.bind(this.obSearchInput[params.name], 'click', function(e) {
346		oLFFilter.currentName = params.name;
347		BX.SocNetLogDestination.openDialog(params.name);
348		return BX.PreventDefault(e);
349	});
350	BX.bind(this.obSearchInput[params.name], 'keyup', BX.delegate(BX.SocNetLogDestination.BXfpSearch, {
351		formName: params.name,
352		inputName: oLFFilter.obInputName[params.name]
353	}));
354	BX.bind(this.obSearchInput[params.name], 'keydown', BX.delegate(BX.SocNetLogDestination.BXfpSearchBefore, {
355		formName: params.name,
356		inputName: oLFFilter.obInputName[params.name]
357	}));
358
359};
360
361BitrixLFFilter.prototype.clearInput = function()
362{
363	if (this.obContainerInput[this.currentName])
364	{
365		var arItems = BX.findChildren(this.obContainerInput[this.currentName], { className: 'feed-add-post-destination' }, false);
366		for (var i = 0; i < arItems.length; i++)
367		{
368			BX.SocNetLogDestination.deleteItem(arItems[i].attributes['data-id'].value, arItems[i].attributes['data-type'].value, this.currentName);
369		}
370	}
371};
372
373BitrixLFFilter.prototype.onSelectDestination = function(item, type, search, bUndeleted)
374{
375	oLFFilter.clearInput();
376
377	BX.SocNetLogDestination.BXfpSelectCallback({
378		formName: this.name,
379		item: item,
380		type: type,
381		search: search,
382		bUndeleted: bUndeleted,
383		containerInput: this.containerInput,
384		valueInput: this.searchInput,
385		varName: this.resultFieldName
386	});
387
388	this.searchInput.style.display = "none";
389	if (
390		this.name == 'feed-filter-created-by'
391		&& BX("flt_comments_cont")
392	)
393	{
394		BX("flt_comments_cont").style.display = "block";
395	}
396
397	BX.SocNetLogDestination.closeDialog();
398	BX.SocNetLogDestination.closeSearch();
399};
400
401BitrixLFFilter.prototype.onUnSelectDestination = function(item)
402{
403	var elements = BX.findChildren(BX(this.inputContainerName), {attribute: {'data-id': '' + item.id + ''}}, true);
404	if (elements !== null)
405	{
406		for (var j = 0; j < elements.length; j++)
407		{
408			BX.remove(elements[j]);
409		}
410	}
411	BX(this.inputName).value = '';
412
413	this.searchInput.style.display = "inline-block";
414	if (
415		this.name == 'feed-filter-created-by'
416		&& BX("flt_comments_cont")
417	)
418	{
419		BX("flt_comments_cont").style.display = "none";
420	}
421};
422
423BitrixLFFilter.prototype.ShowFilterPopup = function(bindElement)
424{
425	if (!oLFFilter.filterPopup)
426	{
427		BX.ajax.get(BX.message('sonetLFAjaxPath'), function(data)
428		{
429			BX.closeWait(bindElement);
430
431			oLFFilter.filterPopup = new BX.PopupWindow(
432				'bx_log_filter_popup',
433				bindElement,
434				{
435					closeIcon : false,
436					offsetTop: 5,
437					autoHide: true,
438					zIndex : -100,
439					//angle : { offset : 59},
440					className : 'sonet-log-filter-popup-window',
441					events : {
442						onPopupClose: function() {
443							if (!BX.hasClass(this.bindElement, "pagetitle-menu-filter-set"))
444								BX.removeClass(this.bindElement, "pagetitle-menu-filter-selected")
445						},
446						onPopupShow: function() { BX.addClass(this.bindElement, "pagetitle-menu-filter-selected")}
447					}
448				}
449			);
450
451			var filter_block = BX.create('DIV', {html: BX.util.trim(data)});
452			oLFFilter.filterPopup.setContent(filter_block.firstChild);
453			oLFFilter.filterPopup.show();
454		});
455	}
456	else
457	{
458		oLFFilter.filterPopup.show();
459	}
460};
461
462BitrixLFFilter.prototype.__SLFShowInfoPopup = function(params)
463{
464	var buttons = [
465		BX.create('BUTTON', {
466			props: {
467				className: 'ui-btn ui-btn-md ui-btn-success'
468			},
469			text: BX.message('sonetLFDialogRead'),
470			events: {
471				click: function () {
472					BX.ajax({
473						method: 'POST',
474						dataType: 'json',
475						url: BX.message('ajaxControllerURL'),
476						data: {
477							sessid : BX.bitrix_sessid(),
478							popupType: params.type,
479							closePopup: 'Y'
480						},
481						onsuccess: function(response)
482						{
483							if (
484								typeof (response) != 'undefined'
485								&& typeof (response.SUCCESS) != 'undefined'
486								&& response.SUCCESS == 'Y'
487							)
488							{
489								modalWindow.close();
490								if (params.reload)
491								{
492									top.location = top.location.href;
493								}
494							}
495						}
496					});
497				}
498			}
499		})
500	];
501
502	if (BX.type.isArray(params.buttonsAdd))
503	{
504		var buttonAdd = 0;
505
506		for (var i = 0; i < params.buttonsAdd.length; i++)
507		{
508			buttonAdd = params.buttonsAdd[i];
509
510			buttons.push(BX.create('BUTTON', {
511				props: {
512					className: 'ui-btn ui-btn-md ui-btn-' + buttonAdd.type
513				},
514				text: buttonAdd.title,
515				events: {
516					click: buttonAdd.click
517				}
518			}));
519		}
520	}
521
522	var modalWindow = new BX.PopupWindow(params.name, params.bindObj, {
523		closeByEsc: false,
524		closeIcon: false,
525		autoHide: false,
526		overlay: true,
527		events: {},
528		width: 700,
529		buttons: [],
530		zIndex : 0,
531		content: BX.create('DIV', {
532			children: [
533				BX.create('DIV', {
534					props: {
535						className: 'bx-slf-popup-title'
536					},
537					text: params.title
538				}),
539				BX.create('DIV', {
540					props: {
541						className: 'bx-slf-popup-content'
542					},
543					children: [
544						BX.create('DIV', {
545							props: {
546								className: 'bx-slf-popup-cont-title'
547							},
548							html: params.description1
549						}),
550						BX.create('DIV', {
551							props: {
552								className: 'bx-slf-popup-descript'
553							},
554							children: [
555								(
556									BX.type.isNotEmptyString(params.description2)
557										? BX.create('DIV', {
558											html: params.description2
559										})
560										: null
561								),
562								(
563									BX.type.isPlainObject(params.descriptionImage)
564									&& BX.type.isNotEmptyString(params.descriptionImage.src)
565										? BX.create('IMG', {
566											props: {
567												className: 'bx-slf-popup-descript-img'
568											},
569											attrs: {
570												src: params.descriptionImage.src,
571												width: params.descriptionImage.width,
572												height: params.descriptionImage.height
573											}
574										})
575										: null
576								)
577							]
578						})
579					]
580				}),
581				BX.create('DIV', {
582					props: {
583						className: 'popup-window-buttons'
584					},
585					children: buttons
586				})
587			]
588		})
589	});
590	modalWindow.show();
591
592	return modalWindow;
593};
594
595
596BitrixLFFilter.prototype.onClickMenuItem = function(params)
597{
598	if (typeof params.menuItem != 'undefined')
599	{
600		BX.toggleClass(params.menuItem, 'lenta-sort-item-selected');
601	}
602	this.popupMenu.close();
603	if (typeof params.href != 'undefined')
604	{
605		top.location.href = params.href;
606	}
607};
608
609BitrixLFFilter.prototype.closeHint = function(element)
610{
611
612};
613
614oLFFilter = new BitrixLFFilter;
615window.oLFFilter = oLFFilter;

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.