mirror of
https://github.com/pi-hole/web.git
synced 2025-12-23 20:28:28 +00:00
Use Array.map() instead of looping over elements and pushing the content to a new array
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -313,16 +313,7 @@ $(document).ready(function() {
|
|||||||
"ajax": {
|
"ajax": {
|
||||||
"url": APIstring,
|
"url": APIstring,
|
||||||
"error": handleAjaxError,
|
"error": handleAjaxError,
|
||||||
"dataSrc": function(data){
|
"dataSrc": function(data){ return data.data.map(function(x){ x[0] = x[0]*1e6+(dataIndex++); return x; }); }
|
||||||
var new_data = new Array();
|
|
||||||
for(obj of data.data)
|
|
||||||
{
|
|
||||||
obj[0] *= parseInt(1e6);
|
|
||||||
obj[0] += dataIndex++;
|
|
||||||
new_data.push(obj);
|
|
||||||
}
|
|
||||||
return new_data;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"autoWidth" : false,
|
"autoWidth" : false,
|
||||||
"processing": true,
|
"processing": true,
|
||||||
|
|||||||
@@ -302,16 +302,7 @@ $(document).ready(function() {
|
|||||||
"ajax": {
|
"ajax": {
|
||||||
"url": APIstring,
|
"url": APIstring,
|
||||||
"error": handleAjaxError,
|
"error": handleAjaxError,
|
||||||
"dataSrc": function(data){
|
"dataSrc": function(data){ return data.data.map(function(x){ x[0] = x[0]*1e6+(dataIndex++); return x; }); }
|
||||||
var new_data = new Array();
|
|
||||||
for(obj of data.data)
|
|
||||||
{
|
|
||||||
obj[0] *= parseInt(1e6);
|
|
||||||
obj[0] += dataIndex++;
|
|
||||||
new_data.push(obj);
|
|
||||||
}
|
|
||||||
return new_data;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"autoWidth" : false,
|
"autoWidth" : false,
|
||||||
"processing": true,
|
"processing": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user