Merge pull request #75 from ok2/codex/improve-tooltip-for-event-details
Improve event tooltip info
This commit is contained in:
commit
6e45dca49a
27
script.js
27
script.js
@ -764,7 +764,9 @@ function showEonstripDetail(index, startCob) {
|
|||||||
start: relStart,
|
start: relStart,
|
||||||
end: relEnd,
|
end: relEnd,
|
||||||
cobStart: occ,
|
cobStart: occ,
|
||||||
cobEnd: occ + duration
|
cobEnd: occ + duration,
|
||||||
|
seriesStart: startCobEv,
|
||||||
|
seriesEnd: endCobEv
|
||||||
});
|
});
|
||||||
occ += interval;
|
occ += interval;
|
||||||
}
|
}
|
||||||
@ -813,21 +815,26 @@ function showEonstripDetail(index, startCob) {
|
|||||||
|
|
||||||
const tooltip = document.createElement('div');
|
const tooltip = document.createElement('div');
|
||||||
tooltip.className = 'tooltip';
|
tooltip.className = 'tooltip';
|
||||||
const opts = {
|
const optsShort = {
|
||||||
timeZone: currentTimezone === 'TAI' ? 'UTC' : currentTimezone,
|
timeZone: currentTimezone === 'TAI' ? 'UTC' : currentTimezone,
|
||||||
year: 'numeric', month: 'short', day: 'numeric',
|
year: 'numeric', month: 'short', day: 'numeric',
|
||||||
hour: '2-digit', minute: '2-digit', second: '2-digit',
|
hour: '2-digit', minute: '2-digit',
|
||||||
hour12: false
|
hour12: false
|
||||||
};
|
};
|
||||||
const startStr = formatCobieTimestamp(ev.cobStart);
|
|
||||||
const endStr = formatCobieTimestamp(ev.cobEnd);
|
const startStr = formatCobieTimestamp(ev.cobStart);
|
||||||
const startDate = fromCobiets(ev.cobStart).toLocaleString('en-US', opts);
|
const endStr = formatCobieTimestamp(ev.cobEnd);
|
||||||
const endDate = fromCobiets(ev.cobEnd).toLocaleString('en-US', opts);
|
const startDate = fromCobiets(ev.cobStart).toLocaleString('en-US', optsShort);
|
||||||
|
const endDate = fromCobiets(ev.cobEnd).toLocaleString('en-US', optsShort);
|
||||||
|
const seriesStart = formatCobieTimestamp(ev.seriesStart);
|
||||||
|
const seriesEnd = isFinite(ev.seriesEnd) ?
|
||||||
|
formatCobieTimestamp(ev.seriesEnd) : '∞';
|
||||||
|
|
||||||
tooltip.innerHTML =
|
tooltip.innerHTML =
|
||||||
`<strong>${ev.label}</strong><br>` +
|
`<strong>${ev.label}</strong><br>` +
|
||||||
`Start: ${startStr}<br>` +
|
`Start: ${startStr} (${startDate})<br>` +
|
||||||
`End: ${endStr}<br>` +
|
`End: ${endStr} (${endDate})<br>` +
|
||||||
`${startDate} – ${endDate}`;
|
`Series: ${seriesStart} – ${seriesEnd}`;
|
||||||
elem.appendChild(tooltip);
|
elem.appendChild(tooltip);
|
||||||
timeline.appendChild(elem);
|
timeline.appendChild(elem);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user