From 21c769545f4d9a25530e535494d883b814b1de85 Mon Sep 17 00:00:00 2001 From: WubTheCaptain Date: Sun, 20 Sep 2015 06:07:29 +0000 Subject: Add JSHint headers to cabinet and cheesesteak --- js/cabinet.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/cabinet.js') diff --git a/js/cabinet.js b/js/cabinet.js index ebbae4f..23a1329 100644 --- a/js/cabinet.js +++ b/js/cabinet.js @@ -1,3 +1,4 @@ +/* jshint browser:true, jquery:true */ ;(function($){ $.hasFileAPI = function hasFileAPI () { return (window.FormData !== undefined) -- cgit v1.2.3 From 5cb355b078f1b74b3b85aa23a4476dffe58b6b8e Mon Sep 17 00:00:00 2001 From: WubTheCaptain Date: Sun, 20 Sep 2015 13:12:28 +0000 Subject: Clean up cheesesteak.js and cabinet.js for JSHint Adds curly braces and semicolons. Also change indentation to two spaces. --- js/cabinet.js | 70 ++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 32 deletions(-) (limited to 'js/cabinet.js') 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(); + }); + }; +})($); -- cgit v1.2.3