From f96d6cc0f00eb290c4448fcd984a8f47df676bc3 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Tue, 17 Dec 2019 17:14:55 +0200 Subject: [PATCH 1/2] Remove more unused variables Signed-off-by: XhmikosR --- scripts/pi-hole/js/db_lists.js | 4 +--- scripts/pi-hole/js/db_queries.js | 11 +---------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/scripts/pi-hole/js/db_lists.js b/scripts/pi-hole/js/db_lists.js index b91ce147..91d37562 100644 --- a/scripts/pi-hole/js/db_lists.js +++ b/scripts/pi-hole/js/db_lists.js @@ -62,7 +62,7 @@ function updateTopClientsChart() { // Clear tables before filling them with data $("#client-frequency td").parent().remove(); var clienttable = $("#client-frequency").find("tbody:last"); - var client, percentage, clientname, clientip; + var client, percentage, clientname; var sum = 0; for (client in data.top_sources) { if (Object.prototype.hasOwnProperty.call(data.top_sources, client)){ @@ -84,12 +84,10 @@ function updateTopClientsChart() { { var idx = client.indexOf("|"); clientname = client.substr(0, idx); - clientip = client.substr(idx+1, client.length-idx); } else { clientname = client; - clientip = client; } var url = clientname; diff --git a/scripts/pi-hole/js/db_queries.js b/scripts/pi-hole/js/db_queries.js index 56078713..9791723f 100644 --- a/scripts/pi-hole/js/db_queries.js +++ b/scripts/pi-hole/js/db_queries.js @@ -231,59 +231,50 @@ $(document).ready(function() { tableApi = $("#all-queries").DataTable( { "rowCallback": function( row, data ){ - var blocked, fieldtext, buttontext, color; + var fieldtext, buttontext, color; switch (data[4]) { case 1: - blocked = true; color = "red"; fieldtext = "Blocked (gravity)"; buttontext = ""; break; case 2: - blocked = false; color = "green"; fieldtext = "OK (forwarded)"; buttontext = ""; break; case 3: - blocked = false; color = "green"; fieldtext = "OK (cached)"; buttontext = ""; break; case 4: - blocked = true; color = "red"; fieldtext = "Blocked (regex/wildcard)"; buttontext = ""; break; case 5: - blocked = true; color = "red"; fieldtext = "Blocked (blacklist)"; buttontext = ""; break; case 6: - blocked = true; color = "red"; fieldtext = "Blocked (external, IP)"; buttontext = ""; break; case 7: - blocked = true; color = "red"; fieldtext = "Blocked (external, NULL)"; buttontext = ""; break; case 8: - blocked = true; color = "red"; fieldtext = "Blocked (external, NXRA)"; buttontext = ""; break; default: - blocked = false; color = "black"; fieldtext = "Unknown"; buttontext = ""; From 8898a742d214516833fb32f0adea7c3374be12bb Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 17 Dec 2019 16:12:19 +0000 Subject: [PATCH 2/2] Use one variable less. Signed-off-by: DL6ER --- scripts/pi-hole/js/db_lists.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/pi-hole/js/db_lists.js b/scripts/pi-hole/js/db_lists.js index 91d37562..42104ee9 100644 --- a/scripts/pi-hole/js/db_lists.js +++ b/scripts/pi-hole/js/db_lists.js @@ -90,9 +90,8 @@ function updateTopClientsChart() { clientname = client; } - var url = clientname; percentage = data.top_sources[client] / sum * 100.0; - clienttable.append(" " + url + + clienttable.append(" " + clientname + " " + data.top_sources[client] + "
"); }