2022-07-16 21:00:02 +00:00
|
|
|
const reason_post = document.getElementById("reason_post")
|
|
|
|
const reportPostButton = document.getElementById("reportPostButton");
|
|
|
|
|
|
|
|
reason_post.addEventListener('keydown', (e) => {
|
2023-08-06 03:33:34 +00:00
|
|
|
if (!((e.ctrlKey || e.metaKey) && e.key === "Enter")) return;
|
2022-07-16 21:00:02 +00:00
|
|
|
|
|
|
|
const targetDOM = document.activeElement;
|
2023-08-06 03:33:34 +00:00
|
|
|
if (!(targetDOM instanceof HTMLInputElement)) return;
|
2022-07-16 21:00:02 +00:00
|
|
|
|
|
|
|
reportPostButton.click()
|
2023-10-02 06:04:05 +00:00
|
|
|
bootstrap.Modal.getOrCreateInstance(document.getElementById('reportPostModal')).hide()
|
2022-07-16 21:00:02 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
function report_postModal(id) {
|
|
|
|
reportPostButton.disabled = false;
|
|
|
|
reportPostButton.classList.remove('disabled');
|
2024-02-14 12:49:44 +00:00
|
|
|
reportPostButton.innerHTML='Report Post';
|
2023-05-01 18:30:28 +00:00
|
|
|
reportPostButton.dataset.id = id
|
2022-07-16 21:00:02 +00:00
|
|
|
|
|
|
|
reason_post.value = ""
|
|
|
|
setTimeout(() => {
|
|
|
|
reason_post.focus()
|
|
|
|
}, 500);
|
2023-01-28 14:27:52 +00:00
|
|
|
};
|
2023-05-01 18:30:28 +00:00
|
|
|
|
|
|
|
reportPostButton.onclick = function() {
|
|
|
|
this.disabled = true;
|
|
|
|
this.classList.add('disabled');
|
|
|
|
|
|
|
|
postToast(this, '/report/post/' + reportPostButton.dataset.id,
|
|
|
|
{
|
|
|
|
"reason": reason_post.value
|
|
|
|
},
|
|
|
|
() => {}
|
|
|
|
);
|
|
|
|
}
|