PageSourceSearch

https://innopolis.university/bitrix/components/bitrix/landing.pub/templates/.default/script.js

js innopolis.university collected 2026-09-25 09:08:45 UTC 12,352 bytes, 389 lines download raw bytes

1/* eslint-disable */
2this.BX = this.BX || {};
3this.BX.Landing = this.BX.Landing || {};
4(function (exports, main_core, landing_sliderhacks) {
5	'use strict';
6
7	class DiskFile {
8		/**
9		 * Constructor.
10		 */
11		constructor() {
12			document.addEventListener('click', this.onClick.bind(this));
13		}
14
15		/**
16		 * Click callback.
17		 *
18		 * @return {void}
19		 */
20		onClick(event) {
21			let target = event.target;
22			let href = target.getAttribute('href') || target.getAttribute('data-pseudo-url') && JSON.parse(target.getAttribute('data-pseudo-url')).href;
23			if (!href) {
24				const parentNode = target.parentNode;
25				if (parentNode.nodeName === 'A') {
26					href = parentNode.getAttribute('href');
27					target = parentNode;
28				} else {
29					const grandParentNode = parentNode.parentNode;
30					if (grandParentNode.nodeName === 'A') {
31						href = grandParentNode.getAttribute('href');
32						target = grandParentNode;
33					}
34				}
35			}
36			if (target.getAttribute('data-viewer-type')) {
37				return;
38			}
39			if (href && href.indexOf('/bitrix/services/main/ajax.php?action=landing.api.diskFile.download') === 0) {
40				BX.ajax.get(href.replace('landing.api.diskFile.download', 'landing.api.diskFile.view'), function (data) {
41					if (typeof data === 'string') {
42						data = JSON.parse(data);
43					}
44					if (!data.data) {
45						return;
46					}
47					Object.keys(data.data).map(key => {
48						target.setAttribute(key, data.data[key]);
49					});
50					target.click();
51				});
52				event.preventDefault();
53				event.stopPropagation();
54				return false;
55			}
56		}
57	}
58
59	class SearchResult {
60		/**
61		 * Constructor.
62		 */
63		constructor() {
64			this.prepareSearchInput();
65			this.scrollToFirstBlock();
66		}
67
68		/**
69		 * Prepare the search input field by populating it with the 'q' parameter value from the URL.
70		 * @return {void}
71		 */
72		prepareSearchInput() {
73			const params = new URLSearchParams(window.location.search);
74			const qValue = params.get('q');
75			const element = document.querySelector('[name="q"]');
76			if (element && qValue) {
77				element.value = qValue;
78			}
79		}
80
81		/**
82		 * Finds first highlight word and scroll to it.
83		 * @return {void}
84		 */
85		scrollToFirstBlock() {
86			var result = document.querySelector('.landing-highlight');
87			if (result) {
88				var parent = result.parentNode;
89				while (parent) {
90					if (parent.classList.contains('block-wrapper')) {
91						window.scrollTo({
92							top: parent.offsetTop,
93							behavior: 'smooth'
94						});
95						break;
96					}
97					parent = parent.parentNode;
98				}
99			}
100		}
101	}
102
103	class TimeStamp {
104		/**
105		 * Constructor.
106		 */
107		constructor() {
108			this.removeTimestamp();
109		}
110
111		/**
112		 * Removes 'ts' param from query string.
113		 * @return {void}
114		 */
115		removeTimestamp() {
116			let uri = window.location.toString();
117			uri = uri.replace(/(ts=[\d]+[&]*)/, '');
118			if (uri.slice(-1) === '?' || uri.slice(-1) === '&') {
119				uri = uri.slice(0, -1);
120			}
121			window.history.replaceState({}, document.title, uri);
122		}
123	}
124
125	const onEditButtonClick = Symbol('onEditButtonClick');
126	const onBackButtonClick = Symbol('onBackButtonClick');
127	const onForwardButtonClick = Symbol('onForwardButtonClick');
128	const onCopyLinkButtonClick = Symbol('onCopyLinkButtonClick');
129	const onUniqueViewIconClick = Symbol('onUniqueViewIconClick');
130	class TopPanel {
131		static cache = new main_core.Cache.MemoryCache();
132		constructor(data) {
133			this.userData = data.userData;
134			main_core.Event.bind(TopPanel.getEditButton(), 'click', this[onEditButtonClick]);
135			main_core.Event.bind(TopPanel.getBackButton(), 'click', this[onBackButtonClick]);
136			main_core.Event.bind(TopPanel.getForwardButton(), 'click', this[onForwardButtonClick]);
137			main_core.Event.bind(TopPanel.getCopyLinkButton(), 'click', this[onCopyLinkButtonClick]);
138			main_core.Event.bind(TopPanel.getUniqueViewIcon(), 'click', this[onUniqueViewIconClick]);
139			TopPanel.pushHistory(window.location.toString());
140			TopPanel.checkNavButtonsActivity();
141			TopPanel.checkHints();
142			TopPanel.initUniqueViewPopup(this.userData);
143		}
144		static getLayout() {
145			return TopPanel.cache.remember('layout', () => {
146				return document.querySelector('.landing-pub-top-panel');
147			});
148		}
149		static getEditButton() {
150			return TopPanel.cache.remember('editButton', () => {
151				return TopPanel.getLayout().querySelector('.landing-pub-top-panel-edit-button');
152			});
153		}
154		[onEditButtonClick](event) {
155			event.preventDefault();
156			const href = main_core.Dom.attr(event.currentTarget, 'href');
157			const landingId = main_core.Dom.attr(event.currentTarget, 'data-landingId');
158			if (main_core.Type.isString(href) && href !== '') {
159				TopPanel.openSlider(href, landingId);
160			}
161		}
162		static openSlider(url, landingId) {
163			BX.SidePanel.Instance.open(url, {
164				cacheable: false,
165				customLeftBoundary: 60,
166				allowChangeHistory: false,
167				events: {
168					onClose() {
169						void landing_sliderhacks.SliderHacks.reloadSlider(window.location.toString().split('#')[0] + '#landingId' + landingId);
170					}
171				}
172			});
173		}
174
175		// HISTORY save
176		static history = [];
177		static pushHistory(url) {
178			if (!main_core.Type.isNumber(TopPanel.historyState)) {
179				TopPanel.historyState = -1; // will increase later
180			}
181			if (TopPanel.historyState < TopPanel.history.length - 1) {
182				TopPanel.history.splice(TopPanel.historyState + 1);
183			}
184			TopPanel.history.push(url);
185			TopPanel.historyState++;
186		}
187		static checkNavButtonsActivity() {
188			main_core.Dom.removeClass(TopPanel.getForwardButton(), 'ui-btn-disabled');
189			main_core.Dom.removeClass(TopPanel.getBackButton(), 'ui-btn-disabled');
190			if (!main_core.Type.isArrayFilled(TopPanel.history) || !main_core.Type.isNumber(TopPanel.historyState) || TopPanel.history.length === 1) {
191				main_core.Dom.addClass(TopPanel.getForwardButton(), 'ui-btn-disabled');
192				main_core.Dom.addClass(TopPanel.getBackButton(), 'ui-btn-disabled');
193				return;
194			}
195			if (TopPanel.historyState === 0) {
196				main_core.Dom.addClass(TopPanel.getBackButton(), 'ui-btn-disabled');
197			}
198			if (TopPanel.historyState >= TopPanel.history.length - 1) {
199				main_core.Dom.addClass(TopPanel.getForwardButton(), 'ui-btn-disabled');
200			}
201		}
202		static getBackButton() {
203			return TopPanel.cache.remember('backButton', () => {
204				const layout = TopPanel.getLayout();
205				return layout ? layout.querySelector('.landing-pub-top-panel-back') : null;
206			});
207		}
208		static getForwardButton() {
209			return TopPanel.cache.remember('forwardButton', () => {
210				const layout = TopPanel.getLayout();
211				return layout ? layout.querySelector('.landing-pub-top-panel-forward') : null;
212			});
213		}
214		static getCopyLinkButton() {
215			return TopPanel.cache.remember('copyLinkButton', () => {
216				const layout = TopPanel.getLayout();
217				return layout ? layout.querySelector('.landing-page-link-btn') : null;
218			});
219		}
220		static getUniqueViewIcon() {
221			return TopPanel.cache.remember('uniqueViewIcon', () => {
222				const layout = TopPanel.getLayout();
223				return layout ? layout.querySelector('.landing-pub-top-panel-unique-view') : null;
224			});
225		}
226		static checkHints() {
227			const linkPage = document.querySelector('.landing-pub-top-panel-chain-link-page');
228			if (linkPage) {
229				if (parseInt(window.getComputedStyle(linkPage).width) < 200) {
230					main_core.Dom.style(linkPage, 'pointer-events', 'none');
231				} else {
232					BX.UI.Hint.init(BX('landing-pub-top-panel-chain-link-page'));
233				}
234			}
235		}
236		static initUniqueViewPopup(userData) {
237			const setUserId = userData.id;
238			const setUserName = userData.name;
239			const avatar = userData.avatar;
240			if (setUserId.length === setUserName.length) {
241				for (let i = 0; i < setUserId.length; i++) {
242					this.createUserItem(setUserId[i], setUserName[i], avatar[i]);
243				}
244			}
245		}
246		static createUserItem(id, name, avatar) {
247			const itemContainer = document.querySelector('.landing-pub-top-panel-unique-view-popup-item-container');
248			const userUrl = window.location.origin + '/company/personal/user/' + id + '/';
249			const userItem = BX.Dom.create({
250				tag: 'div',
251				props: {
252					classList: 'landing-pub-top-panel-unique-view-popup-item'
253				}
254			});
255			let userItemAvatar;
256			if (avatar && avatar !== '') {
257				userItemAvatar = BX.Dom.create({
258					tag: 'div',
259					props: {
260						classList: 'landing-pub-top-panel-unique-view-popup-item-avatar'
261					}
262				});
263				avatar = "url('" + avatar + "')";
264				main_core.Dom.style(userItemAvatar, 'background-image', avatar);
265			} else {
266				userItemAvatar = BX.Dom.create({
267					tag: 'div',
268					props: {
269						classList: 'landing-pub-top-panel-unique-view-popup-item-avatar landing-pub-top-panel-unique-view-popup-item-avatar-empty'
270					}
271				});
272			}
273			const userItemLink = BX.Dom.create({
274				tag: 'a',
275				props: {
276					classList: 'landing-pub-top-panel-unique-view-popup-item-link'
277				},
278				text: name
279			});
280			main_core.Dom.attr(userItemLink, 'href', userUrl);
281			main_core.Dom.attr(userItemLink, 'target', '_blank');
282			main_core.Dom.append(userItemAvatar, userItem);
283			main_core.Dom.append(userItemLink, userItem);
284			main_core.Dom.append(userItem, itemContainer);
285		}
286		[onCopyLinkButtonClick](event) {
287			event.preventDefault();
288			const link = BX.util.remove_url_param(window.location.href, ["IFRAME", "IFRAME_TYPE"]);
289			const node = event.target;
290			if (BX.clipboard.isCopySupported()) {
291				BX.clipboard.copy(link);
292				this.timeoutIds = this.timeoutIds || [];
293				const popupParams = {
294					content: main_core.Loc.getMessage('LANDING_TPL_PUB_COPIED_LINK'),
295					darkMode: true,
296					autoHide: true,
297					zIndex: 1000,
298					angle: true,
299					offsetLeft: 20,
300					bindOptions: {
301						position: 'top'
302					}
303				};
304				const popup = new BX.PopupWindow('landing_clipboard_copy', node, popupParams);
305				popup.show();
306				let timeoutId;
307				while (timeoutId = this.timeoutIds.pop()) {
308					clearTimeout(timeoutId);
309				}
310				timeoutId = setTimeout(function () {
311					popup.close();
312				}, 2000);
313				this.timeoutIds.push(timeoutId);
314			}
315		}
316		[onUniqueViewIconClick](event) {
317			const popup = document.querySelector('.landing-pub-top-panel-unique-view-popup');
318			if (main_core.Dom.hasClass(popup, 'hide')) {
319				main_core.Dom.removeClass(popup, 'hide');
320				setTimeout(function () {
321					main_core.Dom.addClass(popup, 'hide');
322				}, 2000);
323			} else {
324				main_core.Dom.addClass(popup, 'hide');
325			}
326		}
327		[onBackButtonClick](event) {
328			event.preventDefault();
329			if (main_core.Type.isArrayFilled(TopPanel.history) && main_core.Type.isNumber(TopPanel.historyState) && TopPanel.historyState > 0) {
330				void landing_sliderhacks.SliderHacks.reloadSlider(TopPanel.history[--TopPanel.historyState]);
331				TopPanel.checkNavButtonsActivity();
332			}
333		}
334		[onForwardButtonClick](event) {
335			event.preventDefault();
336			if (main_core.Type.isArrayFilled(TopPanel.history) && main_core.Type.isNumber(TopPanel.historyState) && TopPanel.historyState < TopPanel.history.length - 1) {
337				void landing_sliderhacks.SliderHacks.reloadSlider(TopPanel.history[++TopPanel.historyState]);
338				TopPanel.checkNavButtonsActivity();
339			}
340		}
341	}
342
343	class PageTransition {
344		/**
345		 * Constructor.
346		 */
347		constructor() {
348			this.init();
349		}
350		init() {
351			const referrer = document.referrer;
352			if (referrer !== '') {
353				let isSameHost = false;
354				let isDifferentPath = false;
355				let isIframeDisabled = false;
356				const previousUrl = new URL(referrer);
357				if (previousUrl) {
358					isSameHost = window.location.host === previousUrl.hostname;
359					isDifferentPath = window.location.pathname !== previousUrl.pathname;
360					isIframeDisabled = previousUrl.searchParams.get('IFRAME') !== 'Y';
361				}
362				if (!isIframeDisabled || !isSameHost || !isDifferentPath) {
363					BX.removeClass(document.body, 'landing-page-transition');
364				}
365			} else {
366				BX.removeClass(document.body, 'landing-page-transition');
367			}
368			if (document.readyState === 'loading') {
369				document.addEventListener('DOMContentLoaded', function () {
370					setTimeout(() => {
371						BX.removeClass(document.body, 'landing-page-transition');
372					}, 300);
373				});
374			} else {
375				setTimeout(() => {
376					BX.removeClass(document.body, 'landing-page-transition');
377				}, 300);
378			}
379		}
380	}
381
382	exports.DiskFile = DiskFile;
383	exports.PageTransition = PageTransition;
384	exports.SearchResult = SearchResult;
385	exports.TimeStamp = TimeStamp;
386	exports.TopPanel = TopPanel;
387
388})(this.BX.Landing.Pub = this.BX.Landing.Pub || {}, BX, BX.Landing);
389//# sourceMappingURL=script.js.map

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.