diff --git a/4chan_x.user.js b/4chan_x.user.js index 5316af27f..489f58af7 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -5719,9 +5719,14 @@ }, close: function() { var i, _i, _len, _ref; + if (QR.req) { + if (!QR.req.isUploadFinished) { + QR.abort(); + } + return; + } QR.nodes.el.hidden = true; QR.cleanNotifications(); - QR.abort(); d.activeElement.blur(); $.rmClass(QR.nodes.el, 'dump'); _ref = QR.replies; @@ -6519,7 +6524,9 @@ e.preventDefault(); } if (QR.req) { - QR.abort(); + if (!QR.req.isUploadFinished) { + QR.abort(); + } return; } if (QR.cooldown.seconds) { @@ -6607,6 +6614,7 @@ form: $.formData(post), upCallbacks: { onload: function() { + QR.req.isUploadFinished = true; QR.req.progress = '...'; return QR.status(); }, diff --git a/src/qr.coffee b/src/qr.coffee index daf166a5d..03272add8 100644 --- a/src/qr.coffee +++ b/src/qr.coffee @@ -62,9 +62,11 @@ QR = message: 'Quick Reply dialog creation crashed.' error: err close: -> + if QR.req + QR.abort() unless QR.req.isUploadFinished + return QR.nodes.el.hidden = true QR.cleanNotifications() - QR.abort() d.activeElement.blur() $.rmClass QR.nodes.el, 'dump' for i in QR.replies @@ -738,7 +740,7 @@ QR = e?.preventDefault() if QR.req - QR.abort() + QR.abort() unless QR.req.isUploadFinished return if QR.cooldown.seconds @@ -823,6 +825,7 @@ QR = upCallbacks: onload: -> # Upload done, waiting for server response. + QR.req.isUploadFinished = true QR.req.progress = '...' QR.status() onprogress: (e) ->