git ssb

1+

ev / minbay



Tree: afe7de9580840925af61711b5ab0d6c57d1131a4

Files: afe7de9580840925af61711b5ab0d6c57d1131a4 / modules / timestamp.js

613 bytesRaw
1var h = require('hyperscript')
2var human = require('human-time')
3
4exports.needs = {}
5
6exports.gives = 'message_meta'
7
8exports.create = function () {
9
10 function updateTimestampEl(el) {
11 el.firstChild.nodeValue = human(new Date(el.timestamp))
12 return el
13 }
14
15 setInterval(function () {
16 var els = [].slice.call(document.querySelectorAll('.timestamp'))
17 els.forEach(updateTimestampEl)
18 }, 60e3)
19
20 return function (msg) {
21 return updateTimestampEl(h('a.enter.timestamp', {
22 href: '#'+msg.key,
23 timestamp: msg.value.timestamp,
24 title: new Date(msg.value.timestamp)
25 }, ''))
26 }
27
28}
29

Built with git-ssb-web