PageSourceSearch

https://www.bitrix24.fr/bitrix/templates/bitrix24_2017/js/lang.selector.globe.js

js bitrix24.fr collected 2026-09-29 21:13:43 UTC 3,203 bytes, 123 lines download raw bytes

1;(function() {
2	'use strict'
3
4	let Popup = function(parameters) {
5		if (!BX.type.isElementNode(parameters.node))
6		{
7			return {};
8		}
9
10		this.parameters = {
11			closeOnExternalClick: parameters.closeOnExternalClick !== false,
12			initialClickKey: 'popupInitialClick',
13			initialClickValue: 'lsg',
14		};
15
16		this.nodes = {
17			popup: parameters.node,
18		};
19
20		this.attributes = {
21			active: 'data-active',
22			close: 'data-close',
23		};
24
25		let closes = this.nodes.popup.querySelectorAll('[' + this.attributes.close + ']');
26		closes = Array.prototype.slice.call(closes);
27		closes.forEach((close) => {
28			BX.bind(close, 'click', this.close.bind(this));
29		});
30	};
31
32	Popup.prototype = {
33		checkInitialClick: function(event) {
34			event = event || window.event;
35
36			return typeof event !== 'undefined'
37				&& event.type === 'click'
38				&& event.hasOwnProperty(this.parameters.initialClickKey)
39				&& event[this.parameters.initialClickKey] === this.parameters.initialClickValue;
40		},
41		setInitialClick: function(event) {
42			event = event || window.event;
43
44			if (typeof event !== 'undefined' && event.type === 'click' && !this.nodes.popup.hasAttribute(this.attributes.active))
45			{
46				event[this.parameters.initialClickKey] = this.parameters.initialClickValue;
47			}
48		},
49		closeHandler: function(event) {
50			event = event || window.event;
51
52			if (this.parameters.closeOnExternalClick === true && !this.checkInitialClick(event) && !this.nodes.popup.contains(event.target))
53			{
54				this.close();
55			}
56		},
57		close: function() {
58			BX.unbind(window, 'click', BX.proxy(this.closeHandler, this));
59			this.nodes.popup.removeAttribute(this.attributes.active);
60		},
61		open: function() {
62			this.nodes.popup.setAttribute(this.attributes.active, 'true');
63			BX.bind(window, 'click', BX.proxy(this.closeHandler, this));
64		},
65		toggle: function() {
66			this.nodes.popup.hasAttribute(this.attributes.active) ? this.close() : this.open();
67		},
68	};
69
70	let Initialization = function() {
71		this.attributes = {
72			section: 'data-lsg-section',
73			button: 'data-lsg-button',
74			popup: 'data-lsg-popup',
75		};
76
77		this.popups = {};
78
79		let section = document.querySelector('[' + this.attributes.section + ']');
80
81		if (!section)
82		{
83			return;
84		}
85
86		let button = section.querySelector('[' + this.attributes.button + ']');
87
88		if (!button)
89		{
90			return;
91		}
92
93		this.popups.main = new Popup({
94			node: section.querySelector('[' + this.attributes.popup + ']:not([' + this.attributes.popup + '="redirect"])'),
95		});
96		this.popups.redirect = new Popup({
97			node: section.querySelector('[' + this.attributes.popup + '="redirect"]'),
98			closeOnExternalClick: false,
99		});
100
101		if (
102			BX.type.isNotEmptyObject(this.popups.redirect)
103			&& window.location.search.indexOf('redirect_from=') >= 0
104		)
105		{
106			this.popups.redirect.open();
107		}
108
109		if (BX.type.isNotEmptyObject(this.popups.main))
110		{
111			BX.bind(button, 'click', function(event) {
112				this.popups.main.setInitialClick(event);
113				this.popups.main.toggle();
114			}.bind(this));
115		}
116	}
117
118	Initialization.prototype = {};
119
120	BX.ready(function() {
121		new Initialization();
122	});
123})();

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.