Restructured settings file handling.
parent
2818c1049f
commit
7a409f74a3
|
|
@ -887,19 +887,19 @@
|
||||||
{ "id": "berlinc",
|
{ "id": "berlinc",
|
||||||
"name": "Berlin Clock",
|
"name": "Berlin Clock",
|
||||||
"icon": "berlin-clock.png",
|
"icon": "berlin-clock.png",
|
||||||
"version":"0.03.07",
|
"version":"0.03.08",
|
||||||
"description": "Berlin Clock (see https://en.wikipedia.org/wiki/Mengenlehreuhr)",
|
"description": "Berlin Clock (see https://en.wikipedia.org/wiki/Mengenlehreuhr)",
|
||||||
"tags": "clock",
|
"tags": "clock",
|
||||||
"type":"clock",
|
"type":"clock",
|
||||||
"allow_emulator":true,
|
"allow_emulator":true,
|
||||||
"data": [
|
"data": [
|
||||||
{"name":"berlin-clock.json"}
|
{ "name":"berlinc.json","storageFile":true}
|
||||||
],
|
],
|
||||||
"storage": [
|
"storage": [
|
||||||
{"name":"berlinc.app.js","url":"berlin-clock.js"},
|
{"name":"berlinc.app.js","url":"berlin-clock.js"},
|
||||||
{"name":"berlinc.img","url":"berlin-clock-icon.js","evaluate":true},
|
{"name":"berlinc.img","url":"berlin-clock-icon.js","evaluate":true},
|
||||||
{"name":"berlinc.settings.js","url":"settings.js"},
|
{"name":"berlinc.settings.js","url":"settings.js"},
|
||||||
{"name":"berlin-clock.json","url":"berlin-clock.json"}
|
{"name":"berlinc.json","url":"berlin-clock.json"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{ "id": "ctrclk",
|
{ "id": "ctrclk",
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ const height = g.getHeight() - 2 * offset;
|
||||||
const rowHeight = height / 4;
|
const rowHeight = height / 4;
|
||||||
|
|
||||||
const storage = require("Storage");
|
const storage = require("Storage");
|
||||||
const settingsfile = 'berlin-clock.json';
|
const settingsfile = 'berlinc.json';
|
||||||
var show_date = false;
|
var show_date = false;
|
||||||
|
|
||||||
rowlights = [];
|
rowlights = [];
|
||||||
|
|
@ -63,7 +63,15 @@ function drawBerlinClock() {
|
||||||
// try to read settings
|
// try to read settings
|
||||||
try {
|
try {
|
||||||
const settings = storage.readJSON(settingsfile);
|
const settings = storage.readJSON(settingsfile);
|
||||||
show_date=settings['showdate'] || false;
|
if (settings) {
|
||||||
|
if (settings.showdate) {
|
||||||
|
show_date=settings.showdate;
|
||||||
|
} else {
|
||||||
|
console.log("Settings file does not contain showdate.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log("Settings file not defined.")
|
||||||
|
}
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
console.log(exception)
|
console.log(exception)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
(function(back) {
|
(function(back) {
|
||||||
|
|
||||||
const SETTINGS_FILE = 'berlin-clock.json'
|
const SETTINGS_FILE = 'berlinc.json'
|
||||||
|
|
||||||
// initialize structure
|
// initialize structure
|
||||||
let s = {
|
let s = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue