Skip to content

Commit

Permalink
Some small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bootle committed Jun 7, 2012
1 parent 0b433b2 commit 3b33384
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 19 deletions.
1 change: 0 additions & 1 deletion README.md
Expand Up @@ -37,7 +37,6 @@ Screenshots
-----------

#![Screenshot 1](http://thebootle.com/foof/moo/DropZone/Demo/Screenshot%202011-12-18%20at%2021.24.png)
http://d.pr/cQry

Dependencies
------------
Expand Down
17 changes: 14 additions & 3 deletions Source/DropZone/DropZone.Flash.js
Expand Up @@ -21,7 +21,15 @@ provides: [DropZone.Flash]
DropZone.Flash = new Class({

Extends: DropZone,


options: {

flash: {
movie: 'Moo.Uploader.swf'
}

},

initialize: function (options) {

this.setOptions(options);
Expand All @@ -34,6 +42,9 @@ DropZone.Flash = new Class({

activate: function () {

// set options
//this.setOptions(options);

this.parent();

},
Expand Down Expand Up @@ -126,9 +137,9 @@ DropZone.Flash = new Class({

// get the right file object
var file = this.fileList[r[0].id-1];

var item,
perc = file.progress.percentLoaded;
perc = r[0].progress.percentLoaded;
if (this.uiList) item = this.uiList.getElement('#dropzone_item_' + file.uniqueid);

// set file progress
Expand Down
1 change: 1 addition & 0 deletions Source/DropZone/DropZone.HTML5.js
Expand Up @@ -142,6 +142,7 @@ DropZone.HTML5 = new Class({

// Upload only checked and new files
if (file.checked && !file.uploading) {

this.isUploading = true;
file.uploading = true;
this.nCurrentUploads++;
Expand Down
35 changes: 21 additions & 14 deletions Source/DropZone/DropZone.js
Expand Up @@ -5,7 +5,7 @@ name: DropZone
description: Crossbrowser file uploader with HTML5 chunk upload support, flexible UI and nice modability. Uploads are based on Mooupload by Juan Lago
version: 0.9.1 (beta!)
version: 0.9.1
license: MIT-style license
Expand Down Expand Up @@ -55,9 +55,6 @@ var DropZone = new Class({
vars: { // additional to be sent to backend
'isDropZone': true // example..
},
flash: {
movie: 'Moo.Uploader.swf'
},
gravity_center: null, // an element after which hidden DropZone elements are output
// Events

Expand Down Expand Up @@ -129,8 +126,6 @@ var DropZone = new Class({
return new DropZone[this.method](options);

} else {

console.log('DropZone method is not available, please include the file: DropZone.' + this.method);

}

Expand Down Expand Up @@ -240,6 +235,8 @@ var DropZone = new Class({
this.nCurrentUploads--;
}

this.nCancelled++;

if(this.nCurrentUploads <= 0) this._queueComplete();

this.fireEvent('onItemCancel', [item]);
Expand All @@ -250,7 +247,13 @@ var DropZone = new Class({

kill: function(){

//
// cancel all

this.fileList.each(function(f, i){

this.cancel(f.id);

}, this);

},

Expand Down Expand Up @@ -369,7 +372,7 @@ var DropZone = new Class({

this.queuePercent = perc / n_checked;

this.fireEvent('onUploadProgress', [this.queuePercent, this.nUploaded + this.nCurrentUploads, this.fileList.length]);
this.fireEvent('onUploadProgress', [this.queuePercent, this.nUploaded + this.nCurrentUploads, this.fileList.length-this.nCancelled]);

},

Expand Down Expand Up @@ -452,16 +455,19 @@ var DropZone = new Class({

// this approach works fine in Chrome



var img = new Element('img', {'style': 'display: none'});
var img = new Element('img'); //, {'style': 'display: none'}
img.addEvent('load', function(e) {

// job done
this.fireEvent('itemAdded', [item, file, img.src, img.getSize()]); // e.target.result for large images crashes Chrome?

window.URL.revokeObjectURL(img.src); // Clean up after yourself.

img.destroy();

}.bind(this));
img.src = window.URL.createObjectURL(file.file);

// job done
this.fireEvent('itemAdded', [item, file, img.src]); // e.target.result for large images crashes Chrome?
img.src = window.URL.createObjectURL(file.file);

// add the invisible picture to load
this.gravityCenter.adopt(img);
Expand Down Expand Up @@ -498,6 +504,7 @@ var DropZone = new Class({
this.nCurrentUploads = 0;
this.nUploaded = 0;
this.nErrors = 0;
this.nCancelled = 0;
this.queuePercent = 0;
this.isUploading = false;

Expand Down
2 changes: 1 addition & 1 deletion package.yml
@@ -1,7 +1,7 @@
name: DropZone
author: bootle
category: Utilities
tags: [upload, html5, file, chunk, drag & drop, flash]
tags: [upload, html5, chunk, drag & drop, flash]
docs: https://github.com/bootle/DropZone
demo: http://thebootle.com/foof/moo/DropZone/Demo/
#current: 0.9.1

0 comments on commit 3b33384

Please sign in to comment.