From 7dca38c450c1dd27e15e5b7701cdd0e5699d425e Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Sat, 26 Sep 2015 20:02:14 +0000 Subject: Use cached totalName instead of $('.file-name', totalRow) This cleans up a little bit of smelly code, which came from a copy-paste job. --- js/pomf.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/js/pomf.js b/js/pomf.js index 83c4813..49ff4bd 100644 --- a/js/pomf.js +++ b/js/pomf.js @@ -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) { -- cgit v1.2.3 From e7a8961a1674477f64048d995dfad9dcc3b15fce Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Sun, 27 Sep 2015 07:37:14 +0000 Subject: Add Pantsu.cat copyright to js/pomf.js This compliments commit 7dca38c. --- js/pomf.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/pomf.js b/js/pomf.js index 49ff4bd..b2a7b6b 100644 --- a/js/pomf.js +++ b/js/pomf.js @@ -1,5 +1,6 @@ /** * Copyright (c) 2013 Peter Lejeck + * Copyright (c) 2015 the Pantsu.cat developers * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal -- cgit v1.2.3