From 6f7e1b5b59a8dd6fbc3dcf85c1e25978e2b6bab2 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 15 Aug 2018 14:23:17 +0200 Subject: [PATCH] Open Query Log with filtering option on Query Type when left-clicking on an element in the pie-chart. The current behavior is moved to middle mouse click. Signed-off-by: DL6ER --- scripts/pi-hole/js/index.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index bd929526..747f8dd7 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -280,7 +280,9 @@ function updateQueryTypesPie() { queryTypePieChart.options.animation.duration=0; // Generate legend in separate div $("#query-types-legend").html(queryTypePieChart.generateLegend()); - $("#query-types-legend > ul > li").on("click",function(e){ + $("#query-types-legend > ul > li").on("mousedown", function(e){ + if(e.which == 2) // which == 2 is middle mouse button + { $(this).toggleClass("strike"); var index = $(this).index(); var ci = e.view.queryTypePieChart; @@ -294,6 +296,11 @@ function updateQueryTypesPie() { } } ci.update(); + } + else if(e.which == 1) // which == 1 is left mouse button + { + window.open("queries.php?querytype="+$(this).index(), "_self"); + } }); }).done(function() { // Reload graph after minute @@ -536,7 +543,9 @@ function updateForwardDestinationsPie() { forwardDestinationPieChart.options.animation.duration=0; // Generate legend in separate div $("#forward-destinations-legend").html(forwardDestinationPieChart.generateLegend()); - $("#forward-destinations-legend > ul > li").on("click",function(e){ + $("#forward-destinations-legend > ul > li").on("mousedown",function(e){ + if(e.which == 2) // which == 2 is middle mouse button + { $(this).toggleClass("strike"); var index = $(this).index(); var ci = e.view.forwardDestinationPieChart; @@ -550,6 +559,12 @@ function updateForwardDestinationsPie() { } } ci.update(); + } + else if(e.which == 1) // which == 1 is left mouse button + { + var obj = encodeURIComponent(e.target.innerText); + window.open("queries.php?forwarddest="+obj, "_self"); + } }); }).done(function() { // Reload graph after one minute