diff --git a/src/002-config/fc-js-init.js b/src/002-config/fc-js-init.js index ff16bb6b663e94dfc8ea59ef54558a9025662d97..3c923124687bca8b341a43c66007c69029106124 100644 --- a/src/002-config/fc-js-init.js +++ b/src/002-config/fc-js-init.js @@ -43,6 +43,7 @@ App.RA = {}; App.SF = {}; App.Corporate = {}; App.SecExp = {}; +App.Reminders = {}; Object.defineProperty(App, "activeSlave", { diff --git a/src/Mods/Reminder/reminder.js b/src/Mods/Reminder/reminder.js new file mode 100644 index 0000000000000000000000000000000000000000..5954e3413d10f0533118a2d320a734d82766335d --- /dev/null +++ b/src/Mods/Reminder/reminder.js @@ -0,0 +1,7 @@ +App.Reminders.add = function(entry, week) { + if (entry.length > 0 && week.length > 0 && !isNaN(week)) { + V.reminders.entries.push(entry); + V.reminders.weeks.push(week); + V.reminders.text.push(`${entry} in ${numberWithPlural(week, 'week')}`); + } +}; diff --git a/src/pregmod/managePersonalAffairs.tw b/src/pregmod/managePersonalAffairs.tw index de50d0a9a638cfe8534441c50a03af638d61c55d..c11c5bfffc21662f99bd4fe487c2a23cbf11dd81 100644 --- a/src/pregmod/managePersonalAffairs.tw +++ b/src/pregmod/managePersonalAffairs.tw @@ -218,11 +218,11 @@ Sclera: <br><br> -<<if $reminders.length == 0>> +<<if $reminders.text.length == 0>> You do not have any reminders set. <<else>> - You have $reminders.length reminders set: - <<print $reminders>> + You have <<=numberWithPlural($reminders.text.length, "reminder")>> set: + <<print $reminders.text>> <</if>> <br> Remind me @@ -230,23 +230,13 @@ Remind me in <<textbox "$reminderWeek" "">> weeks. -<<link "Add" "Manage Personal Affairs">> - <<if $reminderEntry.length > 0 && $reminderWeek.length > 0>> - <<set $reminderWeek = parseInt($reminderWeek)>> - <<set $reminderEntries.push($reminderEntry), $reminderWeeks.push($reminderWeek)>> - <<run $reminders.push(`${$reminderEntry} in ${$reminderWeek} ${$reminderWeek == 1 ? 'week' : 'weeks'}`)>> - <</if>> -<</link>> +[[Add|Manage Personal Affairs][App.Reminders.add($reminderEntry, $reminderWeek)]] <br> -<<if $reminders.length > 0 || $cheatMode || $debugMode>> - <<link "Clear your reminders" "Manage Personal Affairs">> - <<set $reminders = [], $reminderEntries = [], $reminderWeeks = []>> - <</link>>/* | - TODO: - <<link "Clear a reminder" "Manage Personal Affairs">> +<<if $reminders.text.length > 0 || $cheatMode || $debugMode>> + [[Clear your reminders|Manage Personal Affairs][$reminders = {entries: [], weeks: [], text: []}]] + /* TODO: <<link "Clear a reminder" "Manage Personal Affairs">> <<include "Clear Reminder">> - <</link>> - */ + <</link>> */ <</if>> <br><br> diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw index fb72f9a0d33e6a471fe4e06b3d0ff5d5cca68a97..e8b910238532e8860818b586af24e1537bbed449 100644 --- a/src/uncategorized/BackwardsCompatibility.tw +++ b/src/uncategorized/BackwardsCompatibility.tw @@ -154,13 +154,11 @@ <</if>> <<if ndef $reminders>> - <<set $reminders = []>> -<</if>> -<<if ndef $reminderEntries>> - <<set $reminderEntries = []>> -<</if>> -<<if ndef $reminderWeeks>> - <<set $reminderWeeks = []>> + <<set $reminders = { + entries: [], + weeks: [], + text: [] + }>> <</if>> <<if $releaseID < 1057>>