secure-scuttlebot classic
at main 613 B view raw
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}