Make sure stuff that updates the comment field sets the character count and thumbnail view.
This commit is contained in:
parent
5a0d17a8bb
commit
b2db2dc224
@ -124,10 +124,7 @@ QR.post = class
|
|||||||
QR.status()
|
QR.status()
|
||||||
@updateFlashURL()
|
@updateFlashURL()
|
||||||
when 'com'
|
when 'com'
|
||||||
@nodes.span.textContent = @com
|
@updateComment()
|
||||||
# Post count temporarily off by 1 when called from QR.post.rm or QR.close
|
|
||||||
$.queueTask -> QR.captcha.onPostChange()
|
|
||||||
QR.characterCount()
|
|
||||||
# Disable auto-posting if you're typing in the first post
|
# Disable auto-posting if you're typing in the first post
|
||||||
# during the last 5 seconds of the cooldown.
|
# during the last 5 seconds of the cooldown.
|
||||||
if QR.cooldown.auto and @ is QR.posts[0] and 0 < QR.cooldown.seconds <= 5
|
if QR.cooldown.auto and @ is QR.posts[0] and 0 < QR.cooldown.seconds <= 5
|
||||||
@ -149,6 +146,19 @@ QR.post = class
|
|||||||
@save node
|
@save node
|
||||||
return
|
return
|
||||||
|
|
||||||
|
setComment: (com) ->
|
||||||
|
@com = com or null
|
||||||
|
if @ is QR.selected
|
||||||
|
QR.nodes.com.value = @com
|
||||||
|
@updateComment()
|
||||||
|
|
||||||
|
updateComment: ->
|
||||||
|
if @ is QR.selected
|
||||||
|
QR.characterCount()
|
||||||
|
@nodes.span.textContent = @com
|
||||||
|
# Post count temporarily off by 1 when called from QR.post.rm or QR.close
|
||||||
|
$.queueTask -> QR.captcha.onPostChange()
|
||||||
|
|
||||||
@rmErrored: (e) ->
|
@rmErrored: (e) ->
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
for post in QR.posts by -1 when errors = post.errors
|
for post in QR.posts by -1 when errors = post.errors
|
||||||
@ -340,26 +350,17 @@ QR.post = class
|
|||||||
url = "https://i.4cdn.org/f/#{encodeURIComponent E url}.swf\n"
|
url = "https://i.4cdn.org/f/#{encodeURIComponent E url}.swf\n"
|
||||||
oldURL = @flashURL or ''
|
oldURL = @flashURL or ''
|
||||||
if url isnt oldURL
|
if url isnt oldURL
|
||||||
@com or= ''
|
com = @com or ''
|
||||||
@com = @com[oldURL.length..] if @com[...oldURL.length] is oldURL
|
if com[...oldURL.length] is oldURL
|
||||||
@com = (url + @com) or null
|
@setComment url + com[oldURL.length..]
|
||||||
if @ is QR.selected
|
|
||||||
QR.nodes.com.value = @com
|
|
||||||
QR.characterCount()
|
|
||||||
@flashURL = url
|
@flashURL = url
|
||||||
|
|
||||||
pasteText: (file) ->
|
pasteText: (file) ->
|
||||||
@pasting = true
|
@pasting = true
|
||||||
reader = new FileReader()
|
reader = new FileReader()
|
||||||
reader.onload = (e) =>
|
reader.onload = (e) =>
|
||||||
text = e.target.result
|
{result} = e.target
|
||||||
if @com
|
@setComment (if @com then "#{@com}\n#{result}" else result)
|
||||||
@com += "\n#{text}"
|
|
||||||
else
|
|
||||||
@com = text
|
|
||||||
if QR.selected is @
|
|
||||||
QR.nodes.com.value = @com
|
|
||||||
@nodes.span.textContent = @com
|
|
||||||
delete @pasting
|
delete @pasting
|
||||||
reader.readAsText file
|
reader.readAsText file
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user