summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2013-09-17 18:54:06 -0400
committerczaks <marcin@6irc.net>2013-09-17 18:54:06 -0400
commit9516aa199730115014538314dd46a5eaf3b12d20 (patch)
tree318b2a209a8573fe59ed62f326a54021c8b3f43e /js
parent6d3ac4c5126e7f3aabd499bca2e6cdef7cd91a43 (diff)
ajax.js: fix upload progress display in firefox
Diffstat (limited to 'js')
-rw-r--r--js/ajax.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/js/ajax.js b/js/ajax.js
index 74cfe9c0..ee2ff7b5 100644
--- a/js/ajax.js
+++ b/js/ajax.js
@@ -28,7 +28,14 @@ $(window).ready(function() {
formData.append('post', submit_txt);
var updateProgress = function(e) {
- $(form).find('input[type="submit"]').val(_('Posting... (#%)').replace('#', Math.round(e.position / e.total * 100)));
+ var percentage;
+ if (e.position === undefined) { // Firefox
+ percentage = Math.round(e.loaded * 100 / e.total);
+ }
+ else { // Chrome?
+ percentage = Math.round(e.position * 100 / e.total);
+ }
+ $(form).find('input[type="submit"]').val(_('Posting... (#%)').replace('#', percentage));
};
$.ajax({