mirror of https://github.com/espruino/BangleApps
parent
9c69827b48
commit
f56db58890
|
@ -6,4 +6,5 @@
|
|||
0.06: Tell clock widgets to hide.
|
||||
0.07: Convert Yes/No On/Off in settings to checkboxes
|
||||
0.08: Fixed typo in settings.js for DRAGDOWN to make option work
|
||||
0.09: You can now back out of the calendar using the button
|
||||
0.09: You can now back out of the calendar using the button
|
||||
0.10: Fix linter warnings
|
||||
|
|
|
@ -24,6 +24,16 @@ const DEBUG = false;
|
|||
var state = "watch";
|
||||
var monthOffset = 0;
|
||||
|
||||
// FIXME: These variables should maybe be defined inside relevant functions below. The linter complained they were not defined (i.e. they were added to global scope if I understand correctly).
|
||||
let dayInterval;
|
||||
let secondInterval;
|
||||
let minuteInterval;
|
||||
let newmonth;
|
||||
let bottomrightY;
|
||||
let bottomrightX;
|
||||
let rMonth;
|
||||
let dimSeconds;
|
||||
|
||||
/*
|
||||
* Calendar features
|
||||
*/
|
||||
|
@ -46,9 +56,9 @@ function drawFullCalendar(monthOffset) {
|
|||
if (typeof secondInterval !== "undefined") clearTimeout(secondInterval);
|
||||
if (typeof minuteInterval !== "undefined") clearTimeout(minuteInterval);
|
||||
var d = addMonths(Date(), monthOffset);
|
||||
tdy = Date().getDate() + "." + Date().getMonth();
|
||||
let tdy = Date().getDate() + "." + Date().getMonth();
|
||||
newmonth = false;
|
||||
c_y = 0;
|
||||
let c_y = 0;
|
||||
g.reset();
|
||||
g.setBgColor(0);
|
||||
g.clear();
|
||||
|
@ -60,8 +70,8 @@ function drawFullCalendar(monthOffset) {
|
|||
rD.setDate(rD.getDate() - dow);
|
||||
var rDate = rD.getDate();
|
||||
bottomrightY = c_y - 3;
|
||||
clrsun = s.REDSUN ? '#f00' : '#fff';
|
||||
clrsat = s.REDSUN ? '#f00' : '#fff';
|
||||
let clrsun = s.REDSUN ? '#f00' : '#fff';
|
||||
let clrsat = s.REDSUN ? '#f00' : '#fff';
|
||||
var fg = [clrsun, '#fff', '#fff', '#fff', '#fff', '#fff', clrsat];
|
||||
for (var y = 1; y <= 11; y++) {
|
||||
bottomrightY += CELL_H;
|
||||
|
@ -90,7 +100,7 @@ function caldrawMonth(rDate, c, m, rD) {
|
|||
g.setColor(c);
|
||||
g.setFont("Vector", 18);
|
||||
g.setFontAlign(-1, 1, 1);
|
||||
drawyear = ((rMonth % 11) == 0) ? String(rD.getFullYear()).substr(-2) : "";
|
||||
let drawyear = ((rMonth % 11) == 0) ? String(rD.getFullYear()).substr(-2) : "";
|
||||
g.drawString(m + drawyear, bottomrightX, bottomrightY - CELL_H, 1);
|
||||
newmonth = false;
|
||||
}
|
||||
|
@ -214,6 +224,7 @@ function action(a) {
|
|||
if (DEBUG) console.log("action:" + a);
|
||||
state = "unknown";
|
||||
console.log("state -> unknown");
|
||||
let l;
|
||||
switch (a) {
|
||||
case "[ignore]":
|
||||
drawWatch();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "clockcal",
|
||||
"name": "Clock & Calendar",
|
||||
"version": "0.09",
|
||||
"version": "0.10",
|
||||
"description": "Clock with Calendar",
|
||||
"readme":"README.md",
|
||||
"icon": "app.png",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
(function (back) {
|
||||
var FILE = "clockcal.json";
|
||||
defaults={
|
||||
const 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. Will be extra widget eventually
|
||||
MODE24: true, //24h mode vs 12h mode
|
||||
|
@ -12,16 +12,16 @@
|
|||
DRAGLEFT: "[AI:agenda]",
|
||||
DRAGUP: "[calend.]"
|
||||
};
|
||||
settings = Object.assign(defaults, require('Storage').readJSON(FILE, true) || {});
|
||||
let settings = Object.assign(defaults, require('Storage').readJSON(FILE, true) || {});
|
||||
|
||||
actions = ["[ignore]","[calend.]","[AI:music]","[AI:messg]","[AI:agenda]"];
|
||||
let actions = ["[ignore]","[calend.]","[AI:music]","[AI:messg]","[AI:agenda]"];
|
||||
require("Storage").list(RegExp(".app.js")).forEach(element => actions.push(element.replace(".app.js","")));
|
||||
|
||||
function writeSettings() {
|
||||
require('Storage').writeJSON(FILE, settings);
|
||||
}
|
||||
|
||||
menu = {
|
||||
const menu = {
|
||||
"": { "title": "Clock & Calendar" },
|
||||
"< Back": () => back(),
|
||||
'Buzz(dis)conn.?': {
|
||||
|
|
Loading…
Reference in New Issue