(function ($) {
var handleFiles, ProgressBar, FileList, FileListInline;
$.fileTypeIcon = function (fileId, file) {
if (typeof file.type == 'undefined') {
return $('
');
} else if(file.type.substring(0,6) == 'image/') {
return $('');
} else if(file.type == 'application/pdf') {
return $('
');
} else if(file.type.indexOf("sheet") != -1) {
return $('
');
} else if(file.type.indexOf("zip") != -1) {
return $('
');
} else if (file.type.substring(0,6) == 'video/') {
return $('
');
} else if (file.type.indexOf("word") != -1) {
return $('
');
} else {
return $('
');
}
};
ProgressBar = function (options) {
var bar = this;
this.segments = [];
this.updateSegment = function (number, current, total) {
bar.segments[number] = [current, total];
bar.update();
};
this.update = function () {
var total = 0, current = 0;
$.each(bar.segments, function (k, item) {
current += item[0];
total += item[1];
});
options.progress(current, total);
if (current === total) {
options.done();
}
};
};
FileList = function (options) {
var $list = $(options.list);
this.clearErrors = function () {
$list.find('.text-danger').remove();
};
this.addError = function (file, message) {
var $li = $('