-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Separate JS for base scoreboard and custom levels table (#1729)
* fix: Separate JS for base scoreboard and custom levels table * Load script only if RR
- Loading branch information
1 parent
1346896
commit 1c6ef47
Showing
4 changed files
with
70 additions
and
56 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
$(document).ready(function () { | ||
let scoreboardPresent = document.getElementById("scoreboardTable") !== null; | ||
|
||
if (scoreboardPresent) { | ||
// Setup shared levels table | ||
let sharedLevelsTable = $("#sharedLevelsTable").DataTable({ | ||
scrollY: false, | ||
scrollX: true, | ||
scrollCollapse: false, | ||
paging: true, | ||
deferRender: true, | ||
language: { | ||
emptyTable: "No data available in table", | ||
loadingRecords: "Loading...", | ||
processing: "Processing...", | ||
search: "Search:", | ||
zeroRecords: "No matching records found" | ||
}, | ||
columnDefs: [ | ||
{ | ||
orderable: false, | ||
targets: "no-sort" | ||
} | ||
] | ||
}); | ||
|
||
new $.fn.dataTable.FixedColumns(sharedLevelsTable, { | ||
leftColumns: 2, | ||
}); | ||
|
||
$("#sharedLevelsTable_next").append(" >"); | ||
|
||
sharedLevelsTable.on("draw", () => { | ||
$("#sharedLevelsTable_next").append(" >"); | ||
$("#sharedLevelsTable_previous").prepend("< "); | ||
$(".next").removeClass("paginate_button"); | ||
$(".previous").removeClass("paginate_button"); | ||
}); | ||
|
||
$("#scoreboardSearch").on("keyup", function () { | ||
sharedLevelsTable.search(this.value).draw(); | ||
}); | ||
|
||
$(window).on("load", function () { | ||
sharedLevelsTable.columns.adjust(); | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters