Skip to content

Commit

Permalink
Show tooltip only when the number of items is greater than MAXIPDISPLAY
Browse files Browse the repository at this point in the history
  • Loading branch information
rdwebdesign committed Aug 8, 2024
1 parent 4562dd5 commit e81d49e
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 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,8 +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).attr("title", allnames.join("\n"));
}

// Set number of queries to localized string (add thousand separators)
Expand All @@ -191,10 +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).attr("title", data.ip.join("\n"));

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

0 comments on commit e81d49e

Please sign in to comment.