From 53d3197c6abaa62e051355092f9993e3690e5a1d Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 24 Jan 2012 23:53:22 +0100 Subject: [PATCH] Indicate the wait for a response from sys.4chan.org after an upload with some ellipsis. --- 4chan_x.user.js | 10 ++++++++-- script.coffee | 10 +++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) 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: ->