forked from recordcrash/uhsc-mod-repo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
serial.js
/
serial.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module.exports = {
title: "Serial",
desc: "Shows the time between pages when you hover over command links",
edit(archive) {
},
vueHooks: [{
matchName: "pageNav",
methods: {
commandText(nextpage, sup) {
this.$logger.debug("Method has binding")
let this_timestamp = this.DateTime.fromSeconds(Number(this.thisPage.timestamp))
let next_timestamp = this.DateTime.fromSeconds(Number(nextpage.timestamp))
const duration = next_timestamp.diff(this_timestamp, ['months', 'days', 'hours', 'minutes', 'seconds']);
let relevant_times = Object.keys(duration.values).filter(s => duration.values[s])
let durations = relevant_times.map(s => `${duration.values[s]} ${s}`)
return `<span title="${durations.join(', ')}">` + sup(nextpage) + "</span>"
},
},
}],
}