scala-news-reader

rss/atom news reader in scala

git clone https://9o.is/git/scala-news-reader.git

fileupload.js

(1852B)


      1 $(function () {
      2     $('#bg-fileupload').fileupload({
      3       dataType: 'json',
      4       dropZone: null,
      5       add: function (e,data) {
      6         $('#bg-progress-bar').css('width', '0%');
      7         $('#bg-progress').show();
      8         data.submit();
      9       },
     10       progressall: function (e, data) {
     11         var progress = parseInt(data.loaded / data.total * 100, 10) + '%';
     12         $('#bg-progress-bar').css('width', progress);
     13       },
     14       done: function (e, data) {
     15         $('#bg-progress').fadeOut();
     16         var b = eval("(function(){" + data.result.callback + "})");
     17         b(-1);
     18       },
     19       fail: function (e, data) {
     20         $('#bg-progress').hide();
     21 
     22         $('div[data-alerts="alerts"]').append('<div class="alert alert-error fade in">'+
     23         '<button type="button" class="close" data-dismiss="alert">×</button>'+
     24         data.jqXHR.responseText+'</div>');
     25       }
     26     });
     27 
     28     $('#pic-fileupload').fileupload({
     29           dataType: 'json',
     30           dropZone: null,
     31           add: function (e,data) {
     32             $('#pic-progress-bar').css('width', '0%');
     33             $('#pic-progress').show();
     34             data.submit();
     35           },
     36           progressall: function (e, data) {
     37             var progress = parseInt(data.loaded / data.total * 100, 10) + '%';
     38             $('#pic-progress-bar').css('width', progress);
     39           },
     40           done: function (e, data) {
     41             $('#pic-progress').fadeOut();
     42             var b = eval("(function(){" + data.result.callback + "})");
     43             b(-1);
     44           },
     45           fail: function (e, data) {
     46             $('#pic-progress').hide();
     47 
     48             $('div[data-alerts="alerts"]').append('<div class="alert alert-error fade in">'+
     49             '<button type="button" class="close" data-dismiss="alert">×</button>'+
     50             data.jqXHR.responseText+'</div>');
     51           }
     52         });
     53   });