forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2021-12-01 14:42:29 +02:00
parent 0d8b21ff5f
commit d8da5dc4c6
1 changed files with 17 additions and 20 deletions

View File

@ -1,30 +1,27 @@
<script> <script>
window.addEventListener("load",function(event) { const banModal = function(link, id, name) {
const banModal = function(link, id, name) { document.getElementById("banModalTitle").innerHTML = `Ban @${name}`;
document.getElementById("banModalTitle").innerHTML = `Ban @${name}`; document.getElementById("ban-modal-link").value = link;
document.getElementById("ban-modal-link").value = link; document.getElementById("banUserButton").innerHTML = `Ban @${name}`;
document.getElementById("banUserButton").innerHTML = `Ban @${name}`;
document.getElementById("banUserButton").onclick = function() { document.getElementById("banUserButton").onclick = function() {
let fd = new FormData(document.getElementById("banModalForm")); let fd = new FormData(document.getElementById("banModalForm"));
fd.append("formkey", formkey()); fd.append("formkey", formkey());
let xhr = new XMLHttpRequest(); let xhr = new XMLHttpRequest();
xhr.open("POST", `/ban_user/${id}?form`, true); xhr.open("POST", `/ban_user/${id}?form`, true);
xhr.withCredentials = true; xhr.withCredentials = true;
xhr.onload = function(){ xhr.onload = function(){
var myToast = new bootstrap.Toast(document.getElementById('toast-post-success')); var myToast = new bootstrap.Toast(document.getElementById('toast-post-success'));
myToast.show(); myToast.show();
document.getElementById('toast-post-success-text').innerHTML = `@${name} banned`; document.getElementById('toast-post-success-text').innerHTML = `@${name} banned`;
}
xhr.send(fd);
} }
};
}); xhr.send(fd);
}
};
</script> </script>
<div class="modal fade" id="banModal" tabindex="-1" role="dialog" aria-labelledby="banModalTitle" aria-hidden="true"> <div class="modal fade" id="banModal" tabindex="-1" role="dialog" aria-labelledby="banModalTitle" aria-hidden="true">