Permalink
Browse files

Added unminified build version

  • Loading branch information...
1 parent 6f9470d commit e955933a1137c7ef935a6684a421c63649152f9e @Wildhoney committed Jan 13, 2014
View
@@ -38,16 +38,27 @@ module.exports = function(grunt) {
'./bower_components/ember/ember.js']
}
}
+ },
+ concat: {
+ options: {
+ separator: ';',
+ stripBanners: true
+ },
+ dist: {
+ src: ['packages/ember-droplet/*.js'],
+ dest: 'dist/<%= pkg.name %>.js'
+ }
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
+ grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-yuidoc');
grunt.loadNpmTasks('grunt-contrib-jasmine');
- grunt.registerTask('build', ['yuidoc', 'uglify']);
+ grunt.registerTask('build', ['yuidoc', 'concat', 'uglify']);
grunt.registerTask('test', ['jshint', 'jasmine']);
- grunt.registerTask('default', ['jshint', 'jasmine', 'yuidoc', 'uglify']);
+ grunt.registerTask('default', ['jshint', 'jasmine', 'yuidoc', 'concat', 'uglify']);
};
@@ -1,2 +0,0 @@
-/*! EmberDroplet by Adam Timberlake created on 2013-09-25 */
-window.DropletController=Ember.Mixin.create({mimeTypes:["image/jpeg","image/jpg","image/gif","image/png","text/plain"],files:[],uploadStatus:{uploading:!1,percentComplete:0,error:!1},init:function(){Ember.set(this,"files",[]),this._super()},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(){var a=Ember.get(this,"dropletUrl"),b=new jQuery.Deferred;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 c=new XMLHttpRequest;c.open("post",a,!0);var d=new FormData;return Ember.EnumerableUtils.forEach(Ember.get(this,"validFiles"),function(a){d.append("file",a.file)},this),this._addProgressListener(c.upload),this._addSuccessListener(c.upload,b),this._addErrorListener(c.upload,b),c.setRequestHeader("X-File-Size",this._getSize()),c.send(d),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,b){a.addEventListener("load",function(){Ember.EnumerableUtils.forEach(Ember.get(this,"validFiles"),function(a){Ember.set(a,"uploaded",!0)}),Ember.set(this,"uploadStatus.uploading",!1),b&&b.resolve()}.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.addValidFile(f):b.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)}});
Oops, something went wrong. Retry.

0 comments on commit e955933

Please sign in to comment.