2021-10-12 14:18:07 +03:00
|
|
|
u(".comment-reply").on("click", function(e) {
|
2021-12-04 23:23:57 +03:00
|
|
|
let comment = u(e.target).closest(".post");
|
|
|
|
let authorId = comment.data("owner-id");
|
|
|
|
let authorNm = u(".post-author > a > b", comment.first()).text().trim();
|
|
|
|
let fromGroup = Boolean(comment.data("from-group"));
|
|
|
|
let postId = comment.data("post-id");
|
2021-12-17 22:30:39 +03:00
|
|
|
let inputbox = postId == null ? u("#write textarea") : u("#wall-post-input" + (postId || ""));
|
2022-01-16 14:50:52 +03:00
|
|
|
let mention = ("[" + (fromGroup ? "club" : "id") + authorId + "|" + authorNm + "], ");
|
2021-10-12 14:18:07 +03:00
|
|
|
|
2022-01-16 14:50:52 +03:00
|
|
|
// Substitute pervious mention if present, prepend otherwise
|
2022-01-17 13:15:44 +03:00
|
|
|
inputbox.nodes[0].value = inputbox.nodes[0].value.replace(/(^\[([A-Za-z0-9]+)\|([\p{L} 0-9@]+)\], |^)/u, mention);
|
2021-10-12 14:18:07 +03:00
|
|
|
inputbox.trigger("focusin");
|
|
|
|
});
|