Futureproof the settings format.

pull/1199/head
7kasper 2022-01-01 22:28:30 +01:00
parent b279d3bf69
commit c1fdac9992
No known key found for this signature in database
GPG Key ID: 4AD2FD3E13BFB86A
4 changed files with 30 additions and 5 deletions

View File

@ -5066,7 +5066,7 @@
{
"id": "presentor",
"name": "Presentor",
"version": "2.1",
"version": "2.2",
"description": "Use your Bangle to present!",
"icon": "app.png",
"type": "app",
@ -5077,7 +5077,8 @@
"allow_emulator": true,
"storage": [
{"name":"presentor.app.js","url":"app.js"},
{"name":"presentor.img","url":"app-icon.js","evaluate":true}
{"name":"presentor.img","url":"app-icon.js","evaluate":true},
{"name":"presentor.json","url":"settings.json"}
]
}
]

View File

@ -4,3 +4,4 @@
1.5: Added accelerator style mouse.
2.0: Added touchpad style mouse.
2.1: Initial internal git(hub) release. Added icon and such.
2.2: Begin work on presentation parts.

View File

@ -119,7 +119,11 @@
}
function getJSON() {
let ret = [];
let ret = {
pparts: [],
sversion: 2.2
}
let jparts = [];
let pparts = subber.children;
for (let i = 0; i < pparts.length; i++) {
let rpart = {};
@ -129,8 +133,9 @@
rpart.minutes = ppart.getElementsByClassName('pp-timer')[0].children[0].value | 0;
rpart.seconds = ppart.getElementsByClassName('pp-timer')[0].children[2].value | 0;
rpart.notes = ppart.getElementsByClassName('pp-notes')[0].value;
ret.push(rpart);
jparts.push(rpart);
}
ret.pparts = jparts;
return JSON.stringify(ret);
}
@ -145,7 +150,8 @@
function loadJSON(str) {
cmpStr = str;
let jparts = JSON.parse(str);
let settings = JSON.parse(str);
let jparts = settings.pparts;
for (let i = 0; i < jparts.length; i++) {
addFormPPart(jparts[i]);
}

View File

@ -0,0 +1,17 @@
{
"pparts": [
{
"subject":"#1",
"minutes":10,
"seconds":0,
"notes":"This is a note."
},
{
"subject":"#2",
"minutes":2,
"seconds":50,
"notes":"Change in the app!"
}
],
"sversion": 2.2
}