small cosmetic improvements for progress bar
authorLunar <lunar@anargeek.net>
Mon, 27 Feb 2012 22:15:13 +0000 (23:15 +0100)
committerLunar <lunar@anargeek.net>
Thu, 14 Mar 2013 09:12:08 +0000 (10:12 +0100)
public/javascripts/coquelicot.js
public/javascripts/jquery.uploadProgress.js

index 30d4c64..368b063 100644 (file)
@@ -39,6 +39,11 @@ $(function($) {
       jQuery('#size').html(parseInt(upload.size / 1024) + ' ' + i18n.kb);
       jQuery('#percent').html(upload.percents + "%");
     },
+    success: function(upload) {
+      $('#received').html('');
+      $('#size').html('');
+      $('#percent').html("100%");
+    },
     interval: 2000,
     /* if we are using images it's good to preload them, safari has problems with
        downloading anything after hitting submit button. these are images for lightBoxFu
index a8b65aa..93cd43d 100644 (file)
@@ -89,10 +89,10 @@ jQuery.uploadProgress = function(e, options) {
     url: options.progressUrl + "?X-Progress-ID=" + options.uuid,
     dataType: options.dataType,
     success: function(upload) {
+      var bar = $.browser.safari ? $(options.progressBar, parent.document) : $(options.progressBar);
       if (upload.state == 'uploading') {
         upload.percents = Math.floor((upload.received / upload.size)*1000)/10;
         
-        var bar = $.browser.safari ? $(options.progressBar, parent.document) : $(options.progressBar);
         bar.css({width: upload.percents+'%'});
         options.uploading(upload);
       }
@@ -103,6 +103,7 @@ jQuery.uploadProgress = function(e, options) {
       }
       
       if (upload.state == 'done') {
+        bar.css({width: '100%'});
         options.success(upload);
       }