hacker-news: add relative timestamp on posts.
parent
64d8c0ccc0
commit
107de1d36e
|
@ -1,9 +1,11 @@
|
|||
! Copyright (C) 2012 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors assocs classes.tuple colors.constants
|
||||
colors.hex combinators concurrency.combinators formatting fry
|
||||
hashtables http.client io io.styles json json.reader kernel make
|
||||
math math.parser sequences splitting ui urls ;
|
||||
|
||||
USING: accessors assocs calendar calendar.elapsed
|
||||
colors.constants colors.hex combinators concurrency.combinators
|
||||
formatting fry hashtables http.client io io.styles json.reader
|
||||
kernel make math math.parser sequences ui urls ;
|
||||
|
||||
IN: hacker-news
|
||||
|
||||
<PRIVATE
|
||||
|
@ -55,7 +57,12 @@ PRIVATE>
|
|||
[ post>url host>> " (" ")" surround write-text nl ]
|
||||
[ "score" of " %d points" sprintf write-text ]
|
||||
[ dup "by" of [ " by " write-text [ "by" of ] [ post>user-url ] bi write-link ] [ drop ] if ]
|
||||
! [ dup postedAgo>> [ " " write-text postedAgo>> write-text ] [ drop ] if ]
|
||||
[
|
||||
"time" of [
|
||||
" " write-text now timestamp>unix-time
|
||||
swap - relative-time write-text
|
||||
] when*
|
||||
]
|
||||
[
|
||||
dup "decendants" of [
|
||||
" | " write-text
|
||||
|
|
Loading…
Reference in New Issue