This commit is contained in:
poiuty 2023-06-20 17:15:53 +03:00
parent 54fa7db94a
commit 4831ad34b8
5 changed files with 978 additions and 121 deletions

View file

@ -12,30 +12,20 @@ window.addEventListener("resize", function() {
$(".icon-menu").removeClass("_active");
$(".header_mobile_nav").hide();
}
if(tables["main"]["status"] == "mobile"){
tables["main"]["status"] = "desktop";
tables["main"].page.len(10).draw();
}
return;
}
if(tables["main"]["status"] == "desktop"){
tables["main"]["status"] = "mobile";
tables["main"].page.len(100).draw();
for (const [key] of Object.entries(tables)) {
if(window.innerWidth > 805 && tables[key]["status"] == "mobile"){
tables[key]["status"] = "desktop";
tables[key].page.len(10).draw();
}
if(window.innerWidth < 805 && tables[key]["status"] == "desktop"){
tables[key]["status"] = "mobile";
tables[key].page.len(100).draw();
}
}
});
var dataTableOptions = {
bAutoWidth: false,
oLanguage: {
sLengthMenu: "Show _MENU_ entries",
sSearch: "",
sSearchPlaceholder: "Search",
},
pagingType: 'simple_numbers', // or numbers
iDisplayLength: 10,
order: [[5, "desc"]],
};
$('.dropdown-menu').on( 'click', 'a', function() {
text = $(this).html();
htmlText = text + ' <span class="caret"></span>';
@ -202,28 +192,35 @@ function statbate() {
}
function createTables(){
tables["main"] = $('#main').DataTable({
...dataTableOptions,
aoColumns: [
{ "orderable": false, "searchable": false, "sWidth": "5%" },
{ "orderable": false, "sWidth": "35%" },
{ "orderable": false, "sWidth": "15%" },
{ "searchable": false, "sWidth": "15%" },
{ "searchable": false, "sWidth": "15%" },
{ "searchable": false, "sWidth": "15%" },
],
});
tables["main"]["status"] = "mobile";
if(window.innerWidth > 805){
tables["main"]["status"] = "desktop";
dataTableOptions = {
bAutoWidth: false,
oLanguage: {
sLengthMenu: "Show _MENU_ entries",
sSearch: "",
sSearchPlaceholder: "Search",
},
pagingType: 'simple_numbers', // or numbers
iDisplayLength: 10,
order: [[5, "desc"]],
};
aoColumns = [
{ "orderable": false, "searchable": false, "sWidth": "5%" },
{ "orderable": false, "sWidth": "35%" },
{ "orderable": false, "sWidth": "15%" },
{ "searchable": false, "sWidth": "15%" },
{ "searchable": false, "sWidth": "15%" },
{ "searchable": false, "sWidth": "15%" },
];
tables["main"] = $('#main').DataTable({...dataTableOptions, aoColumns: aoColumns,});
aoColumns[2]["searchable"] = false;
tables["top100dons"] = $("#top100dons").DataTable({...dataTableOptions, aoColumns: aoColumns,});
for (const [key] of Object.entries(tables)) {
tables[key]["status"] = (window.innerWidth > 805) ? "desktop" : "mobile";
}
}
msgs = {arr: [],};
//oTable.page.len(100).draw();
statbate();
showStat();