From 3a8f199dd4159ba288cc7496b1ac2eb3c247ea6a Mon Sep 17 00:00:00 2001 From: Sulka Haro Date: Tue, 30 Jul 2019 14:15:05 +0300 Subject: [PATCH] One more clock change - the SHOW_CLOCK_CLOSEBUTTON setting can now be used to disable the X from appearing in the clocks at any time. The default is to show it when the GET parameter is set, allowing bookmarking a clock without the X, but retaining it when navigating to the page --- README.md | 2 +- lib/client/clock-client.js | 6 ++---- lib/settings.js | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 13a5999ddc6..fd85b987107 100644 --- a/README.md +++ b/README.md @@ -309,7 +309,7 @@ To learn more about the Nightscout API, visit https://YOUR-SITE.com/api-docs.htm * `Clock` - Shows current BG, trend arrow, and time of day. Grey text on a black background. * `Color` - Shows current BG and trend arrow. White text on a background that changes color to indicate current BG threshold (green = in range; blue = below range; yellow = above range; red = urgent below/above). * `Simple` - Shows current BG. Grey text on a black background. - * Optional configuration: set `SHOW_CLOCK_CLOSEBUTTON` (`false`) to `true` to show the small X button to close the views at all times. For bookmarking a clock view without the Close box, remove the `showClockClosebutton=true` parameter from the clock view URL. + * Optional configuration: set `SHOW_CLOCK_CLOSEBUTTON` to `false` to never show the small X button in clock views. For bookmarking a clock view without the close box but have it appear when navigating to a clock from the Nightscout menu, don't change the settng, but remove the `showClockClosebutton=true` parameter from the clock view URL. ### Plugins diff --git a/lib/client/clock-client.js b/lib/client/clock-client.js index b2821f70fdb..2b4c063ff9f 100644 --- a/lib/client/clock-client.js +++ b/lib/client/clock-client.js @@ -67,10 +67,8 @@ client.render = function render (xhr) { var queryDict = {}; location.search.substr(1).split("&").forEach(function(item) { queryDict[item.split("=")[0]] = item.split("=")[1] }); - - console.log(queryDict); - - if (!window.serverSettings.settings.showClockClosebutton && !queryDict['showClockClosebutton']) { + + if (!window.serverSettings.settings.showClockClosebutton || !queryDict['showClockClosebutton']) { $('#close').css('display', 'none'); } diff --git a/lib/settings.js b/lib/settings.js index eb0e3011bcb..2d16abd0f2d 100644 --- a/lib/settings.js +++ b/lib/settings.js @@ -47,7 +47,7 @@ function init () { , secureHstsHeaderIncludeSubdomains: false , secureHstsHeaderPreload: false , secureCsp: false - , showClockClosebutton: false + , showClockClosebutton: true , deNormalizeDates: false };