var ctx = $("#registrations_graph");
var x = JSON.parse(ctx.attr('data-x'));
var y = JSON.parse(ctx.attr('data-y'));
var myLineChart = new Chart(ctx, {
type: 'line',
data: {
datasets: [{
data: y,
pointRadius: 0,
pointHitRadius: 5,
label: 'User registrations over time'
}],
labels: x,
},
});
$('.table-ip-banlist button.btn-danger').click(function (e) {
var ip = $(e.currentTarget).attr('data-ip');
if (ip != null) {
var success_msg = "
Success: Unbanned.
";
$(e.currentTarget).html("").attr('disabled', true);
var formData = new FormData();
formData.append('ip', ip);
$.ajax({
url: '/ajax/actions.ajax.php?function=admin_ip_unban',
type: 'POST',
data: formData,
cache: false,
headers: {'cache-control': 'no-cache'},
contentType: false,
processData: false,
async: true,
success: function (data) {
if (!data) {
$('#message_container').html(success_msg).show().delay(3000).fadeOut();
}
else {
$('#message_container').html(data).show().delay(3000).fadeOut();
}
$(e.currentTarget).parent().parent().remove();
}
});
}
});
$('.btn-remove-item').click(function (e) {
$(e.currentTarget).parent().parent().remove();
});
var reason_position = 256;
$('.btn-add-item').click(function (e) {
let type_id = $(e.currentTarget).attr('data-type-id');
let t = $('');
reason_position++;
$('.item-container[data-type-id="'+type_id+'"]').append(t);
$('.btn-remove-item').click(function (e) {
$(e.currentTarget).parent().parent().remove();
});
});