3.5
UI Overhaul Profiles now in popup Current profile always on screen Hidden columns only when edit neeeded Add pulldowns in to profile config Customised the day tabs for vehicle, indoor and pet
This commit is contained in:
@@ -2,11 +2,13 @@
|
||||
// dynamic-message.js - Rewrites a cosmic event's message based on where
|
||||
// today sits vs. the peak.
|
||||
//
|
||||
// Before peak : "is active and building - peak on <date>. <detail>"
|
||||
// On peak -1d : "peaks tonight - <detail>"
|
||||
// After peak : "is past its peak (<date>) but still possibly visible - <detail>"
|
||||
// Before peak : "is active and building - peak on <date>. <detail> (~NN% chance...)"
|
||||
// On peak -1d : "peaks tonight - <detail> (~NN% chance...)"
|
||||
// After peak : "is past its peak (<date>) but still possibly visible - <detail> (~NN% chance...)"
|
||||
//
|
||||
// Single-day events (start === end) keep their static message unchanged.
|
||||
// `ev.chance` (see ../events/activity-profile.js), when present, is
|
||||
// appended as an estimated viewing-chance figure.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
export function dynamicCosmicMessage(ev, dateStr) {
|
||||
@@ -19,11 +21,12 @@ export function dynamicCosmicMessage(ev, dateStr) {
|
||||
.replace(/^.*?(?:peaks tonight|peak tonight|is active tonight|is active|peaks)\s*—\s*/i, '')
|
||||
.trim();
|
||||
var baseCapd = base.charAt(0).toUpperCase() + base.slice(1);
|
||||
var chanceSuffix = typeof ev.chance === 'number' ? ' (~' + ev.chance + '% chance of a good show tonight)' : '';
|
||||
if (diffDays < -1) {
|
||||
return ev.title + ' is active and building — peak on ' + peakFmt + '. ' + baseCapd;
|
||||
return ev.title + ' is active and building — peak on ' + peakFmt + '. ' + baseCapd + chanceSuffix;
|
||||
} else if (diffDays <= 1) {
|
||||
return ev.title + ' peaks tonight — ' + base;
|
||||
return ev.title + ' peaks tonight — ' + base + chanceSuffix;
|
||||
} else {
|
||||
return ev.title + ' is past its peak (' + peakFmt + ') but still possibly visible — ' + base;
|
||||
return ev.title + ' is past its peak (' + peakFmt + ') but still possibly visible — ' + base + chanceSuffix;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user