4chan-x/src/Miscellaneous/IDPostCount.coffee
2016-06-19 02:24:02 -07:00

23 lines
647 B
CoffeeScript

IDPostCount =
init: ->
return unless g.VIEW is 'thread' and Conf['Count Posts by ID']
Callbacks.Thread.push
name: 'Count Posts by ID'
cb: -> IDPostCount.thread = @
Callbacks.Post.push
name: 'Count Posts by ID'
cb: @node
node: ->
if @nodes.uniqueID and @thread is IDPostCount.thread
$.on $('span.hand', @nodes.uniqueID), 'mouseover', IDPostCount.count
count: ->
{uniqueID} = Get.postFromNode(@).info
n = 0
IDPostCount.thread.posts.forEach (post) ->
n++ if post.info.uniqueID is uniqueID
@title = "#{n} post#{if n is 1 then '' else 's'} by this ID"
return IDPostCount