diff --git a/src/Miscellaneous/IDPostCount.coffee b/src/Miscellaneous/IDPostCount.coffee new file mode 100644 index 000000000..8248e7b79 --- /dev/null +++ b/src/Miscellaneous/IDPostCount.coffee @@ -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 diff --git a/src/config/Config.coffee b/src/config/Config.coffee index bead6a5ce..f79031b32 100644 --- a/src/config/Config.coffee +++ b/src/config/Config.coffee @@ -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.' diff --git a/src/main/Main.coffee b/src/main/Main.coffee index 5d59cd588..d561c0fa8 100644 --- a/src/main/Main.coffee +++ b/src/main/Main.coffee @@ -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]