Fixed bugs in settings.js

Moved list definitions and functions, added direction selector.
master
sossinayDev 2025-08-06 13:05:18 +02:00 committed by GitHub
parent 5c2e29c2a5
commit 342e5a8b10
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 26 additions and 19 deletions

View File

@ -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;
}
}); });