use 4chan's new archived thread icon
This commit is contained in:
parent
b992dffaab
commit
e04e933438
@ -43,6 +43,7 @@ Build =
|
||||
# thread status
|
||||
isSticky: !!data.sticky
|
||||
isClosed: !!data.closed
|
||||
isArchived: !!data.archived
|
||||
# file
|
||||
if data.filedeleted
|
||||
o.file =
|
||||
@ -74,7 +75,6 @@ Build =
|
||||
{
|
||||
postID, threadID, boardID
|
||||
name, capcode, tripcode, uniqueID, email, subject, flagCode, flagName, date, dateUTC
|
||||
isSticky, isClosed
|
||||
comment
|
||||
file
|
||||
} = o
|
||||
@ -151,15 +151,9 @@ Build =
|
||||
else
|
||||
"/#{boardID}/thread/#{threadID}\#q#{postID}"
|
||||
|
||||
sticky = if isSticky
|
||||
<%= html(' <img src="//s.4cdn.org/image/sticky${retina}.gif" alt="Sticky" title="Sticky" class="stickyIcon retina">') %>
|
||||
else
|
||||
<%= html('') %>
|
||||
|
||||
closed = if isClosed
|
||||
<%= html(' <img src="//s.4cdn.org/image/closed${retina}.gif" alt="Closed" title="Closed" class="closedIcon retina">') %>
|
||||
else
|
||||
<%= html('') %>
|
||||
icons = for type in ['Sticky', 'Closed', 'Archived'] when o["is#{type}"] and !(type is 'Closed' and o.isArchived)
|
||||
typeLC = type.toLowerCase()
|
||||
<%= html(' <img src="//s.4cdn.org/image/${typeLC}${retina}.gif" alt="${type}" title="${type}" class="${typeLC}Icon retina">') %>
|
||||
|
||||
replyLink = if isOP and g.VIEW is 'index'
|
||||
<%= html(' <span>[<a href="/${boardID}/thread/${threadID}" class="replylink">Reply</a>]</span>') %>
|
||||
@ -175,7 +169,7 @@ Build =
|
||||
'<span class="postNum${desktop2}">' +
|
||||
'<a href="${postLink}" title="Link to this post">No.</a>' +
|
||||
'<a href="${quoteLink}" title="Reply to this post">${postID}</a>' +
|
||||
'&{sticky}&{closed}&{replyLink}' +
|
||||
'@{icons}&{replyLink}' +
|
||||
'</span>' +
|
||||
'</div>'
|
||||
) %>
|
||||
|
||||
@ -166,7 +166,6 @@ Main =
|
||||
|
||||
for threadRoot in $$ '.board > .thread', board
|
||||
thread = new Thread +threadRoot.id[1..], g.BOARD
|
||||
thread.isDead = thread.isArchived = !!$('.closed')?.textContent.match(/Thread archived/) if g.VIEW is 'thread'
|
||||
threads.push thread
|
||||
for postRoot in $$ '.thread > .postContainer', threadRoot
|
||||
try
|
||||
|
||||
@ -43,8 +43,10 @@ class Post
|
||||
|
||||
unless @isReply = $.hasClass post, 'reply'
|
||||
@thread.OP = @
|
||||
@thread.isSticky = !!$ '.stickyIcon', info
|
||||
@thread.isClosed = !!$ '.closedIcon', info
|
||||
@thread.isArchived = !!$ '.archivedIcon', info
|
||||
@thread.isSticky = !!$ '.stickyIcon', info
|
||||
@thread.isClosed = @thread.isArchived or !!$ '.closedIcon', info
|
||||
@thread.kill() if @thread.isArchived
|
||||
|
||||
@info = {}
|
||||
if subject = $ '.subject', info
|
||||
|
||||
@ -3,12 +3,13 @@ class Thread
|
||||
toString: -> @ID
|
||||
|
||||
constructor: (@ID, @board) ->
|
||||
@fullID = "#{@board}.#{@ID}"
|
||||
@posts = new SimpleDict
|
||||
@isSticky = false
|
||||
@isClosed = false
|
||||
@postLimit = false
|
||||
@fileLimit = false
|
||||
@fullID = "#{@board}.#{@ID}"
|
||||
@posts = new SimpleDict
|
||||
@isSticky = false
|
||||
@isClosed = false
|
||||
@isArchived = false
|
||||
@postLimit = false
|
||||
@fileLimit = false
|
||||
|
||||
g.threads.push @fullID, board.threads.push @, @
|
||||
|
||||
@ -19,21 +20,30 @@ class Thread
|
||||
$.after $('a[title="Reply to this post"]', info), [$.tn(' '), icon]
|
||||
icon.title = "This thread is on page #{pageNum} in the original index."
|
||||
icon.textContent = "[#{pageNum}]"
|
||||
|
||||
setStatus: (type, status) ->
|
||||
name = "is#{type}"
|
||||
return if @[name] is status
|
||||
@[name] = status
|
||||
return unless @OP
|
||||
@setIcon 'Sticky', @isSticky
|
||||
@setIcon 'Closed', @isClosed and !@isArchived
|
||||
@setIcon 'Archived', @isArchived
|
||||
|
||||
setIcon: (type, status) ->
|
||||
typeLC = type.toLowerCase()
|
||||
icon = $ ".#{typeLC}Icon", @OP.nodes.info
|
||||
return if !!icon is status
|
||||
unless status
|
||||
$.rm $ ".#{typeLC}Icon", @OP.nodes.info
|
||||
$.rm icon.previousSibling
|
||||
$.rm icon
|
||||
return
|
||||
icon = $.el 'img',
|
||||
src: "//s.4cdn.org/image/#{typeLC}#{if window.devicePixelRatio >= 2 then '@2x' else ''}.gif"
|
||||
alt: type
|
||||
title: type
|
||||
className: "#{typeLC}Icon retina"
|
||||
root = if type is 'Closed' and @isSticky
|
||||
root = if type isnt 'Sticky' and @isSticky
|
||||
$ '.stickyIcon', @OP.nodes.info
|
||||
else
|
||||
$('.page-num', @OP.nodes.info) or $('[title="Reply to this post"]', @OP.nodes.info)
|
||||
|
||||
@ -132,8 +132,7 @@ ThreadUpdater =
|
||||
switch req.status
|
||||
when 200
|
||||
ThreadUpdater.parse req.response.posts
|
||||
if !!req.response.posts[0].archived
|
||||
ThreadUpdater.thread.isArchived = true
|
||||
if ThreadUpdater.thread.isArchived
|
||||
ThreadUpdater.set 'status', 'Archived', 'warning'
|
||||
ThreadUpdater.kill()
|
||||
else
|
||||
@ -263,6 +262,7 @@ ThreadUpdater =
|
||||
OP = postObjects[0]
|
||||
Build.spoilerRange[ThreadUpdater.thread.board] = OP.custom_spoiler
|
||||
|
||||
ThreadUpdater.thread.setStatus 'Archived', !!OP.archived
|
||||
ThreadUpdater.updateThreadStatus 'Sticky', !!OP.sticky
|
||||
ThreadUpdater.updateThreadStatus 'Closed', !!OP.closed
|
||||
ThreadUpdater.thread.postLimit = !!OP.bumplimit
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user