PageSourceSearch

https://voenchast.ru/local/components/UW/socialnetwork.blog.post.comment.custom/templates/.default/script.js

js voenchast.ru collected 2026-10-09 22:41:13 UTC 5,785 bytes, 180 lines download raw bytes

1(function() {
2	if (!!window.__blogEditComment)
3		return;
4window.checkForQuote = function(e, node, ENTITY_XML_ID, author_id) {
5	if (window.mplCheckForQuote)
6		mplCheckForQuote(e, node, ENTITY_XML_ID, author_id)
7};
8
9window.__blogLinkEntity = function(entities, formId) {
10	if (!!window["UC"] && !!window["UC"]["f" + formId])
11	{
12		window["UC"]["f" + formId].linkEntity(entities);
13		for (var ii in entities)
14		{
15			if (entities.hasOwnProperty(ii))
16			{
17				BX.bind(BX('blog-post-addc-add-' + entities[ii][1]), "click", BX.proxy(window['UC'][ii].reply, window['UC'][ii]));
18				BX.bind(BX('blg-post-' + entities[ii][1]), "dragenter", BX.proxy(window['UC'][ii].reply, window['UC'][ii]));
19
20				BX.addCustomEvent(window["UC"]["f" + formId].eventNode, 'OnUCFormBeforeShow', function(obj) {
21					if (!!obj && !!obj.id && obj.id[0] == ii)
22					{
23						BX.show(BX('blg-comment-' + entities[ii][1]));
24					}
25				});
26				BX.addCustomEvent(window["UC"]["f" + formId].eventNode, 'OnUCFormAfterHide', function(obj) {
27					if (!!obj && !!obj.id && obj.id[0] == ii)
28					{
29						var nodesNew = BX('record-' + obj.id[0] + '-new'),
30							nodes = BX.findChildren(BX('blg-comment-' + entities[ii][1]), {"className" : "feed-com-block-cover" }, false);
31						nodesNew = (!!nodesNew ? nodesNew.childNodes : []);
32						if (!(!!nodesNew && nodesNew.length > 0) && !(!!nodes && nodes.length > 0))
33						{
34							BX.hide(BX('blg-comment-' + entities[ii][1]));
35						}
36					}
37				});
38			}
39		}
40	}
41};
42
43window.__blogEditComment = function(key, postId){
44	var data = {
45		messageBBCode : top["text"+key],
46		messageFields : {
47			arImages : top["arComFiles"+key],
48			arDocs : top["arComDocs"+key],
49			arFiles : top["arComFilesUf"+key],
50			arDFiles : top["arComDFiles"+key],
51			UrlPreview : top["UrlPreview"+key]}
52	};
53	BX.onCustomEvent(window, 'OnUCAfterRecordEdit', ['BLOG_' + postId, key, data, 'EDIT']);
54};
55window.__blogOnUCFormClear = function(obj) {
56	LHEPostForm.reinitDataBefore(obj.editorId);
57};
58
59window.__blogOnUCFormAfterShow = function(obj, text, data){
60	data = (!!data ? data : {});
61	BX.onCustomEvent(window, "OnBeforeSocialnetworkCommentShowedUp", ['socialnetwork_blog']);
62	var
63		post_data = {
64			ENTITY_XML_ID : obj.id[0],
65			ENTITY_TYPE : obj.entitiesId[obj.id[0]][0],
66			ENTITY_ID : obj.entitiesId[obj.id[0]][1],
67			parentId : obj.id[1],
68			comment_post_id : obj.entitiesId[obj.id[0]][1],
69			edit_id : obj.id[1],
70			act : (obj.id[1] > 0 ? 'edit' : 'add'),
71			logId : obj.entitiesId[obj.id[0]][2]
72		};
73	for (var ii in post_data)
74	{
75		if (!obj.form[ii])
76			obj.form.appendChild(BX.create('INPUT', {attrs : {name : ii, type: "hidden"}}));
77		obj.form[ii].value = post_data[ii];
78	}
79	obj.form.action = SBPC.actionUrl.replace(/#source_post_id#/, post_data['comment_post_id']);
80
81	var im = BX('captcha');
82	if (!!im)
83	{
84		BX.ajax.getCaptcha(function(data) {
85			BX("captcha_word").value = "";
86			BX("captcha_code").value = data["captcha_sid"];
87			BX("captcha").src = '/bitrix/tools/captcha.php?captcha_code=' + data["captcha_sid"];
88			BX("captcha").style.display = "";
89		});
90	}
91
92	onLightEditorShow(text, data);
93};
94
95window.__blogOnUCFormSubmit =  function(obj, post_data) {
96	post_data["decode"] = "Y";
97};
98
99window.__blogOnUCAfterRecordAdd = function(ENTITY_XML_ID, response) {
100	if (response.errorMessage.length > 0)
101		return;
102
103	if (BX('blg-post-inform-' + ENTITY_XML_ID.substr(5)))
104	{
105		var followNode = BX.findChild(BX('blg-post-inform-' + ENTITY_XML_ID.substr(5)), {'tag':'span', 'className': 'feed-inform-follow'}, true);
106		if (followNode)
107		{
108			var strFollowOld = (followNode.getAttribute("data-follow") == "Y" ? "Y" : "N");
109			if (strFollowOld == "N")
110			{
111				BX.findChild(followNode, { tagName: 'a' }).innerHTML = BX.message('sonetBPFollowY');
112				followNode.setAttribute("data-follow", "Y");
113			}
114		}
115	}
116};
117
118window.onLightEditorShow = function(content, data){
119	var res = {};
120	if (data["arFiles"])
121	{
122		var tmp2 = {}, name, size;
123		for (var ij = 0; ij < data["arFiles"].length; ij++)
124		{
125			name = BX.findChild(BX('wdif-doc-' + data["arFiles"][ij]), {className : "feed-com-file-name"}, true);
126			size = BX.findChild(BX('wdif-doc-' + data["arFiles"][ij]), {className : "feed-con-file-size"}, true);
127
128			tmp2['F' + ij] = {
129				FILE_ID : data["arFiles"][ij],
130				FILE_NAME : (name ? name.innerHTML : "noname"),
131				FILE_SIZE : (size ? size.innerHTML : "unknown"),
132				CONTENT_TYPE : "notimage/xyz"};
133		}
134		res["UF_BLOG_COMMENT_DOC"] = {
135			USER_TYPE_ID : "file",
136			FIELD_NAME : "UF_BLOG_COMMENT_DOC[]",
137			VALUE : tmp2};
138	}
139	if (data["arDocs"])
140		res["UF_BLOG_COMMENT_FILE"] = {
141			USER_TYPE_ID : "webdav_element",
142			FIELD_NAME : "UF_BLOG_COMMENT_FILE[]",
143			VALUE : BX.clone(data["arDocs"])};
144	if (data["arDFiles"])
145		res["UF_BLOG_COMMENT_FILE"] = {
146			USER_TYPE_ID : "disk_file",
147			FIELD_NAME : "UF_BLOG_COMMENT_FILE[]",
148			VALUE : BX.clone(data["arDFiles"])};
149	if (data["UrlPreview"])
150		res["UF_BLOG_COMMENT_URL_PRV"] = {
151			USER_TYPE_ID : "url_preview",
152			FIELD_NAME : "UF_BLOG_COMMENT_URL_PRV",
153			VALUE : BX.clone(data["UrlPreview"])};
154	LHEPostForm.reinitData(SBPC.editorId, content, res);
155	if (data["arImages"])
156	{
157		var tmp, handler = LHEPostForm.getHandler(SBPC.editorId), controllerId = '';
158		for (var ii in data["arImages"])
159		{
160			if (data["arImages"].hasOwnProperty(ii))
161			{
162				tmp = {
163					id : data["arImages"][ii]["id"],
164					element_id : data["arImages"][ii]["id"],
165					element_name : data["arImages"][ii]["name"],
166					element_size : 0,
167					element_content_type: data["arImages"][ii]["type"],
168					element_url: data["arImages"][ii]["src"],
169					element_thumbnail: data["arImages"][ii]["thumbnail"],
170					element_image: data["arImages"][ii]["src"],
171					parser: 'postimage',
172					storage : 'bfile'
173				};
174				var ret = handler.checkFile(tmp.id, 'common', tmp, true);
175			}
176		}
177	}
178}
179})(window);
180

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.