diff --git a/CHANGELOG.md b/CHANGELOG.md
index fcc3a9335..3c64ceeaa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,10 +1,11 @@
-- Searching in the index will now show matched OPs by:
+- Searching in the index is now possible and will show matched OPs by:
- comment
- subject
- filename
- name
- tripcode
- e-mail
+- The elapsed time since the last index refresh is now indicated at the top of the index.
### 3.12.1 - *2013-11-04*
diff --git a/html/General/Index-navlinks.html b/html/General/Index-navlinks.html
index 3ac6b2437..dc185f087 100644
--- a/html/General/Index-navlinks.html
+++ b/html/General/Index-navlinks.html
@@ -1,2 +1,3 @@
+[]
[Catalog]
diff --git a/src/General/Index.coffee b/src/General/Index.coffee
index f00b50fd5..77b10aa5f 100644
--- a/src/General/Index.coffee
+++ b/src/General/Index.coffee
@@ -192,6 +192,13 @@ Index =
notice.el.lastElementChild.textContent = 'Index refreshed!'
setTimeout notice.close, $.SECOND
+ timeEl = $ '#index-last-refresh', Index.navLinks
+ timeEl.dataset.utc = e.timeStamp
+ if timeEl.dataset.init
+ RelativeDates.setUpdate el: timeEl
+ delete timeEl.dataset.init
+ else
+ RelativeDates.flush()
Index.scrollToIndex()
parse: (pages) ->
Index.parseThreadList pages
diff --git a/src/Miscellaneous/RelativeDates.coffee b/src/Miscellaneous/RelativeDates.coffee
index d678ecb23..b856a19fd 100644
--- a/src/Miscellaneous/RelativeDates.coffee
+++ b/src/Miscellaneous/RelativeDates.coffee
@@ -1,13 +1,17 @@
RelativeDates =
INTERVAL: $.MINUTE / 2
init: ->
- return if g.VIEW is 'catalog' or !Conf['Relative Post Dates']
-
- # Flush when page becomes visible again or when the thread updates.
- $.on d, 'visibilitychange ThreadUpdate', @flush
-
- # Start the timeout.
- @flush()
+ switch g.VIEW
+ when 'index'
+ @flush()
+ $.on d, 'visibilitychange', @flush
+ return unless Conf['Relative Post Dates']
+ when 'thread'
+ return unless Conf['Relative Post Dates']
+ @flush()
+ $.on d, 'visibilitychange ThreadUpdate', @flush if g.VIEW is 'thread'
+ else
+ return
Post.callbacks.push
name: 'Relative Post Dates'
@@ -21,7 +25,7 @@ RelativeDates =
dateEl = @nodes.date
dateEl.title = dateEl.textContent
- RelativeDates.setUpdate @
+ RelativeDates.setUpdate post: @
# diff is milliseconds from now.
relative: (diff, now, date) ->
@@ -81,7 +85,7 @@ RelativeDates =
# Create function `update()`, closed over post, that, when called
# from `flush()`, updates the elements, and re-calls `setOwnTimeout()` to
# re-add `update()` to the stale list later.
- setUpdate: (post) ->
+ setUpdate: ({post, el}) ->
setOwnTimeout = (diff) ->
delay = if diff < $.MINUTE
$.SECOND - (diff + $.SECOND / 2) % $.SECOND
@@ -94,11 +98,17 @@ RelativeDates =
setTimeout markStale, delay
update = (now) ->
- {date} = post.info
+ date = if post
+ post.info.date
+ else
+ new Date +el.dataset.utc
diff = now - date
relative = RelativeDates.relative diff, now, date
- for singlePost in [post].concat post.clones
- singlePost.nodes.date.firstChild.textContent = relative
+ if post
+ for singlePost in [post].concat post.clones
+ singlePost.nodes.date.firstChild.textContent = relative
+ else
+ el.firstChild.textContent = RelativeDates.relative diff, now, date
setOwnTimeout diff
markStale = -> RelativeDates.stale.push update