Add a page indicator on OPs in the index.

This commit is contained in:
Mayhem 2013-11-16 01:10:24 +01:00
parent 8afcac8d6f
commit e7dfbf776b
4 changed files with 19 additions and 4 deletions

View File

@ -8,6 +8,12 @@
<li> tripcode
<li> e-mail
</ul>
- The page number on which threads are will now be displayed in OPs, to easily identify where threads are located when:
<ul>
<li> searching through the index.
<li> using different index sorting types.
<li> threads highlighted by the filter are moved to the top and move other threads down.
<ul>
- The elapsed time since the last index refresh is now indicated at the top of the index.
- New setting: `Show replies`, enabled by default. Disable it to only show OPs in the index.

View File

@ -190,10 +190,12 @@ Build =
else
''
replyLink = if isOP and g.VIEW is 'index'
" &nbsp; <span>[<a href='/#{boardID}/res/#{threadID}' class=replylink>Reply</a>]</span>"
if isOP and g.VIEW is 'index'
pageNum = Math.floor Index.liveThreadIDs.indexOf(postID) / Index.threadsNumPerPage
pageIcon = "<i class='page-num fa fa-file-o' title='This thread is on page #{pageNum} in the original index.'> #{pageNum}</i> "
replyLink = " &nbsp; <span>[<a href='/#{boardID}/res/#{threadID}' class=replylink>Reply</a>]</span>"
else
''
pageIcon = replyLink = ''
container = $.el 'div',
id: "pc#{postID}"
@ -226,6 +228,7 @@ Build =
(if isOP then fileHTML else '') +
"<div class='postInfo desktop' id=pi#{postID}>" +
pageIcon +
"<input type=checkbox name=#{postID} value=delete> " +
"#{subject} " +
"<span class='nameBlock#{capcodeClass}'>" +

View File

@ -250,10 +250,11 @@ Index =
Index.nodes = []
threads = []
posts = []
for threadData in Index.liveThreadData
for threadData, i in Index.liveThreadData
threadRoot = Build.thread g.BOARD, threadData
Index.nodes.push threadRoot, $.el 'hr'
if thread = g.BOARD.threads[threadData.no]
thread.setPage Math.floor i / Index.threadsNumPerPage
thread.setStatus 'Sticky', !!threadData.sticky
thread.setStatus 'Closed', !!threadData.closed
else

View File

@ -12,6 +12,11 @@ class Thread
g.threads[@fullID] = board.threads[@] = @
setPage: (pageNum) ->
icon = $ '.page-num', @OP.nodes.post
for key in ['title', 'textContent']
icon[key] = icon[key].replace /\d+/, pageNum
return
setStatus: (type, status) ->
name = "is#{type}"
return if @[name] is status