Пофиксил форматирование (возможно)

This commit is contained in:
lalka2016 2023-05-21 16:30:24 +03:00
parent 07a3f92308
commit 3f50f97f0d

View file

@ -1,3 +1,4 @@

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