Update pebble.settings.js

master
sir-indy 2022-03-29 15:27:34 +01:00 committed by GitHub
parent abdd91b6f1
commit 4d6773c022
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 8 deletions

View File

@ -2,7 +2,7 @@
const SETTINGS_FILE = "pebble.json"; const SETTINGS_FILE = "pebble.json";
// initialize with default settings... // initialize with default settings...
let s = {'bg': '#0f0', 'color': 'Green', 'theme':'System', 'showlock':'false'} let s = {'bg': '#0f0', 'color': 'Green', 'theme':'System', 'showlock':false}
// ...and overwrite them with any saved values // ...and overwrite them with any saved values
// This way saved values are preserved if a new version adds more settings // This way saved values are preserved if a new version adds more settings
@ -21,7 +21,6 @@
var color_options = ['Green','Orange','Cyan','Purple','Red','Blue']; var color_options = ['Green','Orange','Cyan','Purple','Red','Blue'];
var bg_code = ['#0f0','#ff0','#0ff','#f0f','#f00','#00f']; var bg_code = ['#0f0','#ff0','#0ff','#f0f','#f00','#00f'];
var theme_options = ['System', 'Light', 'Dark']; var theme_options = ['System', 'Light', 'Dark'];
var lock_options = ['false', 'true'];
E.showMenu({ E.showMenu({
'': { 'title': 'Pebble Clock' }, '': { 'title': 'Pebble Clock' },
@ -46,13 +45,12 @@
} }
}, },
'Show Lock': { 'Show Lock': {
value: 0 | lock_options.indexOf(s.showlock), value: settings.showlock,
min: 0, max: lock_options.length - 1, format: () => (settings.showlock ? 'Yes' : 'No'),
format: v => lock_options[v], onchange: () => {
onchange: v => { settings.showlock = !settings.showlock;
s.showlock = lock_options[v];
save(); save();
} }
} },
}); });
}) })