sneed
parent
032754f65e
commit
917c67b7d0
|
@ -2,6 +2,40 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<script>
|
||||
block_user=function() {
|
||||
|
||||
var exileForm = document.getElementById("exile-form");
|
||||
|
||||
var exileError = document.getElementById("toast-error-message");
|
||||
|
||||
var usernameField = document.getElementById("exile-username");
|
||||
|
||||
var isValidUsername = usernameField.checkValidity();
|
||||
|
||||
username = usernameField.value;
|
||||
|
||||
if (isValidUsername) {
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("post", "/settings/block");
|
||||
xhr.withCredentials=true;
|
||||
f=new FormData();
|
||||
f.append("username", username);
|
||||
f.append("formkey", formkey());
|
||||
xhr.onload=function(){
|
||||
if (xhr.status<300) {
|
||||
window.location.reload(true);
|
||||
}
|
||||
else {
|
||||
$('#toast-exile-error').toast('dispose');
|
||||
$('#toast-exile-error').toast('show');
|
||||
exileError.textContent = JSON.parse(xhr.response)["error"];
|
||||
}
|
||||
}
|
||||
xhr.send(f)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//mobile prompt
|
||||
if (("standalone" in window.navigator) && // Check if "standalone" property exists
|
||||
|
|
Loading…
Reference in New Issue