2021-11-28 14:39:42 +03:00
|
|
|
function expand_wall_textarea(id) {
|
|
|
|
var el = document.getElementById('post-buttons'+id);
|
|
|
|
var wi = document.getElementById('wall-post-input'+id);
|
2020-12-26 01:57:44 +03:00
|
|
|
el.style.display = "block";
|
|
|
|
wi.className = "expanded-textarea";
|
2021-11-28 14:39:42 +03:00
|
|
|
}
|
2020-12-26 01:57:44 +03:00
|
|
|
|
2021-11-28 14:39:42 +03:00
|
|
|
function expand_comment_textarea(id) {
|
|
|
|
var el = document.getElementById('commentTextArea'+id);
|
|
|
|
var wi = document.getElementById('wall-post-input'+id);
|
|
|
|
el.style.display = "block";
|
|
|
|
wi.focus();
|
2020-06-07 19:04:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function edit_post(id, wid) {
|
|
|
|
var el = document.getElementById('text'+wid+'_'+id);
|
|
|
|
var ed = document.getElementById('text_edit'+wid+'_'+id);
|
|
|
|
if (el.style.display == "none") {
|
|
|
|
el.style.display = "block";
|
|
|
|
ed.style.display = "none";
|
|
|
|
} else {
|
|
|
|
el.style.display = "none";
|
|
|
|
ed.style.display = "block";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-29 23:03:18 +03:00
|
|
|
|
2020-12-26 11:06:20 +03:00
|
|
|
function hidePanel(panel, count = 0)
|
|
|
|
{
|
|
|
|
$(panel).toggleClass("content_title_expanded content_title_unexpanded");
|
|
|
|
$(panel).next('div').slideToggle(300);
|
|
|
|
if(count != 0){
|
|
|
|
if($(panel).hasClass("content_title_expanded"))
|
|
|
|
$(panel).html($(panel).html().replaceAll(" ("+count+")", ""));
|
|
|
|
else
|
|
|
|
$(panel).html($(panel).html() + " ("+count+")");
|
|
|
|
}
|
2020-06-29 23:03:18 +03:00
|
|
|
|
2020-12-26 11:06:20 +03:00
|
|
|
}
|
2020-06-29 23:03:18 +03:00
|
|
|
|
|
|
|
|
2020-06-07 19:04:43 +03:00
|
|
|
document.addEventListener("DOMContentLoaded", function() { //BEGIN
|
|
|
|
|
2021-12-04 16:30:18 +03:00
|
|
|
u("#_photoDelete").on("click", function(e) {
|
|
|
|
var formHtml = "<form id='tmpPhDelF' action='" + u(this).attr("href") + "' >";
|
|
|
|
formHtml += "<input type='hidden' name='hash' value='" + u("meta[name=csrf]").attr("value") + "' />";
|
|
|
|
formHtml += "</form>";
|
|
|
|
u("body").append(formHtml);
|
|
|
|
|
|
|
|
MessageBox(tr('warning'), tr('question_confirm'), [
|
|
|
|
tr('yes'),
|
|
|
|
tr('no')
|
|
|
|
], [
|
|
|
|
(function() {
|
|
|
|
u("#tmpPhDelF").nodes[0].submit();
|
|
|
|
}),
|
|
|
|
(function() {
|
|
|
|
u("#tmpPhDelF").remove();
|
|
|
|
}),
|
|
|
|
]);
|
|
|
|
|
|
|
|
return e.preventDefault();
|
|
|
|
});
|
2020-06-07 19:04:43 +03:00
|
|
|
|
2021-12-04 16:30:18 +03:00
|
|
|
/* @rem-pai why this func wasn't named as "#_deleteDialog"? It looks universal IMO */
|
2021-01-17 02:19:54 +03:00
|
|
|
|
2021-12-04 16:30:18 +03:00
|
|
|
u("#_noteDelete").on("click", function(e) {
|
|
|
|
var formHtml = "<form id='tmpPhDelF' action='" + u(this).attr("href") + "' >";
|
|
|
|
formHtml += "<input type='hidden' name='hash' value='" + u("meta[name=csrf]").attr("value") + "' />";
|
|
|
|
formHtml += "</form>";
|
|
|
|
u("body").append(formHtml);
|
|
|
|
|
|
|
|
MessageBox(tr('warning'), tr('question_confirm'), [
|
|
|
|
tr('yes'),
|
|
|
|
tr('no')
|
|
|
|
], [
|
|
|
|
(function() {
|
|
|
|
u("#tmpPhDelF").nodes[0].submit();
|
|
|
|
}),
|
|
|
|
(function() {
|
|
|
|
u("#tmpPhDelF").remove();
|
|
|
|
}),
|
|
|
|
]);
|
|
|
|
|
|
|
|
return e.preventDefault();
|
|
|
|
});
|
2021-01-17 02:19:54 +03:00
|
|
|
|
2021-10-08 20:44:57 +03:00
|
|
|
}); //END ONREADY DECLS
|
|
|
|
|
|
|
|
function repostPost(id, hash) {
|
2021-12-04 16:30:18 +03:00
|
|
|
uRepostMsgTxt = tr('your_comment') + ": <textarea id='uRepostMsgInput_"+id+"'></textarea><br/><br/>";
|
2021-10-08 20:44:57 +03:00
|
|
|
|
2021-12-04 16:30:18 +03:00
|
|
|
MessageBox(tr('share'), uRepostMsgTxt, [tr('send'), tr('cancel')], [
|
2021-10-08 20:44:57 +03:00
|
|
|
(function() {
|
|
|
|
text = document.querySelector("#uRepostMsgInput_"+id).value;
|
2021-10-08 21:12:39 +03:00
|
|
|
hash = encodeURIComponent(hash);
|
2021-10-08 20:44:57 +03:00
|
|
|
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)
|
2021-12-04 16:30:18 +03:00
|
|
|
MessageBox(tr('error'), tr('error_repost_fail'), tr('ok'), [Function.noop]);
|
2021-10-08 20:44:57 +03:00
|
|
|
else {
|
|
|
|
let jsonR = JSON.parse(xhr.responseText);
|
2021-12-04 16:30:18 +03:00
|
|
|
NewNotification(tr('information_-1'), tr('shared_succ'), null, () => {window.location.href = "/wall" + jsonR.wall_owner});
|
2021-10-08 20:44:57 +03:00
|
|
|
}
|
|
|
|
});
|
|
|
|
xhr.send('text=' + encodeURI(text));
|
|
|
|
}),
|
|
|
|
Function.noop
|
|
|
|
]);
|
|
|
|
}
|
2021-11-06 14:06:57 +03:00
|
|
|
|
|
|
|
function setClubAdminComment(clubId, adminId, hash) {
|
|
|
|
MessageBox("Изменить комментарий к администратору", `
|
|
|
|
<form action="/club${clubId}/setAdmin.jsp" method="post" id="uClubAdminCommentForm_${clubId}_${adminId}">
|
|
|
|
<input type="hidden" name="user" value="${adminId}">
|
|
|
|
<input type="hidden" name="hash" value="${hash}">
|
|
|
|
<input type="hidden" name="removeComment" id="uClubAdminCommentRemoveCommentInput_${clubId}_${adminId}" value="0">
|
|
|
|
<textarea name="comment" id="uClubAdminCommentTextArea_${clubId}_${adminId}"></textarea><br><br>
|
|
|
|
</form>
|
2021-12-04 16:30:18 +03:00
|
|
|
`, [tr('edit_action'), tr('cancel')], [
|
2021-11-06 14:06:57 +03:00
|
|
|
() => {
|
|
|
|
if (document.querySelector(`#uClubAdminCommentTextArea_${clubId}_${adminId}`).value === "") {
|
|
|
|
document.querySelector(`#uClubAdminCommentRemoveCommentInput_${clubId}_${adminId}`).value = "1";
|
|
|
|
}
|
|
|
|
|
|
|
|
document.querySelector(`#uClubAdminCommentForm_${clubId}_${adminId}`).submit();
|
|
|
|
},
|
|
|
|
Function.noop
|
|
|
|
]);
|
|
|
|
}
|