IW4M-Admin/WebfrontCore/wwwroot/js/global.js
RaidMax 6d8d021b16 auth cookie expires after 30 days
only check hit offset when distance > 3 meters
fix null reference on unauthorized user
fixed stats not showing on profile if anticheat disabled
server client history turns red server is unresponsive
2018-04-04 23:38:45 -05:00

52 lines
2.0 KiB
JavaScript

$(document).ready(function () {
/*
* handle action modal
*/
$('.profile-action').click(function (e) {
const actionType = $(this).data('action');
$.get('/Action/' + actionType + 'Form')
.done(function (response) {
$('#actionModal .modal-message').fadeOut('fast');
$('#actionModal .modal-body-content').html(response);
$('#actionModal').modal();
})
.fail(function (jqxhr, textStatus, error) {
$('#actionModal .modal-message').text('Error &mdash ' + error);
$('#actionModal').modal();
$('#actionModal .modal-message').fadeIn('fast');
});
});
/*
* handle action submit
*/
$(document).on('submit', '.action-form', function (e) {
e.preventDefault();
$(this).append($('#target_id input'));
const data = $(this).serialize();
$.get($(this).attr('action') + '/?' + data)
.done(function (response) {
// success without content
if (response.length === 0) {
location.reload();
}
else {
$('#actionModal .modal-message').fadeOut('fast');
$('#actionModal .modal-body-content').html(response);
$('#actionModal').modal();
}
})
.fail(function (jqxhr, textStatus, error) {
if ($('#actionModal .modal-message').text.length > 0) {
$('#actionModal .modal-message').fadeOut('fast');
}
if (jqxhr.status === 401) {
$('#actionModal .modal-message').text('Invalid login credentials');
}
else {
$('#actionModal .modal-message').text('Error — ' + error);
}
$('#actionModal .modal-message').fadeIn('fast');
});
});
});