Skip to content
Browse files

Updated JSHINT config

  • Loading branch information...
1 parent b8291ee commit f7a4f763f6ec15a07f31dba58f19f0beef671b7c @Wildhoney committed Nov 4, 2013
View
35 .jshintrc
@@ -1,13 +1,26 @@
{
- "curly": true,
- "eqeqeq": true,
- "immed": true,
- "latedef": true,
- "newcap": true,
- "noarg": true,
- "sub": true,
- "undef": false,
- "boss": true,
- "eqnull": true,
- "node": true
+ "camelcase" : true,
+ "curly" : true,
+ "eqeqeq" : true,
+ "forin" : true,
+ "immed" : true,
+ "latedef" : true,
+ "newcap" : true,
+ "noarg" : true,
+ "strict" : false,
+ "trailing" : true,
+ "undef" : false,
+ "unused" : true,
+ "maxparams" : 10,
+ "maxdepth" : 5,
+ "maxstatements" : 25,
+ "maxcomplexity" : 10,
+
+ "asi" : true,
+ "eqnull" : true,
+ "funcscope" : true,
+ "sub" : true,
+
+ "browser" : true,
+ "jquery" : true
}
View
2 dist/ember-droplet.min.js
@@ -1,2 +1,2 @@
/*! ember-droplet by Adam Timberlake created on 2013-11-04 */
-window.DropletController=Ember.Mixin.create({mimeTypes:["image/jpeg","image/jpg","image/gif","image/png","text/plain"],requestHeaders:{},files:[],uploadStatus:{uploading:!1,percentComplete:0,error:!1},init:function(){Ember.set(this,"files",[]),this._super()},actions:{addValidFile:function(a){return this._addFile(a,!0)},addInvalidFile:function(a){return this._addFile(a,!1)},deleteFile:function(a){return Ember.set(a,"deleted",!0),a},clearAllFiles:function(){Ember.set(this,"files",[])},uploadAllFiles:function(){if(0===Ember.get(this,"validFiles").length)return!1;var a=Ember.get(this,"dropletUrl"),b=new jQuery.Deferred,c=this.get("requestHeaders");Ember.set(this,"uploadStatus.uploading",!0),Ember.set(this,"uploadStatus.error",!1),Ember.assert("You must specify the `dropletUrl` parameter in order to upload files.",!!a);var d=new XMLHttpRequest;d.open("post",a,!0);var e=new FormData;Ember.EnumerableUtils.forEach(Ember.get(this,"validFiles"),function(a){e.append("file",a.file)},this),this._addProgressListener(d.upload),this._addSuccessListener(d.upload,b),this._addErrorListener(d.upload,b),d.onreadystatechange=function(){if(4===d.readyState){var a=JSON.parse(d.responseText);b.resolve(a)}},d.setRequestHeader("X-File-Size",this._getSize());for(var f in c)c.hasOwnProperty(f)&&d.setRequestHeader(f,c[f]);return d.send(e),b.promise()}},validFiles:Ember.computed(function(){return this._filesByProperties({valid:!0,deleted:!1,uploaded:!1})}).property("files.length","files.@each.deleted","files.@each.uploaded"),invalidFiles:Ember.computed(function(){return this._filesByProperties({valid:!1})}).property("files.length","files.@each.deleted"),uploadedFiles:Ember.computed(function(){return this._filesByProperties({uploaded:!0})}).property("files.length","files.@each.uploaded"),deletedFiles:Ember.computed(function(){return this._filesByProperties({deleted:!0})}).property("files.length","files.@each.deleted"),_filesByProperties:function(a){return Ember.get(this,"files").filter(function(b){for(var c in a)if(a.hasOwnProperty(c)&&b[c]!==a[c])return!1;return!0})},_getSize:function(){var a=0;return Ember.EnumerableUtils.forEach(Ember.get(this,"validFiles"),function(b){a+=b.file.size}),a},_addSuccessListener:function(a){a.addEventListener("load",function(){Ember.EnumerableUtils.forEach(Ember.get(this,"validFiles"),function(a){Ember.set(a,"uploaded",!0)}),Ember.set(this,"uploadStatus.uploading",!1)}.bind(this),!1)},_addErrorListener:function(a,b){a.addEventListener("error",function(){Ember.set(this,"uploadStatus.uploading",!1),Ember.set(this,"uploadStatus.error",!0),b&&b.reject()}.bind(this))},_addProgressListener:function(a){a.addEventListener("progress",function(a){if(a.lengthComputable){var b=100*(a.loaded/this._getSize());Ember.set(this,"uploadStatus.percentComplete",Math.round(b))}}.bind(this),!1)},_addFile:function(a,b){var c="extension-%@".fmt(a.name.match(/\.(.+)$/i)[1]).toLowerCase(),d={file:a,valid:b,uploaded:!1,deleted:!1,className:c};return Ember.get(this,"files").pushObject(d),d}}),window.DropletView=Ember.View.extend({classNames:["droppable"],ImagePreview:Ember.View.extend({tagName:"img",attributeBindings:["src"],src:null,image:null,didInsertElement:function(){var a=new FileReader,b=Ember.get(this,"image.file");return b.type.match(/^image\//i)?(a.onload=function(a){this.get("isDestroyed")!==!0&&Ember.set(this,"src",a.target.result)}.bind(this),a.readAsDataURL(b),void 0):(this.destroy(),void 0)}}),MultipleInput:Ember.View.extend({tagName:"input",classNames:"files",attributeBindings:["type","multiple"],type:"file",multiple:"multiple",change:function(){var a=this.get("element").files;return this.get("parentView").traverseFiles(a)}}),drop:function(a,b){return this._preventDefaultBehaviour(a),this.traverseFiles(a.dataTransfer.files||b)},traverseFiles:function(a){var b=Ember.get(this,"controller"),c=Ember.get(b,"mimeTypes");Ember.assert("`mimeTypes` is undefined. Does your controller implement the `EmberDropletController` mixin?",!!c),Ember.assert("`mimeTypes` is not an array. It should be an array of valid MIME types.",!!Ember.isArray(c));for(var d=0,e=a.length;e>d;d++)if(a.hasOwnProperty(d)){var f=a[d];-1!==$.inArray(f.type,c)?b.send("addValidFile",f):b.send("addInvalidFile",f)}return!0},_preventDefaultBehaviour:function(a){a.preventDefault(),a.stopPropagation()},dragOver:function(a){this._preventDefaultBehaviour(a)},dragEnter:function(a){this._preventDefaultBehaviour(a)},dragLeave:function(a){this._preventDefaultBehaviour(a)}});
+window.DropletController=Ember.Mixin.create({mimeTypes:["image/jpeg","image/jpg","image/gif","image/png","text/plain"],requestHeaders:{},files:[],uploadStatus:{uploading:!1,percentComplete:0,error:!1},init:function(){Ember.set(this,"files",[]),this._super()},actions:{addValidFile:function(a){return this._addFile(a,!0)},addInvalidFile:function(a){return this._addFile(a,!1)},deleteFile:function(a){return Ember.set(a,"deleted",!0),a},clearAllFiles:function(){Ember.set(this,"files",[])},uploadAllFiles:function(){if(0===Ember.get(this,"validFiles").length)return!1;var a=Ember.get(this,"dropletUrl"),b=new jQuery.Deferred,c=this.get("requestHeaders");Ember.set(this,"uploadStatus.uploading",!0),Ember.set(this,"uploadStatus.error",!1),Ember.assert("You must specify the `dropletUrl` parameter in order to upload files.",!!a);var d=new XMLHttpRequest;d.open("post",a,!0);var e=new FormData;Ember.EnumerableUtils.forEach(Ember.get(this,"validFiles"),function(a){e.append("file",a.file)},this),this._addProgressListener(d.upload),this._addSuccessListener(d.upload,b),this._addErrorListener(d.upload,b),d.onreadystatechange=function(){if(4===d.readyState){var a=JSON.parse(d.responseText);b.resolve(a)}},d.setRequestHeader("X-File-Size",this._getSize());for(var f in c)c.hasOwnProperty(f)&&d.setRequestHeader(f,c[f]);return d.send(e),b.promise()}},validFiles:Ember.computed(function(){return this._filesByProperties({valid:!0,deleted:!1,uploaded:!1})}).property("files.length","files.@each.deleted","files.@each.uploaded"),invalidFiles:Ember.computed(function(){return this._filesByProperties({valid:!1})}).property("files.length","files.@each.deleted"),uploadedFiles:Ember.computed(function(){return this._filesByProperties({uploaded:!0})}).property("files.length","files.@each.uploaded"),deletedFiles:Ember.computed(function(){return this._filesByProperties({deleted:!0})}).property("files.length","files.@each.deleted"),_filesByProperties:function(a){return Ember.get(this,"files").filter(function(b){for(var c in a)if(a.hasOwnProperty(c)&&b[c]!==a[c])return!1;return!0})},_getSize:function(){var a=0;return Ember.EnumerableUtils.forEach(Ember.get(this,"validFiles"),function(b){a+=b.file.size}),a},_addSuccessListener:function(a){a.addEventListener("load",function(){Ember.EnumerableUtils.forEach(Ember.get(this,"validFiles"),function(a){Ember.set(a,"uploaded",!0)}),Ember.set(this,"uploadStatus.uploading",!1)}.bind(this),!1)},_addErrorListener:function(a,b){a.addEventListener("error",function(){Ember.set(this,"uploadStatus.uploading",!1),Ember.set(this,"uploadStatus.error",!0),b&&b.reject()}.bind(this))},_addProgressListener:function(a){a.addEventListener("progress",function(a){if(a.lengthComputable){var b=a.loaded/this._getSize()*100;Ember.set(this,"uploadStatus.percentComplete",Math.round(b))}}.bind(this),!1)},_addFile:function(a,b){var c="extension-%@".fmt(a.name.match(/\.(.+)$/i)[1]).toLowerCase(),d={file:a,valid:b,uploaded:!1,deleted:!1,className:c};return Ember.get(this,"files").pushObject(d),d}}),window.DropletView=Ember.View.extend({classNames:["droppable"],ImagePreview:Ember.View.extend({tagName:"img",attributeBindings:["src"],src:null,image:null,didInsertElement:function(){var a=new FileReader,b=Ember.get(this,"image.file");return b.type.match(/^image\//i)?(a.onload=function(a){this.get("isDestroyed")!==!0&&Ember.set(this,"src",a.target.result)}.bind(this),a.readAsDataURL(b),void 0):(this.destroy(),void 0)}}),MultipleInput:Ember.View.extend({tagName:"input",classNames:"files",attributeBindings:["type","multiple"],type:"file",multiple:"multiple",change:function(){var a=this.get("element").files;return this.get("parentView").traverseFiles(a)}}),drop:function(a,b){return this._preventDefaultBehaviour(a),this.traverseFiles(a.dataTransfer.files||b)},traverseFiles:function(a){var b=Ember.get(this,"controller"),c=Ember.get(b,"mimeTypes");Ember.assert("`mimeTypes` is undefined. Does your controller implement the `EmberDropletController` mixin?",!!c),Ember.assert("`mimeTypes` is not an array. It should be an array of valid MIME types.",!!Ember.isArray(c));for(var d=0,e=a.length;e>d;d++)if(a.hasOwnProperty(d)){var f=a[d];-1!==$.inArray(f.type,c)?b.send("addValidFile",f):b.send("addInvalidFile",f)}return!0},_preventDefaultBehaviour:function(a){a.preventDefault(),a.stopPropagation()},dragOver:function(a){this._preventDefaultBehaviour(a)},dragEnter:function(a){this._preventDefaultBehaviour(a)},dragLeave:function(a){this._preventDefaultBehaviour(a)}});
View
16 docs/files/packages_ember-droplet_ember-droplet-mixin.js.html
@@ -301,14 +301,14 @@ <h1 class="file-heading">File: packages/ember-droplet/ember-droplet-mixin.js</h1
for (var property in maps) {
- if (!maps.hasOwnProperty(property)) {
- continue;
- }
+ if (maps.hasOwnProperty(property)) {
+
+ // If the current property doesn&#x27;t match what we&#x27;re after from the map,
+ // then the file is invalid.
+ if (file[property] !== maps[property]) {
+ return false;
+ }
- // If the current property doesn&#x27;t match what we&#x27;re after from the map,
- // then the file is invalid.
- if (file[property] !== maps[property]) {
- return false;
}
}
@@ -347,7 +347,7 @@ <h1 class="file-heading">File: packages/ember-droplet/ember-droplet-mixin.js</h1
_addSuccessListener: function(request) {
// Once the files have been successfully uploaded.
- request.addEventListener(&#x27;load&#x27;, function(data) {
+ request.addEventListener(&#x27;load&#x27;, function() {
// Set the &#x60;uploaded&#x60; parameter to true once we&#x27;ve successfully // uploaded the files.
Ember.EnumerableUtils.forEach(Ember.get(this, &#x27;validFiles&#x27;), function(file) {
View
16 packages/ember-droplet/ember-droplet-mixin.js
@@ -209,14 +209,14 @@ window.DropletController = Ember.Mixin.create({
for (var property in maps) {
- if (!maps.hasOwnProperty(property)) {
- continue;
- }
+ if (maps.hasOwnProperty(property)) {
+
+ // If the current property doesn't match what we're after from the map,
+ // then the file is invalid.
+ if (file[property] !== maps[property]) {
+ return false;
+ }
- // If the current property doesn't match what we're after from the map,
- // then the file is invalid.
- if (file[property] !== maps[property]) {
- return false;
}
}
@@ -255,7 +255,7 @@ window.DropletController = Ember.Mixin.create({
_addSuccessListener: function(request) {
// Once the files have been successfully uploaded.
- request.addEventListener('load', function(data) {
+ request.addEventListener('load', function() {
// Set the `uploaded` parameter to true once we've successfully // uploaded the files.
Ember.EnumerableUtils.forEach(Ember.get(this, 'validFiles'), function(file) {

0 comments on commit f7a4f76

Please sign in to comment.
Something went wrong with that request. Please try again.