Identify context of upvote when quoting multiple posts.
This commit is contained in:
parent
a596691f77
commit
67b134c20f
@ -4,6 +4,7 @@ Upvotes =
|
|||||||
|
|
||||||
init: ->
|
init: ->
|
||||||
return unless g.VIEW is 'thread' and Conf['Upvotes']
|
return unless g.VIEW is 'thread' and Conf['Upvotes']
|
||||||
|
@regexp = new RegExp "(?:^>.*\\n)+\\s*#{@text}", 'gm'
|
||||||
Post.callbacks.push
|
Post.callbacks.push
|
||||||
name: 'Upvotes'
|
name: 'Upvotes'
|
||||||
cb: @node
|
cb: @node
|
||||||
@ -26,8 +27,12 @@ Upvotes =
|
|||||||
|
|
||||||
Upvotes.count[@fullID] = 0
|
Upvotes.count[@fullID] = 0
|
||||||
|
|
||||||
if @quotes.length is 1 and @info.comment.indexOf(Upvotes.text) >= 0
|
quotes = {}
|
||||||
Upvotes.increment @quotes[0]
|
for context in @info.comment.match(Upvotes.regexp) or []
|
||||||
|
for quote in context.match(/>>\d+/g) or []
|
||||||
|
quotes[quote[2..]] = true
|
||||||
|
for quote of quotes
|
||||||
|
Upvotes.increment "#{g.BOARD}.#{quote}"
|
||||||
|
|
||||||
increment: (fullID) ->
|
increment: (fullID) ->
|
||||||
return unless fullID of Upvotes.count
|
return unless fullID of Upvotes.count
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user