From 623cecc64cfba15f2095d4007ee43eb517d099d1 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 14 Feb 2020 17:41:03 +0100 Subject: [PATCH 1/5] Also show regex link when this is CNAME regex blocked. Signed-off-by: DL6ER --- scripts/pi-hole/js/queries.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js index 58c64cd2..6e659ea9 100644 --- a/scripts/pi-hole/js/queries.js +++ b/scripts/pi-hole/js/queries.js @@ -250,6 +250,18 @@ $(document).ready(function() { blocked = true; colorClass = "text-red"; fieldtext = "Blocked (regex blacklist, CNAME)"; + + if (data.length > 9 && data[9] > -1) { + fieldtext = + "" + + fieldtext + + ' '; + } + buttontext = ''; isCNAME = true; From 1d7889d7549e40ae0f61d9f3cbd7793caa64cbf8 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 14 Feb 2020 17:50:51 +0100 Subject: [PATCH 2/5] Add hover title to regex link icon. Signed-off-by: DL6ER --- scripts/pi-hole/js/queries.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js index 6e659ea9..483927a7 100644 --- a/scripts/pi-hole/js/queries.js +++ b/scripts/pi-hole/js/queries.js @@ -207,7 +207,7 @@ $(document).ready(function() { colorClass + ">" + fieldtext + - ' '; + ' '; } buttontext = @@ -259,7 +259,7 @@ $(document).ready(function() { colorClass + ">" + fieldtext + - ' '; + ' '; } buttontext = From facb5b07a941ebeb36cccb563965dda9241eb0d8 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 14 Feb 2020 17:54:34 +0100 Subject: [PATCH 3/5] Regex IDs start from 1 by default. 0 means the query has been imported from the database. It makes no sense to show a link when we don't know which regex was responsible for blocking (this is not stored in the database). Signed-off-by: DL6ER --- scripts/pi-hole/js/queries.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js index 483927a7..d68aa29c 100644 --- a/scripts/pi-hole/js/queries.js +++ b/scripts/pi-hole/js/queries.js @@ -199,7 +199,7 @@ $(document).ready(function() { colorClass = "text-red"; fieldtext = "Blocked (regex blacklist)"; - if (data.length > 9 && data[9] > -1) { + if (data.length > 9 && data[9] > 0) { fieldtext = "(regex blacklist, CNAME)"; - if (data.length > 9 && data[9] > -1) { + if (data.length > 9 && data[9] > 0) { fieldtext = "(regex blacklist)"; if (data.length > 9 && data[9] > 0) { - fieldtext = - "" + - fieldtext + - ' '; + regexLink = true; } buttontext = @@ -252,14 +246,7 @@ $(document).ready(function() { fieldtext = "Blocked (regex blacklist, CNAME)"; if (data.length > 9 && data[9] > 0) { - fieldtext = - "" + - fieldtext + - ' '; + regexLink = true; } buttontext = @@ -285,6 +272,25 @@ $(document).ready(function() { $("td:eq(4)", row).html(fieldtext); $("td:eq(6)", row).html(buttontext); + if (regexLink) { + $("td:eq(4)", row).hover( + function() { + this.title = "Click to show matching regex filter"; + this.style.color = "#72afd2"; + }, + function() { + this.style.color = ""; + } + ); + $("td:eq(4)", row).click(function() { + var new_tab = window.open("groups-domains.php?domainid=" + data[9], "_blank"); + if (new_tab) { + new_tab.focus(); + } + }); + $("td:eq(4)", row).css("cursor", "pointer"); + } + // Add domain in CNAME chain causing the query to have been blocked var domain = data[2]; var CNAME_domain = data[8]; From 09c7ba99fa393d04ffd59915c7aea7e7946076f0 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 15 Feb 2020 12:25:07 +0100 Subject: [PATCH 5/5] Underline clickable regex links on Query Log page. Signed-off-by: DL6ER --- scripts/pi-hole/js/queries.js | 3 ++- style/pi-hole.css | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js index 95f847da..ca999435 100644 --- a/scripts/pi-hole/js/queries.js +++ b/scripts/pi-hole/js/queries.js @@ -288,7 +288,8 @@ $(document).ready(function() { new_tab.focus(); } }); - $("td:eq(4)", row).css("cursor", "pointer"); + $("td:eq(4)", row).addClass("underline"); + $("td:eq(4)", row).addClass("pointer"); } // Add domain in CNAME chain causing the query to have been blocked diff --git a/style/pi-hole.css b/style/pi-hole.css index eb986c22..b17a4a17 100644 --- a/style/pi-hole.css +++ b/style/pi-hole.css @@ -242,4 +242,12 @@ td.highlight { background-color: yellow; -} \ No newline at end of file +} + +.underline { + text-decoration: underline; +} + +.pointer { + cursor: pointer; +}