Update page/sticky/closed status on index refresh for the catalog.

Conflicts:
	src/General/lib/thread.class
This commit is contained in:
Mayhem 2014-01-26 17:02:55 +01:00 committed by ccd0
parent 37d6b99627
commit 662a3660fe

View File

@ -16,7 +16,7 @@ class Thread
icon = $ '.page-num', @OP.nodes.post icon = $ '.page-num', @OP.nodes.post
for key in ['title', 'textContent'] for key in ['title', 'textContent']
icon[key] = icon[key].replace /\d+/, pageNum icon[key] = icon[key].replace /\d+/, pageNum
return $('.page-count', @catalogView).textContent = pageNum if @catalogView
setCount: (type, count, reachedLimit) -> setCount: (type, count, reachedLimit) ->
return unless @catalogView return unless @catalogView
@ -32,20 +32,26 @@ class Thread
typeLC = type.toLowerCase() typeLC = type.toLowerCase()
unless status unless status
$.rm $ ".#{typeLC}Icon", @OP.nodes.info $.rm $ ".#{typeLC}Icon", @OP.nodes.info
$.rm $ ".#{typeLC}Icon", @catalogView if @catalogView
return return
icon = $.el 'img', icon = $.el 'img',
src: "//s.4cdn.org/image/#{typeLC}#{if window.devicePixelRatio >= 2 then '@2x' else ''}.gif" src: "#{Build.staticPath}#{typeLC}#{Build.gifIcon}"
alt: type alt: type
title: type title: type
className: "#{typeLC}Icon" className: "#{typeLC}Icon"
root = if type is 'Closed' and @isSticky root = if type is 'Closed' and @isSticky
$ '.stickyIcon', @OP.nodes.info $ '.stickyIcon', @OP.nodes.info
else if g.VIEW is 'index' else if g.VIEW is 'index'
$ '.page-num', @OP.nodes.info $ '.page-num', @OP.nodes.info
else else
$ '[title="Reply to this post"]', @OP.nodes.info $ '[title="Reply to this post"]', @OP.nodes.info
$.after root, [$.tn(' '), icon] $.after root, [$.tn(' '), icon]
return unless @catalogView
root = $ '.thread-icons', @catalogView
(if type is 'Sticky' and @isClosed then $.prepend else $.add) root, icon.cloneNode()
getCatalogView: -> getCatalogView: ->
return @catalogView if @catalogView return @catalogView if @catalogView
@catalogView = Build.threadCatalog @ @catalogView = Build.threadCatalog @