-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththreshold.settings.js
More file actions
66 lines (58 loc) · 1.42 KB
/
Copy paththreshold.settings.js
File metadata and controls
66 lines (58 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
(function(back) {
const S = require('Storage');
let settings = Object.assign({
bio: 1,
height: 1.70,
weight: 70,
counter: 0
}, S.readJSON('threshold.json', true) || {});
function save(key, value) {
settings[key] = value;
S.writeJSON('threshold.json', settings);
}
const BIO = ['Female', 'Male'];
let confMenu = {
'': {
'title': 'Threshold'
},
'< Back': back,
'Biological sex': {
value: settings.bio,
min: 0,
max: 1,
format: b => BIO[b],
onchange: b => save('bio', b)
},
'Height (metric)': {
value: settings.height,
min: 0.55, // Chandra Bahadur Dangi
max: 2.72, // Robert Wadlow
step: 0.01,
onchange: h => save('height', h)
},
'Weight (kg)': {
value: settings.weight,
min: 2, // Lucía Zárate
max: 635, // Jon Brower Minnoch
step: 1,
onchange: w => save('weight', w)
},
'Reset Counter': () => {
//save('counter', 0);
E.showPrompt('Confirm erase counter?', {
title: 'Threshold',
buttons: {
'Yes': true,
'No': false
},
remove: () => {
load(__FILE__);
}
}).then((v) => {
if (v) save('counter', 0);
load(__FILE__);
});
}
};
E.showMenu(confMenu);
})