-
Notifications
You must be signed in to change notification settings - Fork 0
/
presets.js
24 lines (22 loc) · 920 Bytes
/
presets.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$(document).ready(function(){
$("input[type='button']").click(function(){
if(confirm("Are you sure you want to delete this preset? This is permanent and cannot be undone"))
{
// Button's parent form will always have it's ID as the nickname
let name = $(this).parent('form').attr("id");
// Update button to show message and disable it to not spam the server
$(this).val("Deleting...");
$(this).prop('disabled', true);
// Delete the preset and remove it from the HTML DOM
$.post('api/deletepreset.php', 'name=' + name, function(data){
if(data.status === "Success")
$('#' + name).remove();
else
{
$(this).val(data.status);
$(this).prop('disabled', false);
}
})
}
})
});