PageSourceSearch

https://www.bitrix24.com/bitrix/components/bx/social.share.buttons/templates/.default/script.js

js bitrix24.com collected 2026-09-24 08:31:03 UTC 2,590 bytes, 134 lines download raw bytes

1;(function() {
2	'use strict'
3
4	function SocialShareListInit()
5	{
6		this.nodes = {
7			section: null,
8		};
9
10		this.attributes = {
11			initialized: 'data-share-area-initialized',
12			section: 'data-share-area-section',
13			json: 'data-json',
14			social: 'data-social-network',
15		};
16
17		this.init();
18	}
19
20	SocialShareListInit.prototype = {
21		copyUri: async function() {
22			let uri = window.location.href;
23
24			if (window.navigator.clipboard && window.isSecureContext)
25			{
26				await window.navigator.clipboard.writeText(uri);
27			}
28			else
29			{
30				let textarea = document.createElement('input');
31
32				textarea.value = uri;
33
34				textarea.style.cssText = 'position:fixed;display:block;height:0;top:100%;left:-100%;border:none;margin:0;padding:0;';
35
36				document.body.appendChild(textarea);
37
38				textarea.select();
39
40				try
41				{
42					document.execCommand('copy');
43				}
44				catch (err)
45				{
46
47				}
48				finally
49				{
50					textarea.remove();
51				}
52			}
53		},
54		share: function(uri) {
55			if (uri.toString().length > 0)
56			{
57				window.open(
58					uri,
59					'',
60					'width=620,height=430,resizable=yes,scrollbars=no,status=yes'
61				);
62			}
63		},
64		init: function() {
65			let sections = document.querySelectorAll('[' + this.attributes.section + ']');
66
67			for (let i = 0; i < sections.length; i++)
68			{
69				let section = sections[i];
70
71				if (!BX.type.isElementNode(section))
72				{
73					continue;
74				}
75
76				if (section.hasAttribute(this.attributes.initialized))
77				{
78					continue;
79				}
80
81				section.setAttribute(this.attributes.initialized, '');
82
83				if (!section.hasAttribute(this.attributes.json))
84				{
85					continue;
86				}
87
88				let json = section.getAttribute(this.attributes.json);
89
90				json = BX.parseJSON(json) || {}
91
92				if (!BX.type.isNotEmptyObject(json))
93				{
94					continue;
95				}
96
97				let list = section.querySelectorAll('[' + this.attributes.social + ']');
98
99				let _this = this;
100				for (let i = 0; i < list.length; i++)
101				{
102					let item = list[i];
103					BX.bind(item, 'click', function() {
104						let id = this.getAttribute(_this.attributes.social);
105
106						switch (id)
107						{
108							case 'lk':
109								_this.copyUri();
110								break;
111
112							default:
113								_this.share(json[id]);
114								break;
115						}
116					});
117				}
118			}
119		},
120	};
121
122	if (window.frameCacheVars !== undefined)
123	{
124		BX.addCustomEvent('onFrameDataReceived', function() {
125			(new SocialShareListInit());
126		});
127	}
128	else
129	{
130		BX.ready(function() {
131			(new SocialShareListInit());
132		});
133	}
134})();

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.