mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-11-01 03:25:04 +03:00
better front end js
This commit is contained in:
parent
52eda8ddad
commit
0ee3d3be8b
2 changed files with 7 additions and 20 deletions
|
@ -17,23 +17,11 @@ document.getElementById("send")?.addEventListener("submit", async e => {
|
||||||
/**
|
/**
|
||||||
* OTHER FUNCTIONS
|
* OTHER FUNCTIONS
|
||||||
*/
|
*/
|
||||||
|
window.thread = async function (id, un= "") {
|
||||||
window.delete_thread = async function (id) {
|
await request(`/api/threads/${id}/${un}delete`);
|
||||||
const response = await request("/api/threads/" + id + "/delete");
|
alert(`Thread ${un}deleted`);
|
||||||
if (response.deleted) {
|
|
||||||
alert("Thread deleted");
|
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
window.undelete_thread = async function (id) {
|
|
||||||
const response = await request("/api/threads/" + id + "/undelete");
|
|
||||||
if (!response.deleted) {
|
|
||||||
alert("Thread undeleted");
|
|
||||||
location.reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
window.undelete_message = async function (id) {
|
window.undelete_message = async function (id) {
|
||||||
const response = await request(`/api/messages/${id}/undelete`);
|
const response = await request(`/api/messages/${id}/undelete`);
|
||||||
if (response.deleted) return;
|
if (response.deleted) return;
|
||||||
|
@ -53,8 +41,7 @@ window.delete_message = async function (id) {
|
||||||
<i class='bx bx-trash bx-sm' id="deleted-${id}" style="color: RED;"></i>
|
<i class='bx bx-trash bx-sm' id="deleted-${id}" style="color: RED;"></i>
|
||||||
`+ document.getElementById("dots-" + id).innerHTML;
|
`+ document.getElementById("dots-" + id).innerHTML;
|
||||||
|
|
||||||
document.getElementById("dot-" + id).innerHTML = `
|
document.getElementById("dot-" + id).innerHTML = `<a onclick="undelete_message('${id}');">UNDELETE</a>`;
|
||||||
<a onclick="undelete_message('${id}');">UNDELETE</a>`;// ADMIN PERM FIX
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.react = async function (id, type) {
|
window.react = async function (id, type) {
|
||||||
|
|
|
@ -25,11 +25,11 @@
|
||||||
|
|
||||||
<% if (user && !thread.deleted){ %>
|
<% if (user && !thread.deleted){ %>
|
||||||
|
|
||||||
<a onclick="delete_thread('<%= thread.id %>' )" class="btn-outline-primary" >DELETE</a>
|
<a onclick="thread('<%= thread.id %>')" class="btn-outline-primary" >DELETE</a>
|
||||||
<a onclick="edit_thread('<%= thread.id %>')" class="btn-outline-primary" >EDIT</a>
|
<a onclick="edit_thread('<%= thread.id %>')" class="btn-outline-primary" >EDIT</a>
|
||||||
<% } else if (thread.deleted) { %>
|
<% } else if (thread.deleted) { %>
|
||||||
<h3 style="display:inline;">This thread has been deleted</h3>
|
<h3 style="display:inline;">This thread has been deleted</h3>
|
||||||
<a onclick="undelete_thread('<%= thread.id %>')" class="btn-primary" >UNDELETE</a>
|
<a onclick="thread('<%= thread.id %>', 'un')" class="btn-primary" >UNDELETE</a>
|
||||||
|
|
||||||
<% }; %>
|
<% }; %>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue