diff --git a/4chan_x.user.js b/4chan_x.user.js index f8a3add48..3e3c4e38a 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1262,7 +1262,7 @@ value = 404; disabled = true; } else if (data) { - if (data.progress != null) value = "" + data.progress + "%"; + if (data.progress) value = data.progress; } qr.status.input.value = value || 'Submit'; return qr.status.input.disabled = disabled || false; @@ -1727,10 +1727,16 @@ form: form, type: 'post', upCallbacks: { + onload: function() { + return qr.message.send({ + status: true, + progress: '...' + }); + }, onprogress: function(e) { return qr.message.send({ status: true, - progress: Math.floor(e.loaded / e.total * 100) + progress: "" + (Math.round(e.loaded / e.total * 100)) + "%" }); } } diff --git a/script.coffee b/script.coffee index e14c45ea0..147406347 100644 --- a/script.coffee +++ b/script.coffee @@ -912,8 +912,8 @@ qr = value = 404 disabled = true else if data - if data.progress? - value = "#{data.progress}%" + if data.progress + value = data.progress qr.status.input.value = value or 'Submit' qr.status.input.disabled = disabled or false @@ -1310,10 +1310,14 @@ qr = form: form type: 'post' upCallbacks: + onload: -> + qr.message.send + status: true + progress: '...' onprogress: (e) -> qr.message.send status: true - progress: Math.floor e.loaded / e.total * 100 + progress: "#{Math.round e.loaded / e.total * 100}%" options = init: ->