2022-10-14 18:41:03 +00:00
|
|
|
function pinPost(t, id) {
|
2024-02-18 15:29:53 +00:00
|
|
|
postToast(t, `/pin_post/${id}`,
|
2022-10-14 18:41:03 +00:00
|
|
|
{
|
|
|
|
},
|
|
|
|
(xhr) => {
|
2023-08-06 03:33:34 +00:00
|
|
|
if (xhr.status == 201) {
|
2022-11-03 19:07:08 +00:00
|
|
|
t.innerHTML = t.innerHTML.replace(t.textContent, 'Pin for 1 hour');
|
|
|
|
t.classList.add('d-none');
|
|
|
|
} else {
|
|
|
|
t.innerHTML = t.innerHTML.replace(t.textContent, 'Pin permanently');
|
2022-10-14 18:41:03 +00:00
|
|
|
}
|
2022-11-03 19:07:08 +00:00
|
|
|
t.nextElementSibling.classList.remove('d-none');
|
2022-10-14 18:41:03 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
2022-10-30 15:20:11 +00:00
|
|
|
|
|
|
|
function unpinPost(t, id) {
|
2024-02-18 15:29:53 +00:00
|
|
|
postToast(t, `/unpin_post/${id}`,
|
2022-10-30 15:20:11 +00:00
|
|
|
{
|
|
|
|
},
|
2022-11-03 19:07:08 +00:00
|
|
|
() => {
|
|
|
|
t.classList.add('d-none');
|
|
|
|
const prev = t.previousElementSibling;
|
|
|
|
prev.innerHTML = prev.innerHTML.replace(prev.textContent, 'Pin for 1 hour');
|
|
|
|
prev.classList.remove('d-none');
|
2022-10-30 15:20:11 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|