diff options
| -rw-r--r-- | Gruntfile.js | 3 | ||||
| -rw-r--r-- | js/cabinet.js | 6 | ||||
| -rw-r--r-- | js/cheesesteak.js | 22 | ||||
| -rw-r--r-- | js/pomf.js | 5 |
4 files changed, 16 insertions, 20 deletions
diff --git a/Gruntfile.js b/Gruntfile.js index ae01b75..a4f4088 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -62,9 +62,6 @@ module.exports = function (grunt) { } }, cssmin: { - options: { - banner: '/*! <%= pkg.name %> (<%= pkg.repository.url %>) @ <%= grunt.template.today("yyyy-mm-dd") %> */\n\n' - }, dist: { files: { 'dist/pomf.min.css': [ diff --git a/js/cabinet.js b/js/cabinet.js index 8414df2..2e2408b 100644 --- a/js/cabinet.js +++ b/js/cabinet.js @@ -23,11 +23,11 @@ /* jshint browser:true, jquery:true */ (function($) { $.hasFileAPI = function hasFileAPI() { - return (window.FormData !== undefined); + return Boolean(window.FormData); }; - $.fn.cabinet = function(input) { - var $input = $(input); + $.fn.cabinet = function(uploadInput) { + var $input = $(uploadInput); var _this = this; var passthrough = function(outer, inner, prevent, fn) { diff --git a/js/cheesesteak.js b/js/cheesesteak.js index 0ea701d..4809ca3 100644 --- a/js/cheesesteak.js +++ b/js/cheesesteak.js @@ -23,7 +23,7 @@ /* jshint browser:true, jquery:true */ (function() { // Lightweight EventEmitter implementation - EventEmitter = function() {}; + var EventEmitter = function() {}; EventEmitter.prototype.on = function(evt, fn) { this._events = this._events || {}; @@ -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); @@ -125,13 +125,13 @@ this.url = url; this.files = files; - opts = opts || {}; + var request = opts || {}; this.opts = merge({ field: 'files[]', method: 'POST', - data: {}, - }, opts); + data: {} + }, request); }; FileListUploader.prototype = Object.create(EventEmitter.prototype); @@ -160,7 +160,7 @@ xhr.upload.addEventListener('progress', function(e) { if (e.lengthComputable) { - size = e.loaded; + var size = e.loaded; /** * We know the size of the files, the order they're in, and how @@ -49,7 +49,7 @@ $(function() { }); $uploadBtn.on('dragleave', function(e) { - node = e.target; + var node = e.target; do { if (node === this) { $(this).removeClass('drop'); @@ -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( @@ -171,7 +171,6 @@ $(function() { $uploadFiles.addClass('error completed'); $totalName.text(UPLOAD_ERR_FAILED); } - }); up.upload(); |
