Skip to content

Commit

Permalink
Fixed #264
Browse files Browse the repository at this point in the history
  • Loading branch information
Danial Farid authored and Danial Farid committed Jul 14, 2014
1 parent fc78c35 commit 0e1c8f6
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 23 deletions.
11 changes: 4 additions & 7 deletions demo/war/js/angular-file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,39 +192,36 @@ angularFileUpload.directive('ngFileDrop', [ '$parse', '$timeout', '$location', f
elem[0].addEventListener("dragover", function(evt) {
evt.stopPropagation();
evt.preventDefault();
elem.addClass(elem[0].__drag_over_class_);
$timeout.cancel(leaveTimeout);
if (!elem[0].__drag_entered_) {
elem[0].__drag_entered_ = true;
if (!elem[0].__drag_over_class_) {
var dragOverClassFn = $parse(attr['ngFileDragOverClass']);
if (dragOverClassFn instanceof Function) {
var dragOverClass = dragOverClassFn(scope, {
$event : evt
});
elem[0].__drag_over_class_ = dragOverClass;
elem.addClass(elem[0].__drag_over_class_);
} else {
elem[0].__drag_over_class_ = attr['ngFileDragOverClass'] || "dragover";
elem.addClass(elem[0].__drag_over_class_);
}
}
elem.addClass(elem[0].__drag_over_class_);
}, false);
elem[0].addEventListener("dragenter", function(evt) {
evt.stopPropagation();
evt.preventDefault();
}, false);
elem[0].addEventListener("dragleave", function(evt) {
leaveTimeout = $timeout(function() {
elem[0].__drag_entered_ = false;
elem.removeClass(elem[0].__drag_over_class_);
elem[0].__drag_over_class_ = null;
});
}, false);
var fn = $parse(attr['ngFileDrop']);
elem[0].addEventListener("drop", function(evt) {
evt.stopPropagation();
evt.preventDefault();
elem[0].__drag_entered_ = false;
elem.removeClass(elem[0].__drag_over_class_);
elem[0].__drag_over_class_ = null;
extractFiles(evt, function(files) {
fn(scope, {
$files : files,
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-file-upload-html5-shim.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**!
* AngularJS file upload shim for angular XHR HTML5 browsers
* @author Danial <danial.farid@gmail.com>
* @version 1.5.0
* @version 1.5.1
*/
if (window.XMLHttpRequest) {
if (window.FormData) {
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-file-upload-html5-shim.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/angular-file-upload-shim.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**!
* AngularJS file upload shim for HTML5 FormData
* @author Danial <danial.farid@gmail.com>
* @version 1.5.0
* @version 1.5.1
*/
(function() {

Expand Down
2 changes: 1 addition & 1 deletion dist/angular-file-upload-shim.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 5 additions & 8 deletions dist/angular-file-upload.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**!
* AngularJS file upload/drop directive with http post and progress
* @author Danial <danial.farid@gmail.com>
* @version 1.5.0
* @version 1.5.1
*/
(function() {

Expand Down Expand Up @@ -192,39 +192,36 @@ angularFileUpload.directive('ngFileDrop', [ '$parse', '$timeout', '$location', f
elem[0].addEventListener("dragover", function(evt) {
evt.stopPropagation();
evt.preventDefault();
elem.addClass(elem[0].__drag_over_class_);
$timeout.cancel(leaveTimeout);
if (!elem[0].__drag_entered_) {
elem[0].__drag_entered_ = true;
if (!elem[0].__drag_over_class_) {
var dragOverClassFn = $parse(attr['ngFileDragOverClass']);
if (dragOverClassFn instanceof Function) {
var dragOverClass = dragOverClassFn(scope, {
$event : evt
});
elem[0].__drag_over_class_ = dragOverClass;
elem.addClass(elem[0].__drag_over_class_);
} else {
elem[0].__drag_over_class_ = attr['ngFileDragOverClass'] || "dragover";
elem.addClass(elem[0].__drag_over_class_);
}
}
elem.addClass(elem[0].__drag_over_class_);
}, false);
elem[0].addEventListener("dragenter", function(evt) {
evt.stopPropagation();
evt.preventDefault();
}, false);
elem[0].addEventListener("dragleave", function(evt) {
leaveTimeout = $timeout(function() {
elem[0].__drag_entered_ = false;
elem.removeClass(elem[0].__drag_over_class_);
elem[0].__drag_over_class_ = null;
});
}, false);
var fn = $parse(attr['ngFileDrop']);
elem[0].addEventListener("drop", function(evt) {
evt.stopPropagation();
evt.preventDefault();
elem[0].__drag_entered_ = false;
elem.removeClass(elem[0].__drag_over_class_);
elem[0].__drag_over_class_ = null;
extractFiles(evt, function(files) {
fn(scope, {
$files : files,
Expand Down
4 changes: 2 additions & 2 deletions dist/angular-file-upload.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion nuget/Package.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<id>angular-file-upload</id>
<title>Angular file upload</title>
<version>1.5.0</version>
<version>1.5.1</version>
<authors>Danial Farid, Georgios Diamantopoulos (nuget package)</authors>
<owners>Danial Farid</owners>
<licenseUrl>https://github.com/danialfarid/angular-file-upload/blob/master/LICENSE</licenseUrl>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-file-upload",
"version": "1.5.0",
"version": "1.5.1",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-uglify": "~0.2.7",
Expand Down

0 comments on commit 0e1c8f6

Please sign in to comment.