Files: 0df7b2e9903705c4b2201aa29a6a6c1560b102af / modules / timestamp.js
525 bytesRaw
1 | var h = require('hyperscript') |
2 | var human = require('human-time') |
3 | |
4 | function updateTimestampEl(el) { |
5 | el.firstChild.nodeValue = human(new Date(el.timestamp)) |
6 | return el |
7 | } |
8 | |
9 | setInterval(function () { |
10 | var els = [].slice.call(document.querySelectorAll('.pw__timestamp')) |
11 | els.forEach(updateTimestampEl) |
12 | }, 60e3) |
13 | |
14 | exports.message_main_meta = function (msg) { |
15 | return updateTimestampEl(h('a.enter.pw__timestamp', { |
16 | href: '#'+msg.key, |
17 | timestamp: msg.value.timestamp, |
18 | title: new Date(msg.value.timestamp) |
19 | }, '')) |
20 | } |
21 |
Built with git-ssb-web