Skip to content

Commit 158d72b

Browse files
author
thyttan
committed
messagegui: fix lint warnings and error
1 parent a45e578 commit 158d72b

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

apps/messagegui/app.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,7 @@ function showMessageScroller2(msg, persist, alreadyProcessed) {
291291
active = "scroller";
292292
var bodyFont = fontBig;
293293
g.setFont(bodyFont);
294-
var allLines = [];
295294
var titleLines = [];
296-
var j = MESSAGES.length-1;
297295
var messagesWrapped = [];
298296
for (let j=startIdx; j<stopIdx; j++) {
299297
let msgLocal = MESSAGES[j];
@@ -316,17 +314,17 @@ function showMessageScroller2(msg, persist, alreadyProcessed) {
316314
if (titleCnt) {lines.push("");} // add blank line after title
317315
lines = lines.concat(g.wrapString(msgLocal.body, g.getWidth()-10), ["-".repeat(j+1)]);
318316
messagesWrapped.push(lines);
319-
};
320-
let allLines2 = [];
317+
}
318+
let allLines = [];
321319
for (let i=0;i<messagesWrapped.length;i++) {
322-
allLines2 = allLines2.concat(messagesWrapped[i]);
320+
allLines = allLines.concat(messagesWrapped[i]);
323321
}
324322

325323
var initScroll = messagesWrapped[0].length;
326324
if (initiatedFrom === "other function"){
327325
if (msgIdx==0) initScroll = 0;
328326
} else if (initiatedFrom === "scrolling up") {
329-
titleLines = titleLines.concat(alreadyProcessed.titleLines.map((x) => x + allLines2.length));
327+
titleLines = titleLines.concat(alreadyProcessed.titleLines.map((x) => x + allLines.length));
330328
} else if (initiatedFrom === "scrolling down"){
331329
initScroll = alreadyProcessed.lines.length-9;
332330
titleLines = alreadyProcessed.titleLines.concat(titleLines.map((x) => x + alreadyProcessed.lines.length));
@@ -335,20 +333,20 @@ function showMessageScroller2(msg, persist, alreadyProcessed) {
335333
if (initiatedFrom === "other function"){
336334
// no-op
337335
} else if (initiatedFrom === "scrolling up") {
338-
allLines2 = allLines2.concat(alreadyProcessed.lines);
336+
allLines = allLines.concat(alreadyProcessed.lines);
339337
} else if (initiatedFrom === "scrolling down"){
340-
allLines2 = alreadyProcessed.lines.concat(allLines2);
338+
allLines = alreadyProcessed.lines.concat(allLines);
341339
}
342340

343-
if (allLines2.length == 0 && alreadyProcessed.lines.length == 0) {
341+
if (allLines.length == 0 && alreadyProcessed.lines.length == 0) {
344342
cancelReloadTimeout();
345343
returnToClockIfEmpty();
346344
}
347345

348346
Object.assign(
349347
updatedProcessed,
350348
{
351-
lines : allLines2,
349+
lines : allLines,
352350
titleLines : titleLines,
353351
messagesWrappedLength : messagesWrapped.length
354352
}
@@ -359,15 +357,15 @@ function showMessageScroller2(msg, persist, alreadyProcessed) {
359357
E.showScroller({
360358
scroll : initScroll*g.getFontHeight(),
361359
h : g.getFontHeight(), // height of each menu item in pixels
362-
c : allLines2.length, // number of menu items
360+
c : allLines.length, // number of menu items
363361
// a function to draw a menu item
364362
draw : function(scrollIdx, r) {
365363
"ram"
366364
g.setBgColor(titleLines.find((e)=>e==scrollIdx)!==undefined ? g.theme.bg2 : g.theme.bg).
367365
setColor(titleLines.find((e)=>e==scrollIdx)!==undefined ? g.theme.fg2 : g.theme.fg).
368366
clearRect(r);
369-
g.setFont(bodyFont).setFontAlign(0,-1).drawString(allLines2[scrollIdx], r.x+r.w/2, r.y);
370-
if (scrollIdx>=allLines2.length-1 && scrollIdx!=prevScrollIdx && updatedProcessed.stopIdx < MESSAGES.length) {
367+
g.setFont(bodyFont).setFontAlign(0,-1).drawString(allLines[scrollIdx], r.x+r.w/2, r.y);
368+
if (scrollIdx>=allLines.length-1 && scrollIdx!=prevScrollIdx && updatedProcessed.stopIdx < MESSAGES.length) {
371369
setTimeout(() => {
372370
E.showScroller();
373371
showMessageScroller2(MESSAGES[updatedProcessed.stopIdx], true, updatedProcessed);

0 commit comments

Comments
 (0)