Skip to content

Commit

Permalink
Changed logic for the Clock Close button: 1) The show now defaults to…
Browse files Browse the repository at this point in the history
… false. When enabled, the close X always appears, 2) The views also accept this parameter from a GET parameter, which is set when navigating to the view from the menu, so users can bookmark the page without the parameter (nightscout#4824)
  • Loading branch information
sulkaharo authored Jul 29, 2019
1 parent fcca512 commit cdc7669
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
7 changes: 6 additions & 1 deletion lib/client/clock-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ client.render = function render (xhr) {
if (m < 10) m = "0" + m;
$('#clock').text(h + ":" + m);

if (!window.serverSettings.settings.showClockClosebutton) {
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']) {
$('#close').css('display', 'none');
}

Expand Down
2 changes: 1 addition & 1 deletion lib/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function init () {
, secureHstsHeaderIncludeSubdomains: false
, secureHstsHeaderPreload: false
, secureCsp: false
, showClockClosebutton: true
, showClockClosebutton: false
};

var valueMappers = {
Expand Down
6 changes: 3 additions & 3 deletions views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@
<li><a id="admintoolslink" href="admin" target="admintools" class="translate">Admin Tools</a></li>
<li class="multilink">
<a class="translate">Clock Views:</a>
<a id="bgclocklink" href="/clock/bgclock" class="translate multilink">Clock</a>
<a id="clockcolorlink" href="/clock/clock-color" class="translate multilink">Color</a>
<a id="clocklink" href="/clock/clock" class="translate multilink">Simple</a>
<a id="bgclocklink" href="/clock/bgclock?showClockClosebutton=true" class="translate multilink">Clock</a>
<a id="clockcolorlink" href="/clock/clock-color?showClockClosebutton=true" class="translate multilink">Color</a>
<a id="clocklink" href="/clock/clock?showClockClosebutton=true" class="translate multilink">Simple</a>
</li>
</ul>
<fieldset class="browserSettings" id="browserSettings">
Expand Down

0 comments on commit cdc7669

Please sign in to comment.