From 4337dabff646d39ddab1ddd4f2f04ed4a8f0b9fa Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 2 Jan 2020 13:28:01 +0000 Subject: [PATCH] Always break tooltip title into two lines on narrow screens. Signed-off-by: DL6ER --- scripts/pi-hole/js/db_graph.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/pi-hole/js/db_graph.js b/scripts/pi-hole/js/db_graph.js index 8636244d..e39f39b3 100644 --- a/scripts/pi-hole/js/db_graph.js +++ b/scripts/pi-hole/js/db_graph.js @@ -257,12 +257,20 @@ $(document).ready(function() { padNumber(time.getMinutes()) + ":" + padNumber(time.getSeconds()); + if (from_date === until_date) { // Abbreviated form for intervals on the same day - return "Queries from " + from_time + " to " + until_time + " on " + from_date; + // We split title in two lines on small screens + if ($(window).width() < 992) { + until_time += "\n"; + } + + return ("Queries from " + from_time + " to " + until_time + " on " + from_date).split( + "\n " + ); } - // Full tooltip for intervals spanning more than one date. + // Full tooltip for intervals spanning more than one day // We split title in two lines on small screens if ($(window).width() < 992) { from_date += "\n";