2022-10-14 18:41:03 +00:00
|
|
|
function pinPost(t, id) {
|
|
|
|
t.disabled = true;
|
|
|
|
t.classList.add("disabled");
|
2022-10-30 15:10:07 +00:00
|
|
|
postToast_callback(`/sticky/${id}`,
|
2022-10-14 18:41:03 +00:00
|
|
|
{
|
|
|
|
},
|
|
|
|
(xhr) => {
|
2022-10-25 22:48:10 +00:00
|
|
|
if (xhr.status >= 200 && xhr.status < 300) {
|
|
|
|
response = JSON.parse(xhr.response);
|
|
|
|
length = response["length"];
|
|
|
|
if (length == "permanently") {
|
|
|
|
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');
|
|
|
|
}
|
|
|
|
t.nextElementSibling.classList.remove('d-none');
|
|
|
|
t.disabled = false;
|
|
|
|
t.classList.remove("disabled");
|
2022-10-14 18:41:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
setTimeout(() => {
|
|
|
|
t.disabled = false;
|
|
|
|
t.classList.remove("disabled");
|
|
|
|
}, 2000);
|
|
|
|
}
|