This commit is contained in:
Nicolas Stepien 2013-04-15 23:05:32 +02:00
parent cf1d94876a
commit b3ea2cc08f

View File

@ -29,6 +29,11 @@ QR =
QR.nodes.com.focus()
Header.addShortcut sc
$.on d, 'QRGetSelectedPost', ({detail: cb}) ->
cb QR.selected
$.on d, 'QRAddPreSubmitHook', ({detail: cb}) ->
QR.preSubmitHooks.push cb
<% if (type === 'crx') { %>
$.on d, 'paste', QR.paste
<% } %>
@ -449,6 +454,7 @@ QR =
rectList = @nodes.el.parentNode.getBoundingClientRect()
@nodes.el.parentNode.scrollLeft += rectEl.left + rectEl.width/2 - rectList.left - rectList.width/2
@load()
$.event 'QRPostSelection', @
load: ->
# Load this post's values.
for name in ['thread', 'name', 'email', 'sub', 'com']
@ -860,6 +866,7 @@ QR =
# Use it to extend the QR's functionalities, or for XTRM RICE.
$.event 'QRDialogCreation', null, dialog
preSubmitHooks: []
submit: (e) ->
e?.preventDefault()
@ -892,6 +899,9 @@ QR =
err = 'No file selected.'
else if post.file and thread.fileLimit and !thread.isSticky
err = 'Max limit of image replies has been reached.'
else for hook in QR.preSubmitHooks
if err = hook post, thread
break
if QR.captcha.isEnabled and !err
{challenge, response} = QR.captcha.getOne()
@ -1046,11 +1056,10 @@ QR =
val: true
# Post/upload confirmed as successful.
$.event 'QRPostSuccessful', {
$.event 'QRPostSuccessful',
board: g.BOARD
threadID
postID
}, QR.nodes.el
# Enable auto-posting if we have stuff to post, disable it otherwise.
QR.cooldown.auto = QR.posts.length > 1 and isReply