Fixed bugs in settings.js
Moved list definitions and functions, added direction selector.master
parent
5c2e29c2a5
commit
342e5a8b10
|
|
@ -1,9 +1,26 @@
|
||||||
(function(back) {
|
(function(back) {
|
||||||
const FILE = "flex.settings.json";
|
const FILE = "flux.settings.json";
|
||||||
|
|
||||||
|
// Color list shared across fields
|
||||||
|
const COLORS = [
|
||||||
|
"White", "Black", "Red", "Blue", "Green",
|
||||||
|
"Yellow", "Orange", "Purple", "Lime",
|
||||||
|
"Cyan", "Pink", "Light Blue"
|
||||||
|
];
|
||||||
|
|
||||||
|
const directions = [
|
||||||
|
"Up > Down",
|
||||||
|
"Down > Up"
|
||||||
|
];
|
||||||
|
|
||||||
|
function colorIndex(name) {
|
||||||
|
let i = COLORS.indexOf(name);
|
||||||
|
return i >= 0 ? i : 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Load existing settings with defaults
|
// Load existing settings with defaults
|
||||||
let settings = Object.assign({
|
let settings = Object.assign({
|
||||||
"24hour": false,
|
direction: 0,
|
||||||
bg: "Black",
|
bg: "Black",
|
||||||
fg: "White",
|
fg: "White",
|
||||||
bg2: "Lime",
|
bg2: "Lime",
|
||||||
|
|
@ -15,12 +32,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
E.showMenu({
|
E.showMenu({
|
||||||
"": { title: "Flex Watchface" },
|
"": { title: "Flux Watchface" },
|
||||||
"< Back": back,
|
"< Back": back,
|
||||||
"24 Hour Time": {
|
"Direction": {
|
||||||
value: !!settings["24hour"],
|
value: settings.direction,
|
||||||
onchange: v => {
|
min: 0, max: 1,
|
||||||
settings["24hour"] = v;
|
format: i => directions[i],
|
||||||
|
onchange: i => {
|
||||||
|
settings.direction = i;
|
||||||
writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -61,16 +80,4 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Color list shared across fields
|
|
||||||
const COLORS = [
|
|
||||||
"White", "Black", "Red", "Blue", "Green",
|
|
||||||
"Yellow", "Orange", "Purple", "Lime",
|
|
||||||
"Cyan", "Pink", "Light Blue"
|
|
||||||
];
|
|
||||||
|
|
||||||
function colorIndex(name) {
|
|
||||||
let i = COLORS.indexOf(name);
|
|
||||||
return i >= 0 ? i : 0;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue