1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-07-02 10:00:37 -05:00

add sorting and zscore to scoreboard

This commit is contained in:
RaidMax
2022-01-24 09:56:48 -06:00
parent 84f32ff88e
commit 7fe2e51449
5 changed files with 65 additions and 18 deletions

View File

@ -197,7 +197,7 @@ form *, select, button.btn {
font-size: 1rem;
}
.oi {
.oi, .table-sort-column {
cursor: pointer;
}
@ -454,4 +454,4 @@ div.card {
padding-left: 1rem !important;
padding-right: 1rem !important;
line-height: 1.45rem !important;
}
}

View File

@ -2,14 +2,31 @@
const serverPanel = $('.scoreboard-container.active');
const serverId = $(serverPanel).data('server-id');
$.get(`../Server/${serverId}/Scoreboard`, (response) => {
const scoreboardTable = $(serverPanel).children('.table-sort');
$.get(`../Server/${serverId}/Scoreboard?order=${scoreboardTable.data('sort-column')}&down=${scoreboardTable.data('sort-down')}`, (response) => {
$(serverPanel).html(response);
setupDataSorting();
});
}
$(document).ready(() => {
$(window.location.hash).tab('show');
$(`${window.location.hash}_nav`).addClass('active');
setupDataSorting();
})
function setupDataSorting() {
const tableColumn = $('.table-sort-column');
$(tableColumn).off('click');
$(tableColumn).on('click', function() {
const columnName = $(this).data('column-name');
const table = $('.table-sort');
$(table).data('sort-column', columnName);
$(table).data('sort-down', $(table).data('sort-down') !== true);
refreshScoreboard();
})
}
setInterval(refreshScoreboard, 5000);