Skip to content

Commit 0582183

Browse files
committed
Add title to replaced times with the original
1 parent d80841e commit 0582183

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

regression-script.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,22 @@ const duration = pt => {
1515

1616
function localiseTimes(all) {
1717
for (const elt of Array.from(document.getElementsByTagName('time'))) {
18-
if (elt.classList.contains('ago'))
18+
if (elt.classList.contains('ago')) {
19+
elt.title = elt.innerText.slice(elt.innerText.indexOf('[')+1,-1)
1920
elt.innerText = ` [${formatDistanceToNow(elt.dateTime, optionsAgo)}]`
20-
else if (elt.classList.contains('since'))
21+
}
22+
else if (elt.classList.contains('since')) {
23+
elt.title = elt.innerText
2124
elt.innerText = `[elapsed: ${formatDistanceToNow(elt.dateTime)}]`
22-
else if (elt.classList.contains('duration'))
25+
}
26+
else if (elt.classList.contains('duration')) {
27+
elt.title = elt.innerText
2328
elt.innerText = `[average: ${formatDuration(duration(elt.dateTime))}]`
24-
else if (all)
29+
}
30+
else if (all) {
31+
elt.title = elt.innerText
2532
elt.innerText = format(elt.dateTime, dateFormat)
33+
}
2634
}
2735
}
2836

0 commit comments

Comments
 (0)