diff --git a/Web/static/js/openvk.cls.js b/Web/static/js/openvk.cls.js index 1d02351a..9de43c31 100644 --- a/Web/static/js/openvk.cls.js +++ b/Web/static/js/openvk.cls.js @@ -1,3 +1,4 @@ + function expand_wall_textarea(id) { var el = document.getElementById('post-buttons'+id); var wi = document.getElementById('wall-post-input'+id); @@ -169,7 +170,7 @@ document.addEventListener("DOMContentLoaded", function() { //BEGIN }); //END ONREADY DECLS async function repostPost(id, hash) { - uRepostMsgTxt = ` + uRepostMsgTxt = ` ${tr('auditory')}:
${tr("in_wall")}
${tr("in_group")}
@@ -186,9 +187,9 @@ async function repostPost(id, hash) { repostsCount = document.getElementById("repostsCount"+id) prevVal = repostsCount != null ? Number(repostsCount.innerHTML) : 0; - MessageBox(tr('share'), uRepostMsgTxt, [tr('send'), tr('cancel')], [ - (function() { - text = document.querySelector("#uRepostMsgInput_"+id).value; + MessageBox(tr('share'), uRepostMsgTxt, [tr('send'), tr('cancel')], [ + (function() { + text = document.querySelector("#uRepostMsgInput_"+id).value; type = "user"; radios = document.querySelectorAll('input[name="type"]') for(const r of radios) @@ -202,26 +203,27 @@ async function repostPost(id, hash) { groupId = document.querySelector("#groupId").value; asGroup = asgroup.checked == true ? 1 : 0; signed = signed.checked == true ? 1 : 0; - hash = encodeURIComponent(hash); - xhr = new XMLHttpRequest(); - xhr.open("POST", "/wall"+id+"/repost?hash="+hash, true); - xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); - xhr.onload = (function() { + hash = encodeURIComponent(hash); + + xhr = new XMLHttpRequest(); + xhr.open("POST", "/wall"+id+"/repost?hash="+hash, true); + xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); + xhr.onload = (function() { if(xhr.responseText.indexOf("wall_owner") === -1) - MessageBox(tr('error'), tr('error_repost_fail'), [tr('ok')], [Function.noop]); - else { - let jsonR = JSON.parse(xhr.responseText); + MessageBox(tr('error'), tr('error_repost_fail'), [tr('ok')], [Function.noop]); + else { + let jsonR = JSON.parse(xhr.responseText); NewNotification(tr('information_-1'), tr('shared_succ'), null, () => {window.location.href = "/wall" + jsonR.wall_owner}); repostsCount != null ? repostsCount.innerHTML = prevVal+1 : document.getElementById("reposts"+id).insertAdjacentHTML("beforeend", "(1)") //для старого вида постов } - }); - xhr.send('text='+encodeURI(text) + '&type='+type + '&groupId='+groupId + "&asGroup="+asGroup + "&signed="+signed); - }), - Function.noop - ]); - + }); + xhr.send('text='+encodeURI(text) + '&type='+type + '&groupId='+groupId + "&asGroup="+asGroup + "&signed="+signed); + }), + Function.noop + ]); + try { clubs = await API.Groups.getWriteableClubs();