Skip to content

Commit

Permalink
Fix the "title" attribute to show all IPs/hostnames (v5) (#3099)
Browse files Browse the repository at this point in the history
  • Loading branch information
rdwebdesign authored Aug 11, 2024
2 parents 88acc11 + e81d49e commit 14ecadc
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions scripts/pi-hole/js/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,6 @@ $(function () {
names.push('<a href="queries.php?client=' + name + '">' + name + "</a>");
}

if (data.name.length > MAXIPDISPLAY) {
// We hit the maximum above, add "..." to symbolize we would
// have more to show here
names.push("...");
}

maxiter = Math.min(data.ip.length, data.name.length);
var allnames = [];
for (index = 0; index < maxiter; index++) {
Expand All @@ -172,10 +166,16 @@ $(function () {
}
}

if (data.name.length > MAXIPDISPLAY) {
// We hit the maximum above, add "..." to symbolize we would
// have more to show here
names.push("...");
// Show the names on the title when there are more than MAXIPDISPLAY items
$("td:eq(3)", row).attr("title", allnames.join("\n"));
}

// Show the names in the first column
$("td:eq(3)", row).html(names.join("<br>"));
$("td:eq(3)", row).on("hover", function () {
this.title = allnames.join("\n");
});
}

// Set number of queries to localized string (add thousand separators)
Expand All @@ -193,12 +193,12 @@ $(function () {
// We hit the maximum above, add "..." to symbolize we would
// have more to show here
ips.push("...");
// Show the IPs on the title when there are more than MAXIPDISPLAY items
$("td:eq(0)", row).attr("title", data.ip.join("\n"));
}

// Show the IPs in the first column
$("td:eq(0)", row).html(ips.join("<br>"));
$("td:eq(0)", row).on("hover", function () {
this.title = data.ip.join("\n");
});

// MAC + Vendor field if available
if (data.macVendor && data.macVendor.length > 0) {
Expand Down

0 comments on commit 14ecadc

Please sign in to comment.