diff options
| author | Juuso Lapinlampi <wub@partyvan.eu> | 2015-09-26 22:02:14 +0200 |
|---|---|---|
| committer | Juuso Lapinlampi <wub@partyvan.eu> | 2015-09-26 22:02:14 +0200 |
| commit | 7dca38c450c1dd27e15e5b7701cdd0e5699d425e (patch) | |
| tree | 090bc43f4f590cc94949451502e916dd542934f0 /js | |
| parent | 73dc5add67ddb423691214306ec82f99b5b76d55 (diff) | |
Use cached totalName instead of $('.file-name', totalRow)
This cleans up a little bit of smelly code, which came from a copy-paste
job.
Diffstat (limited to 'js')
| -rw-r--r-- | js/pomf.js | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -103,11 +103,12 @@ $(function() { var totalRow = createRow('', files.humanSize, 'total'); totalRow.appendTo(uploadFiles); + var totalName = $('.file-name', totalRow); + if (files.size > MAX_SIZE) { uploadFiles.addClass('error'); - $('.file-name', totalRow).html('onii-chan y-your upload is t-too ' + - 'big…'); + totalName.html('onii-chan y-your upload is t-too big…'); return; } @@ -123,8 +124,6 @@ $(function() { }); }; - var totalName = $('.file-name', totalRow); - up.on('uploadprogress', function(e, files) { eachRow(files, function(row, file, files) { $('.progress-inner', row).width((file.percentUploaded * 100) + '%'); @@ -143,8 +142,7 @@ $(function() { var res = JSON.parse(res); if (!res.success) { uploadFiles.addClass('error'); - $('.file-name', totalRow).text('Something went wrong; try again ' + - 'later.'); + totalName.text('Something went wrong; try again later.'); break; } eachRow(res.files, function(row, file, files) { |
