mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-09 23:00:57 -05:00
add sorting and zscore to scoreboard
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user