diff options
| author | czaks <marcin@6irc.net> | 2013-09-17 18:54:06 -0400 |
|---|---|---|
| committer | Michael Foster <savetheinternet@tinyboard.org> | 2013-09-18 21:32:43 +1000 |
| commit | 70e5d64c1bec487db027ba8a176b0bc5cfea2c82 (patch) | |
| tree | 65a21e3b3333baba11227e373e807e6168c1ed91 /js | |
| parent | ac41b61e71cda3c20b4b8225ae6b58d79e38d2b5 (diff) | |
ajax.js: fix upload progress display in firefox
Diffstat (limited to 'js')
| -rw-r--r-- | js/ajax.js | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -29,7 +29,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({ |
