Create settings.js

master
Chriz76 2024-06-30 21:53:05 +02:00 committed by GitHub
parent ff574897dd
commit b1cae599e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,32 @@
(function(back) {
var FILE = "ashadyclock.json";
// Load settings
var settings = Object.assign({
showWidgets: false,
alternativeColor: false,
}, require('Storage').readJSON(FILE, true) || {});
function writeSettings() {
require('Storage').writeJSON(FILE, settings);
}
// Show the menu
E.showMenu({
"" : { "title" : "Shady Clck" },
"< Back" : () => back(),
'Show Widgets': {
value: !!settings.showWidgets, // !! converts undefined to false
onchange: v => {
settings.showWidgets = v;
writeSettings();
}
},
'Blue Color': {
value: !!settings.alternativeColor, // !! converts undefined to false
onchange: v => {
settings.alternativeColor = v;
writeSettings();
}
},
});
})