Implement Count Posts by ID. #851
This commit is contained in:
parent
160bf025c8
commit
1ff286ad3a
22
src/Miscellaneous/IDPostCount.coffee
Normal file
22
src/Miscellaneous/IDPostCount.coffee
Normal file
@ -0,0 +1,22 @@
|
||||
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
|
||||
@ -97,6 +97,10 @@ Config =
|
||||
true
|
||||
'Assign unique colors to user IDs on boards that use them'
|
||||
]
|
||||
'Count Posts by ID': [
|
||||
true
|
||||
'Display number of posts in the thread when hovering over an ID.'
|
||||
]
|
||||
'Remove Spoilers': [
|
||||
false
|
||||
'Remove all spoilers in text.'
|
||||
|
||||
@ -438,6 +438,7 @@ Main =
|
||||
['Fourchan thingies', Fourchan]
|
||||
['Color User IDs', IDColor]
|
||||
['Highlight by User ID', IDHighlight]
|
||||
['Count Posts by ID', IDPostCount]
|
||||
['Custom CSS', CustomCSS]
|
||||
['Thread Links', ThreadLinks]
|
||||
['Linkify', Linkify]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user