mirror of
https://github.com/pi-hole/web.git
synced 2026-02-15 07:25:39 +00:00
Sort IPv4 before IPv6 addresses on the network overview
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -138,6 +138,19 @@ $(function () {
|
||||
var ips = [],
|
||||
iptitles = [];
|
||||
|
||||
// Sort IPs, IPv4 before IPv6, then alphabetically
|
||||
data.ips.sort(function (a, b) {
|
||||
if (a.ip.includes(":") && !b.ip.includes(":")) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!a.ip.includes(":") && b.ip.includes(":")) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return a.ip.localeCompare(b.ip);
|
||||
});
|
||||
|
||||
for (index = 0; index < data.ips.length; index++) {
|
||||
var ip = data.ips[index],
|
||||
iptext = ip.ip;
|
||||
|
||||
Reference in New Issue
Block a user