diff options
| author | WubTheCaptain <wub@partyvan.eu> | 2015-09-20 15:12:28 +0200 |
|---|---|---|
| committer | WubTheCaptain <wub@partyvan.eu> | 2015-09-20 15:12:28 +0200 |
| commit | 5cb355b078f1b74b3b85aa23a4476dffe58b6b8e (patch) | |
| tree | 4763c6ae0971b0d3416c08e101b84214ede6023f /js/cabinet.js | |
| parent | e88b0a008de53cd344bf67d02392f241edbe16db (diff) | |
Clean up cheesesteak.js and cabinet.js for JSHint
Adds curly braces and semicolons. Also change indentation to two spaces.
Diffstat (limited to 'js/cabinet.js')
| -rw-r--r-- | js/cabinet.js | 70 |
1 files changed, 38 insertions, 32 deletions
diff --git a/js/cabinet.js b/js/cabinet.js index 23a1329..cb8039b 100644 --- a/js/cabinet.js +++ b/js/cabinet.js @@ -1,37 +1,43 @@ /* jshint browser:true, jquery:true */ -;(function($){ - $.hasFileAPI = function hasFileAPI () { - return (window.FormData !== undefined) - } - $.fn.cabinet = function (input) { - input = $(input) +(function($) { + $.hasFileAPI = function hasFileAPI() { + return (window.FormData !== undefined); + }; - var _this = this - var passthrough = function (outer, inner, prevent, fn) { - _this.on(outer, function (e) { - if (inner === 'click') - input[0].click() - else - input.trigger(inner) - if (prevent) e.preventDefault() - if (fn) fn(e) - }, false) - } + $.fn.cabinet = function(input) { + input = $(input); - input[0].filelist = Object.create(FileList) + var _this = this; + var passthrough = function(outer, inner, prevent, fn) { + _this.on(outer, function(e) { + if (inner === 'click') { + input[0].click(); + } else { + input.trigger(inner); + } + if (prevent) { + e.preventDefault(); + } + if (fn) { + fn(e); + } + }, false); + }; - input.on('change', function (e) { - this.filelist = e.target.files - _this.change() - }) + input[0].filelist = Object.create(FileList); - passthrough('dragenter', 'dragenter', true) - passthrough('dragover', 'dragover', true) - passthrough('dragleave', 'dragleave', true) - passthrough('click', 'click', false) - passthrough('drop', 'dragleave', true, function (e) { - input[0].filelist = e.dataTransfer.files - _this.change() - }) - } -})($) + input.on('change', function(e) { + this.filelist = e.target.files; + _this.change(); + }); + + passthrough('dragenter', 'dragenter', true); + passthrough('dragover', 'dragover', true); + passthrough('dragleave', 'dragleave', true); + passthrough('click', 'click', false); + passthrough('drop', 'dragleave', true, function(e) { + input[0].filelist = e.dataTransfer.files; + _this.change(); + }); + }; +})($); |
