From 8d9f781514cdb07a33e2dbaa3431928f0e08733b Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Sun, 27 Sep 2015 16:00:12 +0000 Subject: Use strict node === node.parentNode comparison Fixes ESLint no-cond-assign warning. -- Sat, 26 Sep 2015 -- 10:38:42 +bursey | while (node = node.parentNode) is invalid 10:38:54 +bursey | should be while (node == node.parentNode) 10:40:38 +bursey | weird actually 10:40:55 +bursey | Elements tend to be "true" in js 10:41:16 +bursey | but if the parentNode is undefined, then it's | false 10:41:50 +bursey | thus it doesn't loop infinitely 10:43:00 +bursey | actually, use === instead of == --- js/pomf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/pomf.js b/js/pomf.js index bdd3174..bb14e15 100644 --- a/js/pomf.js +++ b/js/pomf.js @@ -56,7 +56,7 @@ $(function() { $(this).html(btnContent); break; } - } while (node = node.parentNode); + } while (node === node.parentNode); }); var MAX_SIZE = (function(node) { -- cgit v1.2.3 From d9eb9c94c32c1065e9166e055f9a355841b2b8db Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Sun, 27 Sep 2015 16:08:46 +0000 Subject: Remove unused expression (hits[file.name] = 0) Fixes ESLint no-unused-expressions warning. --- js/pomf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/pomf.js b/js/pomf.js index bb14e15..f4fbeb2 100644 --- a/js/pomf.js +++ b/js/pomf.js @@ -120,7 +120,7 @@ $(function() { var eachRow = function(files, fn) { var hits = {}; files.forEach(function(file) { - ++hits[file.name] || (hits[file.name] = 0); + ++hits[file.name]; var row = $($('li[data-filename="' + escape(file.name) + '"]')[hits[file.name] || 0]); fn.call(row, row, file, files); -- cgit v1.2.3 From 758893d3df999464a3f7a4ebda0937e515094fce Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Sun, 27 Sep 2015 17:00:59 +0000 Subject: Fix irregular whitespace in cheesesteak.js Fixes ESLint warnings about no-irregular-whitespace. --- js/cheesesteak.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/cheesesteak.js b/js/cheesesteak.js index a3cf991..112b2c7 100644 --- a/js/cheesesteak.js +++ b/js/cheesesteak.js @@ -30,13 +30,13 @@ this._events[evt].push(fn); }; EventEmitter.prototype.off = function(evt, fn) { - if (!this.hasOwnProperty('_events') || evt in this._events === false) { + if (!this.hasOwnProperty('_events') || evt in this._events === false) { return; } this._events[evt].splice(this._events[evt].indexOf(fn), 1); }; EventEmitter.prototype.emit = function(evt) { - if (!this.hasOwnProperty('_events') || evt in this._events === false) { + if (!this.hasOwnProperty('_events') || evt in this._events === false) { return; } @@ -109,7 +109,7 @@ for (var key in overlay) { if (typeof overlay[key] === 'object') { out[key] = merge(base[key], overlay[key]); - } else { + } else { out[key] = overlay[key]; } } -- cgit v1.2.3 From 2c7ced1f503299e6ede6d3ef2b5e115318f5401f Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Sun, 27 Sep 2015 18:27:24 +0000 Subject: Fix redeclaration of "res" variable in pomf.js Fixes ESLint warning no-redeclare. --- js/pomf.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/pomf.js b/js/pomf.js index f4fbeb2..2e810de 100644 --- a/js/pomf.js +++ b/js/pomf.js @@ -139,10 +139,10 @@ $(function() { totalName.html('Grabbing URLs…'); }); - up.on('load', function(e, res) { + up.on('load', function(e, response) { switch (e.target.status) { case 200: - var res = JSON.parse(res); + var res = JSON.parse(response); if (!res.success) { uploadFiles.addClass('error'); totalName.text(UPLOAD_ERR_FAILED); -- cgit v1.2.3 From a17c4461869fc93e48c00cbb12dc588aa9b25f89 Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Sun, 27 Sep 2015 18:57:51 +0000 Subject: Add missing newlines after blocks Fixes JSCS requirePaddingNewLinesAfterBlocks warnings using Airbnb preset. --- js/cabinet.js | 2 ++ js/cheesesteak.js | 12 ++++++++++++ js/pomf.js | 5 +++++ 3 files changed, 19 insertions(+) (limited to 'js') diff --git a/js/cabinet.js b/js/cabinet.js index f6f5f20..2f3a3a6 100644 --- a/js/cabinet.js +++ b/js/cabinet.js @@ -37,9 +37,11 @@ } else { input.trigger(inner); } + if (prevent) { e.preventDefault(); } + if (fn) { fn(e); } diff --git a/js/cheesesteak.js b/js/cheesesteak.js index 112b2c7..75f837e 100644 --- a/js/cheesesteak.js +++ b/js/cheesesteak.js @@ -24,17 +24,21 @@ (function() { /* Lightweight EventEmitter implementation */ EventEmitter = function() {}; + EventEmitter.prototype.on = function(evt, fn) { this._events = this._events || {}; this._events[evt] = this._events[evt] || []; this._events[evt].push(fn); }; + EventEmitter.prototype.off = function(evt, fn) { if (!this.hasOwnProperty('_events') || evt in this._events === false) { return; } + this._events[evt].splice(this._events[evt].indexOf(fn), 1); }; + EventEmitter.prototype.emit = function(evt) { if (!this.hasOwnProperty('_events') || evt in this._events === false) { return; @@ -113,6 +117,7 @@ out[key] = overlay[key]; } } + return out; }; @@ -128,6 +133,7 @@ 'data': {} }, opts); }; + FileListUploader.prototype = Object.create(EventEmitter.prototype); FileListUploader.prototype.upload = function(cb) { if (cb) { @@ -151,6 +157,7 @@ files[i].uploadedSize = 0; } }); + xhr.upload.addEventListener('progress', function(e) { if (e.lengthComputable) { size = e.loaded; @@ -168,17 +175,22 @@ } } } + events.emit('uploadprogress', e, files); }, false); + xhr.upload.addEventListener('loadstart', function(e) { events.emit('uploadstart', e); }); + xhr.upload.addEventListener('load', function(e) { events.emit('uploadcomplete', e); }); + xhr.addEventListener('progress', function(e) { events.emit('progress', e); }); + xhr.addEventListener('load', function(e) { events.emit('load', e, xhr.responseText); }); diff --git a/js/pomf.js b/js/pomf.js index 2e810de..5690e60 100644 --- a/js/pomf.js +++ b/js/pomf.js @@ -131,6 +131,7 @@ $(function() { eachRow(files, function(row, file, files) { $('.progress-inner', row).width((file.percentUploaded * 100) + '%'); }); + $('.progress-inner', totalRow).width((files.percentUploaded * 100) + '%'); }); @@ -148,6 +149,7 @@ $(function() { totalName.text(UPLOAD_ERR_FAILED); break; } + eachRow(res.files, function(row, file, files) { var link = $(''); @@ -157,6 +159,7 @@ $(function() { $('.file-url', row).append(link); }); + uploadFiles.addClass('completed'); totalName.text('Done!'); break; @@ -168,7 +171,9 @@ $(function() { uploadFiles.addClass('error completed'); totalName.text(UPLOAD_ERR_FAILED); } + }); + up.upload(); }); }); -- cgit v1.2.3 From ff40b2b485d71f2fdd1432f743ae4ee8567254b3 Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Sun, 27 Sep 2015 19:07:38 +0000 Subject: Fix illegal trailing whitespace in JavaScript Fixes JSCS disallowTrailingWhitespace warnings using Airbnb preset. --- js/cheesesteak.js | 2 +- js/pomf.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/cheesesteak.js b/js/cheesesteak.js index 75f837e..1e60a56 100644 --- a/js/cheesesteak.js +++ b/js/cheesesteak.js @@ -162,7 +162,7 @@ if (e.lengthComputable) { size = e.loaded; // We know the size of the files, the order they're in, and how - // much we've uploaded. Based on this data, we can do some magic + // much we've uploaded. Based on this data, we can do some magic // to figure out which file we're on, and how much we've uploaded // of that file. // TODO: This math has trouble on later uploads. Leak somewhere diff --git a/js/pomf.js b/js/pomf.js index 5690e60..5a359da 100644 --- a/js/pomf.js +++ b/js/pomf.js @@ -121,7 +121,7 @@ $(function() { var hits = {}; files.forEach(function(file) { ++hits[file.name]; - var row = $($('li[data-filename="' + + var row = $($('li[data-filename="' + escape(file.name) + '"]')[hits[file.name] || 0]); fn.call(row, row, file, files); }); -- cgit v1.2.3 From c2681b55d6e6643ab113e6f0945a443793a34fab Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Sun, 27 Sep 2015 19:14:28 +0000 Subject: Change double quotes to single quotes in cheesesteak.js Fixes JSCS validateQuoteMarks warnings using Airbnb preset. --- js/cheesesteak.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'js') diff --git a/js/cheesesteak.js b/js/cheesesteak.js index 1e60a56..6cdeb77 100644 --- a/js/cheesesteak.js +++ b/js/cheesesteak.js @@ -59,7 +59,7 @@ FileList.prototype.reduce = Array.prototype.reduce; FileList.prototype.reduceRight = Array.prototype.reduceRight; - Object.defineProperty(FileList.prototype, "size", { + Object.defineProperty(FileList.prototype, 'size', { get: function getSize() { return this.reduce(function(prev, curr) { return prev + curr.size; @@ -71,25 +71,25 @@ var humanSize = { get: function humanSize() { var units = [ - "B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB" + 'B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB' ]; var e = Math.floor(Math.log(this.size) / Math.log(1024)); - return (this.size / Math.pow(1024, e)).toFixed(2) + " " + units[e]; + return (this.size / Math.pow(1024, e)).toFixed(2) + ' ' + units[e]; } }; - Object.defineProperty(FileList.prototype, "humanSize", humanSize); - Object.defineProperty(File.prototype, "humanSize", humanSize); + Object.defineProperty(FileList.prototype, 'humanSize', humanSize); + Object.defineProperty(File.prototype, 'humanSize', humanSize); var percentUploaded = { get: function percentUploaded() { return this.uploadedSize / this.size; } }; - Object.defineProperty(FileList.prototype, "percentUploaded", + Object.defineProperty(FileList.prototype, 'percentUploaded', percentUploaded); - Object.defineProperty(File.prototype, "percentUploaded", percentUploaded); + Object.defineProperty(File.prototype, 'percentUploaded', percentUploaded); - Object.defineProperty(FileList.prototype, "uploadedSize", { + Object.defineProperty(FileList.prototype, 'uploadedSize', { get: function getUploadedSize() { return this.reduce(function(prev, curr) { return prev + (curr.uploadedSize || 0); @@ -98,7 +98,7 @@ }); /* Object URL stuff */ - Object.defineProperty(File.prototype, "url", { + Object.defineProperty(File.prototype, 'url', { get: function getURL() { return window.URL.createObjectURL(this); } -- cgit v1.2.3 From f1c92f57d6a5ae01b8c67bf3f6d1189f41537339 Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Sun, 27 Sep 2015 19:22:31 +0000 Subject: Use individual Javascript var declarations Thanks to ASI (Automatic Semicolon Insertion) in JavaScript, not using individual var declarations can actually cause subtle bugs. Fixes JSCS disallowMultipleVarDecl warnings using Airbnb preset. Reference: http://benalman.com/news/2012/05/multiple-var-statements-javascript/ --- js/pomf.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'js') diff --git a/js/pomf.js b/js/pomf.js index 5a359da..2d4ff58 100644 --- a/js/pomf.js +++ b/js/pomf.js @@ -23,9 +23,9 @@ /* jshint browser:true, jquery:true */ $(function() { - var uploadInput = $('#upload-input'), - uploadBtn = $('#upload-btn'), - uploadFiles = $('#upload-filelist'); + var uploadInput = $('#upload-input'); + var uploadBtn = $('#upload-btn'); + var uploadFiles = $('#upload-filelist'); var btnContent = ''; @@ -73,11 +73,11 @@ $(function() { })(uploadInput); var createRow = function(filename, size, extra) { - var rowItem = $('
  • '), - rowName = $(''), - rowProg = $('
    '), - rowSize = $(''), - rowUrl = $(''); + var rowItem = $('
  • '); + var rowName = $(''); + var rowProg = $('
    '); + var rowSize = $(''); + var rowUrl = $(''); rowItem.addClass(extra || ''); -- cgit v1.2.3 From cd23640ded6a29071d5b46a6594efa3ad5ac7c2b Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Sun, 27 Sep 2015 19:34:56 +0000 Subject: Fix cheesesteak.js comments to follow Airbnb style Airbnb says to use /** ... */ for multiline comments and // for single line comments. Fixes JSCS requirePaddingNewLinesBeforeLineComments and validateIndentation warnings using Airbnb preset. --- js/cheesesteak.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'js') diff --git a/js/cheesesteak.js b/js/cheesesteak.js index 6cdeb77..a8b0d02 100644 --- a/js/cheesesteak.js +++ b/js/cheesesteak.js @@ -22,7 +22,7 @@ /* jshint browser:true, jquery:true */ (function() { - /* Lightweight EventEmitter implementation */ + // Lightweight EventEmitter implementation EventEmitter = function() {}; EventEmitter.prototype.on = function(evt, fn) { @@ -50,7 +50,7 @@ } }; - /* Copy the stuff from Array to FileList */ + // Copy the stuff from Array to FileList FileList.prototype.forEach = Array.prototype.forEach; FileList.prototype.every = Array.prototype.every; FileList.prototype.some = Array.prototype.some; @@ -67,7 +67,7 @@ } }); - /* Utility to convert bytes into human units */ + // Utility to convert bytes into human units var humanSize = { get: function humanSize() { var units = [ @@ -97,7 +97,7 @@ } }); - /* Object URL stuff */ + // Object URL stuff Object.defineProperty(File.prototype, 'url', { get: function getURL() { return window.URL.createObjectURL(this); @@ -161,11 +161,15 @@ xhr.upload.addEventListener('progress', function(e) { if (e.lengthComputable) { size = e.loaded; - // We know the size of the files, the order they're in, and how - // much we've uploaded. Based on this data, we can do some magic - // to figure out which file we're on, and how much we've uploaded - // of that file. - // TODO: This math has trouble on later uploads. Leak somewhere + + /** + * We know the size of the files, the order they're in, and how + * much we've uploaded. Based on this data, we can do some magic + * to figure out which file we're on, and how much we've uploaded + * of that file. + */ + + // TODO: This math has trouble on later uploads. Leak somewhere. for (var i = 0, l = files.length; i < l; i++) { files[i].uploadedSize = Math.min(size, files[i].size); size -= files[i].uploadedSize; @@ -196,7 +200,8 @@ }); xhr.send(data); - /* TODO: Add more event passthroughs, maybe abstract it into a helper? */ + + // TODO: Add more event passthroughs, maybe abstract it into a helper? }; FileList.prototype.upload = function uploadFileList(url, opts) { -- cgit v1.2.3 From e6f354a9be648a366df39b9dac75eb58a99490dd Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Sun, 27 Sep 2015 19:48:08 +0000 Subject: Add missing commas before closing bracket/curly brace This adds commas to cheesesteak.js. Something to note, the Airbnb ES5 style guide opposes a trailing comma. The latest ES6 edition endorses adding a trailing comma, explaining it leads to cleaner Git diffs. Endorse the ES6 standard, that's also the Airbnb preset in JSCS. Fixes JSCS requireTrailingComma warnings using Airbnb preset. --- js/cheesesteak.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'js') diff --git a/js/cheesesteak.js b/js/cheesesteak.js index a8b0d02..fcfe607 100644 --- a/js/cheesesteak.js +++ b/js/cheesesteak.js @@ -64,18 +64,18 @@ return this.reduce(function(prev, curr) { return prev + curr.size; }, 0); - } + }, }); // Utility to convert bytes into human units var humanSize = { get: function humanSize() { var units = [ - 'B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB' + 'B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB', ]; var e = Math.floor(Math.log(this.size) / Math.log(1024)); return (this.size / Math.pow(1024, e)).toFixed(2) + ' ' + units[e]; - } + }, }; Object.defineProperty(FileList.prototype, 'humanSize', humanSize); Object.defineProperty(File.prototype, 'humanSize', humanSize); @@ -83,7 +83,7 @@ var percentUploaded = { get: function percentUploaded() { return this.uploadedSize / this.size; - } + }, }; Object.defineProperty(FileList.prototype, 'percentUploaded', percentUploaded); @@ -94,14 +94,14 @@ return this.reduce(function(prev, curr) { return prev + (curr.uploadedSize || 0); }, 0); - } + }, }); // Object URL stuff Object.defineProperty(File.prototype, 'url', { get: function getURL() { return window.URL.createObjectURL(this); - } + }, }); File.revokeURL = function revokeURL(url) { window.URL.revokeObjectURL(url); @@ -130,7 +130,7 @@ this.opts = merge({ 'field': 'files[]', 'method': 'POST', - 'data': {} + 'data': {}, }, opts); }; -- cgit v1.2.3 From 86649a2283531fe289470d916786d1e11225ffe3 Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Sun, 27 Sep 2015 19:55:03 +0000 Subject: Remove extra quotes to follow Airbnb JavaScript style Fixes JSCS disallowQuotedKeysInObjects warnings using Airbnb preset. --- js/cheesesteak.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/cheesesteak.js b/js/cheesesteak.js index fcfe607..d47cf5c 100644 --- a/js/cheesesteak.js +++ b/js/cheesesteak.js @@ -128,9 +128,9 @@ opts = opts || {}; this.opts = merge({ - 'field': 'files[]', - 'method': 'POST', - 'data': {}, + field: 'files[]', + method: 'POST', + data: {}, }, opts); }; -- cgit v1.2.3 From a78072eba23ec544462c7a4fae8e4899f51632a7 Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Sun, 27 Sep 2015 19:59:22 +0000 Subject: cheesesteak.js: Use _this to save reference to this Fixes JSCS safeContextKeyword warnings using Airbnb preset. --- js/cheesesteak.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'js') diff --git a/js/cheesesteak.js b/js/cheesesteak.js index d47cf5c..0ea701d 100644 --- a/js/cheesesteak.js +++ b/js/cheesesteak.js @@ -142,7 +142,7 @@ var opts = this.opts; var files = this.files; - var events = this; + var _this = this; var data = new FormData(); files.forEach(function(file) { @@ -180,23 +180,23 @@ } } - events.emit('uploadprogress', e, files); + _this.emit('uploadprogress', e, files); }, false); xhr.upload.addEventListener('loadstart', function(e) { - events.emit('uploadstart', e); + _this.emit('uploadstart', e); }); xhr.upload.addEventListener('load', function(e) { - events.emit('uploadcomplete', e); + _this.emit('uploadcomplete', e); }); xhr.addEventListener('progress', function(e) { - events.emit('progress', e); + _this.emit('progress', e); }); xhr.addEventListener('load', function(e) { - events.emit('load', e, xhr.responseText); + _this.emit('load', e, xhr.responseText); }); xhr.send(data); -- cgit v1.2.3 From e4c38033bb3c8e4f44ba93e604652d9eb8e9b0b8 Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Sun, 27 Sep 2015 20:58:05 +0000 Subject: Fix JS switch ... case indentation This is a surprising one. JSHint and JSCS do not seem to mind the previous indentation, but ESLint throws an error when using the Airbnb style guide. The style guide itself doesn't seem to mention anything about this directly. What ever it is, this one pleases all three linters. Fixes ESLint indent warnings using Airbnb ES5 config. --- js/pomf.js | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'js') diff --git a/js/pomf.js b/js/pomf.js index 2d4ff58..1a11543 100644 --- a/js/pomf.js +++ b/js/pomf.js @@ -142,34 +142,34 @@ $(function() { up.on('load', function(e, response) { switch (e.target.status) { - case 200: - var res = JSON.parse(response); - if (!res.success) { - uploadFiles.addClass('error'); - totalName.text(UPLOAD_ERR_FAILED); - break; - } - - eachRow(res.files, function(row, file, files) { - var link = $(''); - - link.attr('href', file.url) - .attr('target', '_BLANK') - .text(file.url.replace('http://', '').replace('https://', '')); - - $('.file-url', row).append(link); - }); - - uploadFiles.addClass('completed'); - totalName.text('Done!'); - break; - case 413: - uploadFiles.addClass('error completed'); - totalName.html(UPLOAD_ERR_MAX_SIZE); - break; - default: - uploadFiles.addClass('error completed'); + case 200: + var res = JSON.parse(response); + if (!res.success) { + uploadFiles.addClass('error'); totalName.text(UPLOAD_ERR_FAILED); + break; + } + + eachRow(res.files, function(row, file, files) { + var link = $(''); + + link.attr('href', file.url) + .attr('target', '_BLANK') + .text(file.url.replace('http://', '').replace('https://', '')); + + $('.file-url', row).append(link); + }); + + uploadFiles.addClass('completed'); + totalName.text('Done!'); + break; + case 413: + uploadFiles.addClass('error completed'); + totalName.html(UPLOAD_ERR_MAX_SIZE); + break; + default: + uploadFiles.addClass('error completed'); + totalName.text(UPLOAD_ERR_FAILED); } }); -- cgit v1.2.3 From 42a100ef0e4ec9681dad66029912c7748baf33bc Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Sun, 27 Sep 2015 22:02:53 +0000 Subject: Add pomf.js parseInt() radix 10 Fixes ESLint radix warning using Airbnb ES5 config. --- js/pomf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/pomf.js b/js/pomf.js index 1a11543..187aa58 100644 --- a/js/pomf.js +++ b/js/pomf.js @@ -61,7 +61,7 @@ $(function() { var MAX_SIZE = (function(node) { var max = node.attr('data-max-size') || '120MiB'; - var num = parseInt(/([0-9,]+).*/.exec(max)[1].replace(',', '')); + var num = parseInt(/([0-9,]+).*/.exec(max)[1].replace(',', ''), 10); var unit = /(?:([KMGTPEZY])(i)?B|([BKMGTPEZY]))/.exec(max) || ['B', '', '']; var oneUnit = Math.pow( -- cgit v1.2.3 From 3c281a369d6c86a4008aeef96b58d87f0e1e0858 Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Sun, 27 Sep 2015 22:09:35 +0000 Subject: Remove extra newline padding from pomf.js This newline was accidentally introduced in commit a17c446. Fixes ESLint warning padded-blocks using Airbnb ES5 config. --- js/pomf.js | 1 - 1 file changed, 1 deletion(-) (limited to 'js') diff --git a/js/pomf.js b/js/pomf.js index 187aa58..7dd44ef 100644 --- a/js/pomf.js +++ b/js/pomf.js @@ -171,7 +171,6 @@ $(function() { uploadFiles.addClass('error completed'); totalName.text(UPLOAD_ERR_FAILED); } - }); up.upload(); -- cgit v1.2.3 From 49d58d98f5866bb9ccc9069a16d131486f04bba2 Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Sun, 27 Sep 2015 22:15:19 +0000 Subject: Remove previously added missing brace/bracket commas Until the code has been converted to ES6 in it's entirety, let's stick to Airbnb's ES5 style guide so that ESLint won't complain. This reverts commit e6f354a. --- js/cheesesteak.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'js') diff --git a/js/cheesesteak.js b/js/cheesesteak.js index 0ea701d..ea3dc19 100644 --- a/js/cheesesteak.js +++ b/js/cheesesteak.js @@ -64,18 +64,18 @@ return this.reduce(function(prev, curr) { return prev + curr.size; }, 0); - }, + } }); // Utility to convert bytes into human units var humanSize = { get: function humanSize() { var units = [ - 'B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB', + 'B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB' ]; var e = Math.floor(Math.log(this.size) / Math.log(1024)); return (this.size / Math.pow(1024, e)).toFixed(2) + ' ' + units[e]; - }, + } }; Object.defineProperty(FileList.prototype, 'humanSize', humanSize); Object.defineProperty(File.prototype, 'humanSize', humanSize); @@ -83,7 +83,7 @@ var percentUploaded = { get: function percentUploaded() { return this.uploadedSize / this.size; - }, + } }; Object.defineProperty(FileList.prototype, 'percentUploaded', percentUploaded); @@ -94,14 +94,14 @@ return this.reduce(function(prev, curr) { return prev + (curr.uploadedSize || 0); }, 0); - }, + } }); // Object URL stuff Object.defineProperty(File.prototype, 'url', { get: function getURL() { return window.URL.createObjectURL(this); - }, + } }); File.revokeURL = function revokeURL(url) { window.URL.revokeObjectURL(url); @@ -130,7 +130,7 @@ this.opts = merge({ field: 'files[]', method: 'POST', - data: {}, + data: {} }, opts); }; -- cgit v1.2.3