Configurable drag gestures
parent
6158d76f17
commit
d0426a2093
|
|
@ -1,18 +1,21 @@
|
||||||
(function (back) {
|
(function (back) {
|
||||||
var FILE = "clockcal.json";
|
var FILE = "clockcal.json";
|
||||||
|
defaults={
|
||||||
settings = Object.assign({
|
|
||||||
CAL_ROWS: 4, //number of calendar rows.(weeks) Shouldn't exceed 5 when using widgets.
|
CAL_ROWS: 4, //number of calendar rows.(weeks) Shouldn't exceed 5 when using widgets.
|
||||||
BUZZ_ON_BT: true, //2x slow buzz on disconnect, 2x fast buzz on connect. Will be extra widget eventually
|
BUZZ_ON_BT: true, //2x slow buzz on disconnect, 2x fast buzz on connect. Will be extra widget eventually
|
||||||
MODE24: true, //24h mode vs 12h mode
|
MODE24: true, //24h mode vs 12h mode
|
||||||
FIRSTDAY: 6, //First day of the week: mo, tu, we, th, fr, sa, su
|
FIRSTDAY: 6, //First day of the week: mo, tu, we, th, fr, sa, su
|
||||||
REDSUN: true, // Use red color for sunday?
|
REDSUN: true, // Use red color for sunday?
|
||||||
REDSAT: true, // Use red color for saturday?
|
REDSAT: true, // Use red color for saturday?
|
||||||
DRAGENABLED: true, //Enable drag gestures (bigger calendar etc)
|
DRAGDOWN: "[AI:messg]",
|
||||||
DRAGMUSIC: true, //Enable drag down for music (looks for "music*app")
|
DRAGRIGHT: "[AI:music]",
|
||||||
DRAGMESSAGES: true //Enable drag right for messages (looks for "message*app")
|
DRAGLEFT: "[ignore]",
|
||||||
}, require('Storage').readJSON(FILE, true) || {});
|
DRAGUP: "[calend.]"
|
||||||
|
};
|
||||||
|
settings = Object.assign(defaults, require('Storage').readJSON(FILE, true) || {});
|
||||||
|
|
||||||
|
actions = ["[ignore]","[calend.]","[AI:music]","[AI:messg]"];
|
||||||
|
require("Storage").list(RegExp(".app.js")).forEach(element => actions.push(element.replace(".app.js","")));
|
||||||
|
|
||||||
function writeSettings() {
|
function writeSettings() {
|
||||||
require('Storage').writeJSON(FILE, settings);
|
require('Storage').writeJSON(FILE, settings);
|
||||||
|
|
@ -70,27 +73,39 @@
|
||||||
writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'Swipes (big cal.)?': {
|
'Drag Up ': {
|
||||||
value: settings.DRAGENABLED,
|
min:0, max:actions.length-1,
|
||||||
format: v => v ? "On" : "Off",
|
value: actions.indexOf(settings.DRAGUP),
|
||||||
|
format: v => actions[v],
|
||||||
onchange: v => {
|
onchange: v => {
|
||||||
settings.DRAGENABLED = v;
|
settings.DRAGUP = actions[v];
|
||||||
writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'Swipes (music)?': {
|
'Drag Right': {
|
||||||
value: settings.DRAGMUSIC,
|
min:0, max:actions.length-1,
|
||||||
format: v => v ? "On" : "Off",
|
value: actions.indexOf(settings.DRAGRIGHT),
|
||||||
|
format: v => actions[v],
|
||||||
onchange: v => {
|
onchange: v => {
|
||||||
settings.DRAGMUSIC = v;
|
settings.DRAGRIGHT = actions[v];
|
||||||
writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'Swipes (messg)?': {
|
'Drag Down': {
|
||||||
value: settings.DRAGMESSAGES,
|
min:0, max:actions.length-1,
|
||||||
format: v => v ? "On" : "Off",
|
value: actions.indexOf(settings.DRAGDOWN),
|
||||||
|
format: v => actions[v],
|
||||||
onchange: v => {
|
onchange: v => {
|
||||||
settings.DRAGMESSAGES = v;
|
settings.DRGDOWN = actions[v];
|
||||||
|
writeSettings();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'Drag Left': {
|
||||||
|
min:0, max:actions.length-1,
|
||||||
|
value: actions.indexOf(settings.DRAGLEFT),
|
||||||
|
format: v => actions[v],
|
||||||
|
onchange: v => {
|
||||||
|
settings.DRAGLEFT = actions[v];
|
||||||
writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -100,17 +115,7 @@
|
||||||
format: v => ["No", "Yes"][v],
|
format: v => ["No", "Yes"][v],
|
||||||
onchange: v => {
|
onchange: v => {
|
||||||
if (v == 1) {
|
if (v == 1) {
|
||||||
settings = {
|
settings = defaults;
|
||||||
CAL_ROWS: 4, //number of calendar rows.(weeks) Shouldn't exceed 5 when using widgets.
|
|
||||||
BUZZ_ON_BT: true, //2x slow buzz on disconnect, 2x fast buzz on connect.
|
|
||||||
MODE24: true, //24h mode vs 12h mode
|
|
||||||
FIRSTDAY: 6, //First day of the week: mo, tu, we, th, fr, sa, su
|
|
||||||
REDSUN: true, // Use red color for sunday?
|
|
||||||
REDSAT: true, // Use red color for saturday?
|
|
||||||
DRAGENABLED: true,
|
|
||||||
DRAGMUSIC: true,
|
|
||||||
DRAGMESSAGES: true
|
|
||||||
};
|
|
||||||
writeSettings();
|
writeSettings();
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue