Remove default upvote text.
This commit is contained in:
parent
9bb2476a2c
commit
754a1bc1e9
@ -1020,3 +1020,5 @@ Config =
|
|||||||
pruneReplies:
|
pruneReplies:
|
||||||
'Prune Replies': false
|
'Prune Replies': false
|
||||||
'Max Replies': 1000
|
'Max Replies': 1000
|
||||||
|
|
||||||
|
upvoteText: ''
|
||||||
|
|||||||
@ -39,7 +39,6 @@ Upvotes =
|
|||||||
|
|
||||||
init: ->
|
init: ->
|
||||||
return unless g.VIEW in ['thread', 'index'] and Conf['Upvotes']
|
return unless g.VIEW in ['thread', 'index'] and Conf['Upvotes']
|
||||||
@textPosted = if g.BOARD.ID is 'r9k' then 'This.' else @text
|
|
||||||
Post.callbacks.push
|
Post.callbacks.push
|
||||||
name: 'Upvotes'
|
name: 'Upvotes'
|
||||||
cb: @node
|
cb: @node
|
||||||
@ -81,11 +80,23 @@ Upvotes =
|
|||||||
|
|
||||||
vote: ->
|
vote: ->
|
||||||
return unless QR.postingIsEnabled
|
return unless QR.postingIsEnabled
|
||||||
|
$.off QR.nodes.com, 'input', Upvotes.setText if QR.nodes
|
||||||
QR.quote.call @
|
QR.quote.call @
|
||||||
{com} = QR.nodes
|
{com} = QR.nodes
|
||||||
text = "#{Upvotes.textPosted}\n"
|
text = "#{Conf['upvoteText']}\n"
|
||||||
pos = com.selectionStart
|
pos = com.selectionStart
|
||||||
|
Upvotes.context = com.value[...pos]
|
||||||
com.value = com.value[...pos] + text + com.value[pos..]
|
com.value = com.value[...pos] + text + com.value[pos..]
|
||||||
pos += text.length
|
pos += text.length
|
||||||
com.setSelectionRange pos, pos
|
com.setSelectionRange pos, pos
|
||||||
$.event 'input', null, com
|
$.event 'input', null, com
|
||||||
|
Upvotes.post = $.id 'selected'
|
||||||
|
$.on com, 'input', Upvotes.setText
|
||||||
|
|
||||||
|
setText: ->
|
||||||
|
{context} = Upvotes
|
||||||
|
if $.id('selected') is Upvotes.post and @value[...context.length] is context
|
||||||
|
Conf['upvoteText'] = @value[context.length..].split('\n')[0]
|
||||||
|
$.set 'upvoteText', Conf['upvoteText']
|
||||||
|
else
|
||||||
|
$.off @, 'input', Upvotes.setText
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user