diff options
Diffstat (limited to 'js')
| -rw-r--r-- | js/pomf.js | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -1,5 +1,6 @@ /** * Copyright (c) 2013 Peter Lejeck <peter.lejeck@gmail.com> + * Copyright (c) 2015 the Pantsu.cat developers <hostmaster@pantsu.cat> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -23,7 +24,7 @@ /* jshint browser:true, jquery:true */ $(function() { var uploadInput = $('#upload-input'), - uploadBtn = $('#upload-btn'), + uploadBtn = $('#upload-btn'), uploadFiles = $('#upload-filelist'); var btnContent = ''; @@ -76,7 +77,7 @@ $(function() { rowName = $('<span class=file-name>'), rowProg = $('<div class="file-progress progress-outer">'), rowSize = $('<span class=file-size>'), - rowUrl = $('<span class=file-url>'); + rowUrl = $('<span class=file-url>'); rowItem.addClass(extra || ''); @@ -103,11 +104,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 +125,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) + '%'); @@ -134,7 +134,7 @@ $(function() { up.on('uploadcomplete', function(e) { $('.progress-inner').width('100%'); - totalName.text('Grabbing URLs...'); + totalName.html('Grabbing URLs…'); }); up.on('load', function(e, res) { @@ -143,8 +143,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) { |
