use single quote for js and double quote for html with proper escapes and implement a simple progressbar

This commit is contained in:
Mario Vavti 2016-07-28 11:45:57 +02:00
parent 9fa3956aa8
commit b05c1a9829

View File

@ -84,12 +84,12 @@ function UploadFileSelectHandler(e) {
function prepareHtml(f, i) { function prepareHtml(f, i) {
$("#cloud-index tr:nth-child(2)").after( $("#cloud-index tr:nth-child(2)").after(
"<tr class='new-upload'>" + '<tr id=\"new-upload-' + i + '\" class=\"new-upload\" style=\"background: url(\'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOM2RHTAwAE5gH+VJ1dlgAAAABJRU5ErkJggg==\') repeat-y; background-size: 0%;\">' +
"<td><i class='fa " + getIconFromType(f.type) + "' title='" + f.type + "'></i></td>" + '<td><i class=\"fa ' + getIconFromType(f.type) + '\" title=\"' + f.type + '\"></i></td>' +
"<td>" + f.name + "</td>" + '<td>' + f.name + '</td>' +
"<td id='upload-progress-" + i + "'></td><td></td><td></td><td></td><td></td>" + '<td id=\"upload-progress-' + i + '\"></td><td></td><td></td><td></td><td></td>' +
"<td class='hiiden-xs'>" + formatSizeUnits(f.size) + "</td><td class='hiiden-xs'></td>" + '<td class=\"hidden-xs\">' + formatSizeUnits(f.size) + '</td><td class=\"hidden-xs\"></td>' +
"</tr>" '</tr>'
); );
} }
@ -162,6 +162,7 @@ function UploadFile(file, idx) {
var total = e.totalSize || e.total; var total = e.totalSize || e.total;
// Dynamically update the percentage complete displayed in the file upload list // Dynamically update the percentage complete displayed in the file upload list
$('#upload-progress-' + idx).html(Math.round(done / total * 100) + '%'); $('#upload-progress-' + idx).html(Math.round(done / total * 100) + '%');
$('#new-upload-' + idx).css('background-size', Math.round(done / total * 100) + '%');
}); });
xhr.addEventListener('load', function (e) { xhr.addEventListener('load', function (e) {