adding settings

master
Pablo Gonzalez 2021-01-28 20:05:25 +01:00
parent 3f15f8eb5e
commit 033819e096
2 changed files with 25 additions and 0 deletions

View File

@ -2685,7 +2685,11 @@
"storage": [ "storage": [
{"name":"planetarium.app.js","url":"planetarium.app.js"}, {"name":"planetarium.app.js","url":"planetarium.app.js"},
{"name":"planetarium.data.csv","url":"planetarium.data.csv"}, {"name":"planetarium.data.csv","url":"planetarium.data.csv"},
{"name":"planetarium.settings.js","url":"settings.js"},
{"name":"planetarium.img","url":"planetarium-icon.js","evaluate":true} {"name":"planetarium.img","url":"planetarium-icon.js","evaluate":true}
],
"data":[
{"name":"planetarium.json"}
] ]
} }
] ]

View File

@ -0,0 +1,21 @@
// make sure to enclose the function in parentheses
(function(back) {
let settings = require('Storage').readJSON('planetarium.json',1)||{};
function save(key, value) {
settings[key] = value;
require('Storage').write('planetarium.json',settings);
}
const appMenu = {
'': {'title': 'Planetarium Settings'},
'< Back': back,
'Show star names': {
value: settings.showstarnames||false,
onchange: (m) => {save('showstarnames', m)}
},
'Show constellations': {
value: settings.showcons||true,
onchange: (m) => {save('showcons', m)}
}
};
E.showMenu(appMenu)
})