From 3647cc0e444d5607e9d704a1f37a9abd80312c67 Mon Sep 17 00:00:00 2001 From: frigis1 <63980066+frigis1@users.noreply.github.com> Date: Sat, 9 Apr 2022 12:22:24 -0700 Subject: [PATCH] Update app.js --- apps/noteify/app.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/noteify/app.js b/apps/noteify/app.js index 327546a58..2f6c2cca7 100644 --- a/apps/noteify/app.js +++ b/apps/noteify/app.js @@ -138,6 +138,13 @@ function showAlarmMenu() { else txt = "Alarm"+" "+formatTime(alarm.t); if (alarm.rp) txt += "\0"+atob("FBaBAAABgAAcAAHn//////wAHsABzAAYwAAMAADAAAAAAwAAMAADGAAzgAN4AD//////54AAOAABgAA="); + // rename duplicate alarms + if (menu[type+txt]) { + var n = 2; + while (menu[type+" "+n+txt]) n++; + txt = type+" "+n+txt; + } else txt = type+txt; + // add to menu menu[txt] = { value : "\0"+atob(alarm.on?"EhKBAH//v/////////////5//x//j//H+eP+Mf/A//h//z//////////3//g":"EhKBAH//v//8AA8AA8AA8AA8AA8AA8AA8AA8AA8AA8AA8AA8AA8AA///3//g"), onchange : function() { @@ -218,8 +225,7 @@ function editAlarm(alarmIndex, alarm) { }; menu["Save"] = function() { a.t = encodeTime(t); - if (a.t < getCurrentTime()) - a.day = (new Date()).getDate(); + a.last = (a.t < getCurrentTime()) ? (new Date()).getDate() : 0; if (newAlarm) alarms.push(a); else alarms[alarmIndex] = a; saveAndReload();