diff --git a/apps/clockcal/ChangeLog b/apps/clockcal/ChangeLog index 0f501f1fb..6780313ce 100644 --- a/apps/clockcal/ChangeLog +++ b/apps/clockcal/ChangeLog @@ -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 \ No newline at end of file +0.09: You can now back out of the calendar using the button +0.10: Fix linter warnings diff --git a/apps/clockcal/app.js b/apps/clockcal/app.js index 3a0025096..185f2adea 100644 --- a/apps/clockcal/app.js +++ b/apps/clockcal/app.js @@ -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(); diff --git a/apps/clockcal/metadata.json b/apps/clockcal/metadata.json index 60e55ceb7..b84b08575 100644 --- a/apps/clockcal/metadata.json +++ b/apps/clockcal/metadata.json @@ -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", diff --git a/apps/clockcal/settings.js b/apps/clockcal/settings.js index 19059861a..ea613f5c0 100644 --- a/apps/clockcal/settings.js +++ b/apps/clockcal/settings.js @@ -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.?': {