mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 15:20:48 -05:00
huge commit for webfront facelift
This commit is contained in:
@ -1,52 +1,101 @@
|
||||
function hideLoader() {
|
||||
$('.layout-loading-icon').fadeOut();
|
||||
$('#mainLoadingBar').fadeOut();
|
||||
$('#modalLoadingBar').fadeOut();
|
||||
}
|
||||
|
||||
function showLoader() {
|
||||
$('.layout-loading-icon').attr('style', 'visibility:visible');
|
||||
$('.layout-loading-icon').removeClass('text-danger');
|
||||
$('.layout-loading-icon').removeClass('text-muted');
|
||||
$('.layout-loading-icon').fadeIn();
|
||||
$('#mainLoadingBar').fadeIn();
|
||||
$('#modalLoadingBar').fadeIn();
|
||||
}
|
||||
|
||||
function errorLoader() {
|
||||
$('.layout-loading-icon').addClass('text-danger');
|
||||
$('#mainLoadingBar').addClass('bg-danger').delay(2000).fadeOut();
|
||||
}
|
||||
|
||||
function staleLoader() {
|
||||
$('.layout-loading-icon').addClass('text-muted');
|
||||
$('#mainLoadingBar').addClass('bg-grey');
|
||||
}
|
||||
|
||||
function getUrlParameter(sParam) {
|
||||
let sPageURL = window.location.search.substring(1),
|
||||
sURLVariables = sPageURL.split('&'),
|
||||
sParameterName,
|
||||
i;
|
||||
|
||||
for (i = 0; i < sURLVariables.length; i++) {
|
||||
sParameterName = sURLVariables[i].split('=');
|
||||
|
||||
if (sParameterName[0] === sParam) {
|
||||
return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function clearQueryString() {
|
||||
const uri = window.location.href.toString();
|
||||
if (uri.indexOf("?") > 0) {
|
||||
const cleanUri = uri.substring(0, uri.indexOf("?"));
|
||||
window.history.replaceState({}, document.title, cleanUri);
|
||||
}
|
||||
}
|
||||
|
||||
const entityMap = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": ''',
|
||||
'/': '/',
|
||||
'`': '`',
|
||||
'=': '='
|
||||
};
|
||||
|
||||
function escapeHtml (string) {
|
||||
return String(string).replace(/[&<>"'`=\/]/g, function (s) {
|
||||
return entityMap[s];
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
let toastMessage = getUrlParameter('toastMessage');
|
||||
|
||||
if (toastMessage) {
|
||||
toastMessage = unescape(toastMessage);
|
||||
}
|
||||
|
||||
if (toastMessage) {
|
||||
clearQueryString();
|
||||
halfmoon.initStickyAlert({
|
||||
content: toastMessage,
|
||||
title: 'Success',
|
||||
alertType: 'alert-success',
|
||||
fillType: 'filled'
|
||||
});
|
||||
}
|
||||
|
||||
hideLoader();
|
||||
|
||||
/*
|
||||
* hide loader when clicking
|
||||
*/
|
||||
$(document).click(function (e) {
|
||||
//hideLoader()
|
||||
});
|
||||
|
||||
/*
|
||||
* handle action modal
|
||||
*/
|
||||
$(document).off('click', '.profile-action');
|
||||
$(document).on('click', '.profile-action', function (e) {
|
||||
$(document).on('click', '.profile-action', function () {
|
||||
const actionType = $(this).data('action');
|
||||
const actionId = $(this).data('action-id');
|
||||
const actionIdKey = actionId === undefined ? '' : '?id=' + actionId;
|
||||
$.get('/Action/' + actionType + 'Form' + actionIdKey)
|
||||
const actionIdKey = actionId === undefined ? '' : `?id=${actionId}`;
|
||||
showLoader();
|
||||
$.get(`/Action/${actionType}Form/${actionIdKey}`)
|
||||
.done(function (response) {
|
||||
$('#actionModal .modal-message').fadeOut('fast');
|
||||
$('#actionModal .modal-body-content').html(response);
|
||||
$('#actionModal').modal();
|
||||
$('#actionModal').trigger('action_form_received', actionType);
|
||||
$('#actionModalContent').html(response);
|
||||
hideLoader();
|
||||
})
|
||||
.fail(function (jqxhr, textStatus, error) {
|
||||
$('#actionModal .modal-body-content').html('');
|
||||
$('#actionModal .modal-message').text(_localization['GLOBAL_ERROR'] + ' — ' + jqxhr.responseText);
|
||||
$('#actionModal').modal();
|
||||
$('#actionModal .modal-message').fadeIn('fast');
|
||||
halfmoon.initStickyAlert({
|
||||
content: jqxhr.responseText,
|
||||
title: 'Error',
|
||||
alertType: 'alert-danger',
|
||||
fillType: 'filled'
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -56,35 +105,58 @@ $(document).ready(function () {
|
||||
$(document).on('submit', '.action-form', function (e) {
|
||||
e.preventDefault();
|
||||
$(this).append($('#target_id input'));
|
||||
$('#actionModal').data('should-refresh', $('#actionModal').find('.refreshable').length !== 0);
|
||||
const modal = $('#actionModal');
|
||||
const shouldRefresh = modal.data('should-refresh', modal.find('.refreshable').length !== 0);
|
||||
const data = $(this).serialize();
|
||||
showLoader();
|
||||
|
||||
$.get($(this).attr('action') + '/?' + data)
|
||||
.done(function (response) {
|
||||
hideLoader();
|
||||
// success without content
|
||||
if (response.length === 0) {
|
||||
location.reload();
|
||||
}
|
||||
else {
|
||||
$('#actionModal .modal-message').fadeOut('fast');
|
||||
$('#actionModal .modal-body-content').html(response);
|
||||
$('#actionModal').modal();
|
||||
} else {
|
||||
let message = response;
|
||||
try {
|
||||
message = response.map(r => escapeHtml(r.response));
|
||||
}
|
||||
catch{}
|
||||
if (shouldRefresh) {
|
||||
window.location = `${window.location.href.replace('#actionModal', '')}?toastMessage=${escape(message)}`;
|
||||
}
|
||||
else {
|
||||
modal.modal();
|
||||
halfmoon.initStickyAlert({
|
||||
content: escapeHtml(message),
|
||||
title: 'Executed',
|
||||
alertType: 'alert-primary',
|
||||
fillType: 'filled'
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
.fail(function (jqxhr, textStatus, error) {
|
||||
errorLoader();
|
||||
.fail(function (jqxhr) {
|
||||
hideLoader();
|
||||
if ($('#actionModal .modal-message').text.length > 0) {
|
||||
$('#actionModal .modal-message').fadeOut('fast');
|
||||
|
||||
let message = jqxhr.responseText;
|
||||
|
||||
try {
|
||||
const jsonMessage = $.parseJSON(message);
|
||||
|
||||
if (jsonMessage) {
|
||||
message = jsonMessage.map(r => escapeHtml(r.response));
|
||||
}
|
||||
}
|
||||
if (jqxhr.status === 401) {
|
||||
$('#actionModal .modal-message').text(_localization['WEBFRONT_ACTION_CREDENTIALS']);
|
||||
}
|
||||
else {
|
||||
$('#actionModal .modal-message').text(_localization['GLOBAL_ERROR'] + ' — ' + jqxhr.responseText);
|
||||
}
|
||||
$('#actionModal .modal-message').fadeIn('fast');
|
||||
|
||||
catch{}
|
||||
|
||||
halfmoon.initStickyAlert({
|
||||
content: message.join("<br/>"),
|
||||
title: 'Error',
|
||||
alertType: 'alert-danger',
|
||||
fillType: 'filled'
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -96,8 +168,8 @@ $(document).ready(function () {
|
||||
if (actionType === 'RecentClients') {
|
||||
const ipAddresses = $('.client-location-flag');
|
||||
$.each(ipAddresses, function (index, address) {
|
||||
$.get('https://ip2c.org/' + $(address).data('ip'), function (result) {
|
||||
const countryCode = result.split(';')[1].toLowerCase();
|
||||
$.get(`https://get.geojs.io/v1/ip/country/${(address).data('ip')}.json`, function (result) {
|
||||
const countryCode = result['country'].toLowerCase();
|
||||
if (countryCode !== 'zz') {
|
||||
$(address).css('background-image', `url('https://flagcdn.com/w80/${countryCode}.png')`);
|
||||
}
|
||||
@ -105,15 +177,4 @@ $(document).ready(function () {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* handle close event to refresh if need be
|
||||
*/
|
||||
$("#actionModal").on("hidden.bs.modal", function () {
|
||||
let shouldRefresh = $(this).data('should-refresh');
|
||||
|
||||
if (shouldRefresh !== undefined && shouldRefresh) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -4,7 +4,15 @@
|
||||
|
||||
$(document).ready(function () {
|
||||
$('.table-slide').click(function () {
|
||||
$(this).siblings().children().children('.hidden-row').slideToggle(0);
|
||||
if ($(window).width() < 993) {
|
||||
$(this).prev().find('.hidden-row').toggleClass('d-none d-flex');
|
||||
} else {
|
||||
$(this).prev().find('.hidden-row-lg').toggleClass('d-none');
|
||||
}
|
||||
|
||||
$(this).attr('data-title', '');
|
||||
$(this).attr('data-toggle', '');
|
||||
|
||||
$(this).children('span').toggleClass('oi-chevron-top oi-chevron-bottom');
|
||||
});
|
||||
setupPerformanceGraph();
|
||||
@ -364,7 +372,7 @@ function renderPerformanceChart() {
|
||||
elements: {
|
||||
line: {
|
||||
fill: false,
|
||||
borderColor: 'rgba(255, 255, 255, 0.75)',
|
||||
borderColor: halfmoon.getPreferredMode() === "light-mode" ? 'rgba(0, 0, 0, 0.85)' : 'rgba(255, 255, 255, 0.75)',
|
||||
borderWidth: 2
|
||||
},
|
||||
point: {
|
||||
@ -407,4 +415,4 @@ function renderPerformanceChart() {
|
||||
data: chartData,
|
||||
options: options
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -7,16 +7,30 @@
|
||||
}
|
||||
|
||||
showLoader();
|
||||
$.get('/Console/ExecuteAsync', { serverId: serverId, command: command })
|
||||
$.get('/Console/Execute', { serverId: serverId, command: command })
|
||||
.done(function (response) {
|
||||
$('#console_command_response pre').html('');
|
||||
|
||||
hideLoader();
|
||||
$('#console_command_response').append(response);
|
||||
response.map(r => r.response).forEach(item => {
|
||||
$('#console_command_response').append(`<div>${item}</div>`);
|
||||
})
|
||||
|
||||
$('#console_command_response').append('<hr/>')
|
||||
$('#console_command_value').val("");
|
||||
})
|
||||
.fail(function (jqxhr, textStatus, error) {
|
||||
.fail(function (response) {
|
||||
$('#console_command_response pre').html('');
|
||||
errorLoader();
|
||||
hideLoader();
|
||||
$('#console_command_response').text(_localization['WEBFRONT_CONSOLE_ERROR'] + error).addClass('text-danger');
|
||||
|
||||
if (response.status < 500) {
|
||||
response.responseJSON.map(r => r.response).forEach(item => {
|
||||
$('#console_command_response').append(`<div class="text-danger">${item}</div>`);
|
||||
})
|
||||
} else {
|
||||
$('#console_command_response').append(`<div class="text-danger">Could not execute command...</div>`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -36,4 +50,4 @@ $(document).ready(function () {
|
||||
executeCommand();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,6 +1,7 @@
|
||||
const textOffset = 15;
|
||||
let previousRadarData = undefined;
|
||||
let newRadarData = undefined;
|
||||
let stateInfo;
|
||||
|
||||
/************************
|
||||
* IW4 *
|
||||
@ -219,42 +220,47 @@ function updatePlayerData() {
|
||||
}
|
||||
|
||||
let column = player.team === 'allies' ? $('.player-data-left') : $('.player-data-right');
|
||||
column.append(`<div class="progress" style="height: 1.5rem; background-color: transparent;">
|
||||
<div style="position: absolute; font-size: 1rem; left: 1.5rem;">${player.name}</div>
|
||||
<div class="progress-bar bg-success" role="progressbar" style="min-width: 0px; width: ${player.health}%" aria-valuenow="${player.health}" aria-valuemin="0" aria-valuemax="100"></div>
|
||||
<div class="progress-bar bg-danger" role="progressbar" style="min-width: 0px; border-right: 0px; width: ${100 - player.health}%" aria-valuenow="${100 - player.health}" aria-valuemin="0" aria-valuemax="100"></div>
|
||||
</div>
|
||||
<div class="d-flex flex-row flex-wrap p-2 mb-4 bg-dark border-bottom">
|
||||
<div style="width: 3rem; height: 1.5rem; background-image:url(${weaponImageForWeapon(player.weapon)}); background-size: 3rem 1.5rem;" class="mr-auto text-left">
|
||||
</div>
|
||||
<div class="player-stat-icon" style="background-image:url('/images/radar/kills.png')"></div>
|
||||
<div class="pr-2">${player.kills}</div>
|
||||
<div class="player-stat-icon" style="background-image:url('/images/radar/death.png')"></div>
|
||||
<div class="pr-3">${player.deaths}</div>
|
||||
<span class="align-self-center oi oi-target pr-1"></span>
|
||||
<div class="pr-3 ">${player.deaths == 0 ? player.kills.toFixed(2) : (player.kills / player.deaths).toFixed(2)}</div>
|
||||
<span class="align-self-center oi oi-graph pr-1"></span>
|
||||
<div>${ player.playTime == 0 ? '—' : Math.round(player.score / (player.playTime / 60))}</div>
|
||||
</div>`);
|
||||
|
||||
let greenProgressClass = 'rounded-top';
|
||||
let redProgressClass = 'rounded-right';
|
||||
|
||||
if (player.health < 100) {
|
||||
greenProgressClass = 'rounded-left';
|
||||
}
|
||||
if (player.health <= 0) {
|
||||
redProgressClass = 'rounded-top';
|
||||
}
|
||||
|
||||
column.append(`
|
||||
<div class="card m-0 p-0 mb-15">
|
||||
<div class="progress h-25">
|
||||
<div class="position-absolute ml-10 text-dark" style="top: 1.2rem;">${player.name}</div>
|
||||
<div class="progress-bar bg-success ${greenProgressClass} h-25" role="progressbar" style="min-width: 0px; width: ${player.health}%" aria-valuenow="${player.health}" aria-valuemin="0" aria-valuemax="100"></div>
|
||||
<div class="progress-bar bg-danger ${redProgressClass} h-25" role="progressbar" style="min-width: 0px; border-right: 0px; width: ${100 - player.health}%" aria-valuenow="${100 - player.health}" aria-valuemin="0" aria-valuemax="100"></div>
|
||||
</div>
|
||||
<div class="ml-10 mr-10 pt-5 pb-5">
|
||||
<div class="d-flex flex-row bg-dark-dm bg-light-lm rounded-bottom">
|
||||
<div style="width: 3rem; height: 1.5rem; background-image:url(${weaponImageForWeapon(player.weapon)}); background-size: 3rem 1.5rem;" class="mr-auto text-left align-self-center" data-toggle="tooltip" data-title="${player.weapon}">
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<div class="player-stat-icon align-self-center" style="background-image:url('/images/radar/kills.png')"></div>
|
||||
<div class="pr-5 align-self-center">${player.kills}</div>
|
||||
<div class="player-stat-icon align-self-center" style="background-image:url('/images/radar/death.png')"></div>
|
||||
<div class="pr-10 align-self-center">${player.deaths}</div>
|
||||
<span class="align-self-center oi oi-target pr-5"></span>
|
||||
<div class="pr-10 align-self-center">${player.deaths == 0 ? player.kills.toFixed(2) : (player.kills / player.deaths).toFixed(2)}</div>
|
||||
<span class="align-self-center oi oi-graph pr-5"></span>
|
||||
<div>${ player.playTime == 0 ? '—' : Math.round(player.score / (player.playTime / 60))}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`);
|
||||
});
|
||||
|
||||
$('.player-data-left').delay(1000).animate({opacity: 1}, 500);
|
||||
$('.player-data-right').delay(1000).animate({opacity: 1}, 500);
|
||||
}
|
||||
|
||||
const stateInfo = {
|
||||
canvas: $('#map_canvas'),
|
||||
ctx: $('#map_canvas')[0].getContext('2d'),
|
||||
updateFrequency: 750,
|
||||
updateFrameTimeDeviation: 0,
|
||||
forwardDistance: undefined,
|
||||
fovWidth: undefined,
|
||||
mapInfo: undefined,
|
||||
mapScaler: undefined,
|
||||
deathIcons: {},
|
||||
deathIconTime: 4000
|
||||
};
|
||||
|
||||
function updateRadarData() {
|
||||
$.getJSON(radarDataUrl, function (_radarItem) {
|
||||
newRadarData = _radarItem;
|
||||
@ -414,6 +420,20 @@ $(document).ready(function () {
|
||||
if ($('#map_canvas').length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
stateInfo = {
|
||||
canvas: $('#map_canvas'),
|
||||
ctx: $('#map_canvas')[0].getContext('2d'),
|
||||
updateFrequency: 750,
|
||||
updateFrameTimeDeviation: 0,
|
||||
forwardDistance: undefined,
|
||||
fovWidth: undefined,
|
||||
mapInfo: undefined,
|
||||
mapScaler: undefined,
|
||||
deathIcons: {},
|
||||
deathIconTime: 4000
|
||||
};
|
||||
|
||||
$.getJSON(radarDataUrl, function (_map) {
|
||||
stateInfo.mapInfo = _map;
|
||||
updateRadarData();
|
||||
|
@ -13,7 +13,26 @@ function initLoader(location, loaderId, count = 10, start = count, additional =
|
||||
loadCount = count;
|
||||
loaderOffset = start;
|
||||
additionalParams = additional;
|
||||
setupListeners();
|
||||
|
||||
setupMonitor();
|
||||
|
||||
$('#loaderLoad').click(function () {
|
||||
loadMoreItems();
|
||||
});
|
||||
}
|
||||
|
||||
function setupMonitor() {
|
||||
const element = document.querySelector('#loaderLoad')
|
||||
const observer = new window.IntersectionObserver(([entry]) => {
|
||||
if (entry.isIntersecting && $('.content-wrapper').scrollTop() > 10) {
|
||||
loadMoreItems();
|
||||
}
|
||||
}, {
|
||||
root: null,
|
||||
threshold: 1,
|
||||
})
|
||||
|
||||
observer.observe(element);
|
||||
}
|
||||
|
||||
function loadMoreItems() {
|
||||
@ -23,10 +42,10 @@ function loadMoreItems() {
|
||||
|
||||
showLoader();
|
||||
isLoaderLoading = true;
|
||||
let params = { offset: loaderOffset, count: loadCount, startAt: startAt };
|
||||
for (i = 0; i < additionalParams.length; i++) {
|
||||
let params = {offset: loaderOffset, count: loadCount, startAt: startAt};
|
||||
for (let i = 0; i < additionalParams.length; i++) {
|
||||
let param = additionalParams[i];
|
||||
params[param.name] = param.value;
|
||||
params[param.name] = param.value instanceof Function ? param.value() : param.value;
|
||||
}
|
||||
|
||||
$.get(loadUri, params)
|
||||
@ -35,69 +54,22 @@ function loadMoreItems() {
|
||||
if (response.trim().length === 0) {
|
||||
staleLoader();
|
||||
loaderReachedEnd = true;
|
||||
$('.loader-load-more').addClass('disabled');
|
||||
$('.loader-load-more').remove('text-primary').addClass('text-muted');
|
||||
}
|
||||
$(document).trigger("loaderFinished", response);
|
||||
startAt = $(response).filter('.loader-data-time').last().data('time');
|
||||
hideLoader();
|
||||
isLoaderLoading = false;
|
||||
})
|
||||
.fail(function (jqxhr, statis, error) {
|
||||
.fail(function () {
|
||||
errorLoader();
|
||||
halfmoon.initStickyAlert({
|
||||
content: 'Could not load more items...',
|
||||
title: 'Error',
|
||||
alertType: 'alert-danger',
|
||||
fillType: 'filled'
|
||||
});
|
||||
isLoaderLoading = false;
|
||||
});
|
||||
loaderOffset += loadCount;
|
||||
}
|
||||
|
||||
var hasScrollBar = false;
|
||||
|
||||
function _ScrollHandler(e) {
|
||||
//throttle event:
|
||||
/*
|
||||
https://stackoverflow.com/questions/3898130/check-if-a-user-has-scrolled-to-the-bottom
|
||||
*/
|
||||
var $window = $(window);
|
||||
var $document = $(document);
|
||||
hasScrollBar = true;
|
||||
let _throttleTimer = null;
|
||||
let _throttleDelay = 100;
|
||||
|
||||
clearTimeout(_throttleTimer);
|
||||
_throttleTimer = setTimeout(function () {
|
||||
|
||||
//do work
|
||||
if ($window.scrollTop() + $window.height() > $document.height() - 100) {
|
||||
loadMoreItems();
|
||||
}
|
||||
|
||||
}, _throttleDelay);
|
||||
}
|
||||
|
||||
function setupListeners() {
|
||||
if ($(loaderResponseId).length === 1) {
|
||||
/*
|
||||
https://stackoverflow.com/questions/19731730/jquery-js-detect-users-scroll-attempt-without-any-window-overflow-to-scroll
|
||||
*/
|
||||
|
||||
$('html').bind('mousewheel DOMMouseScroll', function (e) {
|
||||
var delta = e.originalEvent.wheelDelta || -e.originalEvent.detail;
|
||||
|
||||
if (delta < 0 && !hasScrollBar) {
|
||||
loadMoreItems();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
$(window)
|
||||
.off('scroll', _ScrollHandler)
|
||||
.on('scroll', _ScrollHandler);
|
||||
$('.loader-load-more:not(.disabled)').click(function (e) {
|
||||
if (!isLoaderLoading) {
|
||||
loadMoreItems();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
@ -1,85 +1,17 @@
|
||||
let offset = 15;
|
||||
let isLoading = false;
|
||||
|
||||
|
||||
function PenaltyScrollHandler(e) {
|
||||
//throttle event:
|
||||
hasScrollBar = true;
|
||||
clearTimeout(_throttleTimer);
|
||||
_throttleTimer = setTimeout(function () {
|
||||
|
||||
//do work
|
||||
if ($window.scrollTop() + $window.height() > $document.height() - 100) {
|
||||
loadMorePenalties();
|
||||
}
|
||||
|
||||
}, _throttleDelay);
|
||||
function updateFilters() {
|
||||
location = `${location.href.split('?')[0]}?showOnly=${$('#penalty_filter_selection').val()}&hideAutomatedPenalties=${document.getElementById('hide_automated_penalties_checkbox').checked}`;
|
||||
}
|
||||
|
||||
function loadMorePenalties() {
|
||||
if (isLoading) {
|
||||
return false;
|
||||
$(document).ready(function () {
|
||||
const filterSelection = $('#penalty_filter_selection');
|
||||
|
||||
if (filterSelection) {
|
||||
filterSelection.change(function () {
|
||||
updateFilters();
|
||||
});
|
||||
|
||||
$('#hide_automated_penalties_checkbox').click(function () {
|
||||
updateFilters();
|
||||
});
|
||||
}
|
||||
|
||||
showLoader();
|
||||
isLoading = true;
|
||||
$.get('/Penalty/ListAsync', {
|
||||
offset: offset,
|
||||
showOnly: $('#penalty_filter_selection').val(),
|
||||
hideAutomatedPenalties: document.getElementById('hide_automated_penalties_checkbox').checked
|
||||
})
|
||||
.done(function (response) {
|
||||
$('#penalty_table').append(response);
|
||||
if (response.trim().length === 0) {
|
||||
staleLoader();
|
||||
}
|
||||
hideLoader();
|
||||
isLoading = false;
|
||||
})
|
||||
.fail(function (jqxhr, statis, error) {
|
||||
errorLoader();
|
||||
isLoading = false;
|
||||
});
|
||||
offset += 15;
|
||||
}
|
||||
|
||||
if ($('#penalty_table').length === 1) {
|
||||
|
||||
$('#penalty_filter_selection').change(function () {
|
||||
location = location.href.split('?')[0] + "?showOnly=" + $('#penalty_filter_selection').val() + '&hideAutomatedPenalties=' + document.getElementById('hide_automated_penalties_checkbox').checked;
|
||||
});
|
||||
|
||||
$('#hide_automated_penalties_checkbox').click(function () {
|
||||
location = location.href.split('?')[0] + "?showOnly=" + $('#penalty_filter_selection').val() + '&hideAutomatedPenalties=' + document.getElementById('hide_automated_penalties_checkbox').checked;
|
||||
});
|
||||
|
||||
/*
|
||||
https://stackoverflow.com/questions/19731730/jquery-js-detect-users-scroll-attempt-without-any-window-overflow-to-scroll
|
||||
*/
|
||||
$('html').bind('mousewheel DOMMouseScroll', function (e) {
|
||||
var delta = e.originalEvent.wheelDelta || -e.originalEvent.detail;
|
||||
|
||||
if (delta < 0 && !hasScrollBar) {
|
||||
loadMorePenalties();
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
https://stackoverflow.com/questions/3898130/check-if-a-user-has-scrolled-to-the-bottom
|
||||
*/
|
||||
var _throttleTimer = null;
|
||||
var _throttleDelay = 100;
|
||||
var $window = $(window);
|
||||
var $document = $(document);
|
||||
var hasScrollBar = false;
|
||||
|
||||
$document.ready(function () {
|
||||
$window
|
||||
.off('scroll', PenaltyScrollHandler)
|
||||
.on('scroll', PenaltyScrollHandler);
|
||||
|
||||
$('#load_penalties_button').click(function () {
|
||||
loadMorePenalties();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -1,44 +1,8 @@
|
||||
$(document).ready(function () {
|
||||
/*
|
||||
Expand alias tab if they have any
|
||||
*/
|
||||
$('#profile_aliases_btn').click(function (e) {
|
||||
const aliases = $('#profile_aliases').text().trim();
|
||||
if (aliases && aliases.length !== 0) {
|
||||
$('#profile_aliases').slideToggle(150);
|
||||
$(this).toggleClass('oi-caret-top');
|
||||
}
|
||||
});
|
||||
|
||||
const ipAddresses = $('.ip-lookup-profile');
|
||||
$.each(ipAddresses, function (index, address) {
|
||||
let ip = $(address).data('ip');
|
||||
if (ip.length === 0) {
|
||||
return;
|
||||
}
|
||||
$.get('https://ip2c.org/' + ip, function (result) {
|
||||
const countryCode = result.split(';')[1].toLowerCase();
|
||||
const country = result.split(';')[3];
|
||||
|
||||
if (country === 'Unknown') {
|
||||
return;
|
||||
}
|
||||
|
||||
$('#ip_lookup_country').text(country);
|
||||
if (countryCode !== 'zz' && countryCode !== '') {
|
||||
$(address).css('background-image', `url('https://flagcdn.com/w80/${countryCode}.png')`);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/* set the end time for initial event query */
|
||||
startAt = $('.loader-data-time').last().data('time');
|
||||
|
||||
$('#filter_meta_container_button').click(function () {
|
||||
$('#filter_meta_container').removeClass('d-none').addClass('flex-md-column');
|
||||
$('#additional_meta_filter').removeClass('d-md-none');
|
||||
});
|
||||
|
||||
/*
|
||||
* load context of chat
|
||||
*/
|
||||
|
@ -1,10 +1,10 @@
|
||||
function refreshScoreboard() {
|
||||
const serverPanel = $('.scoreboard-container.active');
|
||||
const serverPanel = $('.scoreboard-container');
|
||||
const serverId = $(serverPanel).data('server-id');
|
||||
|
||||
const scoreboardTable = $(serverPanel).children('.table-sort');
|
||||
|
||||
$.get(`../Server/${serverId}/Scoreboard?order=${scoreboardTable.data('sort-column')}&down=${scoreboardTable.data('sort-down')}`, (response) => {
|
||||
$.get(`/Server/${serverId}/Scoreboard?order=${scoreboardTable.data('sort-column')}&down=${scoreboardTable.data('sort-down')}`, (response) => {
|
||||
$(serverPanel).html(response);
|
||||
setupDataSorting();
|
||||
});
|
||||
@ -16,10 +16,6 @@ $(document).ready(() => {
|
||||
}
|
||||
|
||||
setInterval(refreshScoreboard, 5000);
|
||||
|
||||
$(window.location.hash).tab('show');
|
||||
$(`${window.location.hash}_nav`).addClass('active');
|
||||
|
||||
setupDataSorting();
|
||||
})
|
||||
|
||||
|
@ -1,26 +1,27 @@
|
||||
$(document).ready(function() {
|
||||
$('.form-inline').submit(function(e) {
|
||||
if ($('#client_search').val().length < 3) {
|
||||
e.preventDefault();
|
||||
$('#client_search')
|
||||
.addClass('input-text-danger')
|
||||
.delay(25)
|
||||
.queue(function () {
|
||||
$(this).addClass('input-border-transition').dequeue();
|
||||
})
|
||||
.delay(1000)
|
||||
.queue(function () {
|
||||
$(this).removeClass('input-text-danger').dequeue();
|
||||
})
|
||||
.delay(500)
|
||||
.queue(function () {
|
||||
$(this).removeClass('input-border-transition').dequeue();
|
||||
});
|
||||
}
|
||||
$('.form-inline').submit(function(e) {
|
||||
const id = $(e.currentTarget).find('input');
|
||||
if ($(id).val().length < 3) {
|
||||
e.preventDefault();
|
||||
$(id)
|
||||
.addClass('input-text-danger')
|
||||
.delay(25)
|
||||
.queue(function () {
|
||||
$(this).addClass('input-border-transition').dequeue();
|
||||
})
|
||||
.delay(1000)
|
||||
.queue(function () {
|
||||
$(this).removeClass('input-text-danger').dequeue();
|
||||
})
|
||||
.delay(500)
|
||||
.queue(function () {
|
||||
$(this).removeClass('input-border-transition').dequeue();
|
||||
});
|
||||
}
|
||||
|
||||
else if ($('#client_search').val().startsWith("chat|")) {
|
||||
e.preventDefault();
|
||||
window.location = "/Message/Find?query=" + $('#client_search').val();
|
||||
}
|
||||
});
|
||||
});
|
||||
else if ($(id).val().startsWith("chat|")) {
|
||||
e.preventDefault();
|
||||
window.location = "/Message/Find?query=" + $(id).val();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -16,7 +16,7 @@
|
||||
}
|
||||
|
||||
function getPlayerHistoryChart(playerHistory, i, width, maxClients) {
|
||||
const primaryColor = $('title').css('background-color');
|
||||
const primaryColor = $('.text-primary').css('color');
|
||||
const rgb = primaryColor.match(/\d+/g);
|
||||
const fillColor = `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, 0.66)`;
|
||||
const offlineFillColor = 'rgba(255, 96, 96, 0.55)';
|
||||
@ -54,29 +54,6 @@ function getPlayerHistoryChart(playerHistory, i, width, maxClients) {
|
||||
|
||||
let animationProgress = 0;
|
||||
let initialAnimationComplete = false;
|
||||
/*const originalLineDraw = Chart.controllers.line.prototype.draw;
|
||||
Chart.helpers.extend(Chart.controllers.line.prototype, {
|
||||
draw: function () {
|
||||
originalLineDraw.apply(this, arguments);
|
||||
|
||||
const chart = this.chart;
|
||||
const ctx = chart.chart.ctx;
|
||||
|
||||
chart.config.data.lineAtIndexes.forEach((elem, index) => {
|
||||
const xScale = chart.scales['x-axis-0'];
|
||||
const yScale = chart.scales['y-axis-0'];
|
||||
|
||||
ctx.save();
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(xScale.getPixelForValue(undefined, elem), yScale.getPixelForValue(playerHistory[elem].clientCount) / (initialAnimationComplete ? 1 : animationProgress));
|
||||
ctx.strokeStyle = 'rgba(255, 255, 255, 0.1)';
|
||||
ctx.lineTo(xScale.getPixelForValue(undefined, elem), yScale.bottom);
|
||||
ctx.stroke();
|
||||
ctx.restore();
|
||||
});
|
||||
}
|
||||
});*/
|
||||
|
||||
const canvas = document.getElementById(`server_history_canvas_${i}`);
|
||||
canvas.setAttribute('width', width);
|
||||
|
||||
@ -156,23 +133,19 @@ function getPlayerHistoryChart(playerHistory, i, width, maxClients) {
|
||||
});
|
||||
}
|
||||
|
||||
function refreshClientActivity() {
|
||||
$('.server-history-row').each(function (index) {
|
||||
let serverId = $(this).data("serverid");
|
||||
|
||||
$.get({
|
||||
url: "/server/clientactivity/" + serverId,
|
||||
cache: false
|
||||
function refreshClientActivity(serverId) {
|
||||
$.get({
|
||||
url: `/server/clientactivity/${serverId}`,
|
||||
cache: false
|
||||
})
|
||||
.done(function (response) {
|
||||
const clientCount = $(response).find('a.no-decoration').length;
|
||||
$('#server_header_' + serverId + ' .server-clientcount').text(clientCount);
|
||||
$('#server_clientactivity_' + serverId).html(response);
|
||||
})
|
||||
.done(function (response) {
|
||||
const clientCount = $(response).find('a').length;
|
||||
$('#server_header_' + serverId + ' .server-clientcount').text(clientCount);
|
||||
$('#server_clientactivity_' + serverId).html(response);
|
||||
})
|
||||
.fail(function (jqxhr, textStatus, error) {
|
||||
$('#server_clientactivity_' + serverId).html('');
|
||||
});
|
||||
});
|
||||
.fail(function (jqxhr, textStatus, error) {
|
||||
$('#server_clientactivity_' + serverId).html('');
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
@ -182,7 +155,8 @@ $(document).ready(function () {
|
||||
|
||||
$('.server-history-row').each(function (index, element) {
|
||||
let clientHistory = $(this).data('clienthistory-ex');
|
||||
let serverId = $(this).data('serverid');
|
||||
const serverId = $(this).data('serverid');
|
||||
setInterval(() => refreshClientActivity(serverId), 2000 + (index * 100));
|
||||
let maxClients = parseInt($('#server_header_' + serverId + ' .server-maxclients').text());
|
||||
let width = $('.server-header').first().width();
|
||||
getPlayerHistoryChart(clientHistory, serverId, width, maxClients);
|
||||
@ -197,5 +171,3 @@ $(document).ready(function () {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
setInterval(refreshClientActivity, 2000);
|
||||
|
Reference in New Issue
Block a user