diff --git a/demo/war/js/angular-file-upload.js b/demo/war/js/angular-file-upload.js index 5ad9a15a..543a8e3b 100644 --- a/demo/war/js/angular-file-upload.js +++ b/demo/war/js/angular-file-upload.js @@ -192,22 +192,19 @@ 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(); @@ -215,16 +212,16 @@ angularFileUpload.directive('ngFileDrop', [ '$parse', '$timeout', '$location', f }, 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, diff --git a/dist/angular-file-upload-html5-shim.js b/dist/angular-file-upload-html5-shim.js index 0ef41fc5..a50be034 100644 --- a/dist/angular-file-upload-html5-shim.js +++ b/dist/angular-file-upload-html5-shim.js @@ -1,7 +1,7 @@ /**! * AngularJS file upload shim for angular XHR HTML5 browsers * @author Danial - * @version 1.5.0 + * @version 1.5.1 */ if (window.XMLHttpRequest) { if (window.FormData) { diff --git a/dist/angular-file-upload-html5-shim.min.js b/dist/angular-file-upload-html5-shim.min.js index f73ae55c..196e7c9d 100644 --- a/dist/angular-file-upload-html5-shim.min.js +++ b/dist/angular-file-upload-html5-shim.min.js @@ -1,2 +1,2 @@ -/*! 1.5.0 */ +/*! 1.5.1 */ window.XMLHttpRequest&&window.FormData&&(XMLHttpRequest=function(a){return function(){var b=new a;return b.setRequestHeader=function(a){return function(c,d){if("__setXHR_"===c){var e=d(b);e instanceof Function&&e(b)}else a.apply(b,arguments)}}(b.setRequestHeader),b}}(XMLHttpRequest),window.XMLHttpRequest.__isShim=!0); \ No newline at end of file diff --git a/dist/angular-file-upload-shim.js b/dist/angular-file-upload-shim.js index 1f0c896b..a027ef02 100644 --- a/dist/angular-file-upload-shim.js +++ b/dist/angular-file-upload-shim.js @@ -1,7 +1,7 @@ /**! * AngularJS file upload shim for HTML5 FormData * @author Danial - * @version 1.5.0 + * @version 1.5.1 */ (function() { diff --git a/dist/angular-file-upload-shim.min.js b/dist/angular-file-upload-shim.min.js index 1d29ee08..a8efa499 100644 --- a/dist/angular-file-upload-shim.min.js +++ b/dist/angular-file-upload-shim.min.js @@ -1,2 +1,2 @@ -/*! 1.5.0 */ +/*! 1.5.1 */ !function(){function a(a){if(!a.__listeners){a.upload||(a.upload={}),a.__listeners=[];var b=a.upload.addEventListener;a.upload.addEventListener=function(c,d){a.__listeners[c]=d,b&&b.apply(this,arguments)}}}var b=function(){try{var a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if(a)return!0}catch(b){if(void 0!=navigator.mimeTypes["application/x-shockwave-flash"])return!0}return!1},c=function(a,b){window.XMLHttpRequest.prototype[a]=b(window.XMLHttpRequest.prototype[a])};if(window.XMLHttpRequest&&(!window.FormData||window.FileAPI&&FileAPI.forceLoad?(c("open",function(b){return function(c,d,e){a(this),this.__url=d,b.apply(this,[c,d,e])}}),c("getResponseHeader",function(a){return function(b){return this.__fileApiXHR?this.__fileApiXHR.getResponseHeader(b):a.apply(this,[b])}}),c("getAllResponseHeaders",function(a){return function(){return this.__fileApiXHR?this.__fileApiXHR.abort():null==a?null:a.apply(this)}}),c("abort",function(a){return function(){return this.__fileApiXHR?this.__fileApiXHR.abort():null==a?null:a.apply(this)}}),c("setRequestHeader",function(b){return function(c,d){if("__setXHR_"===c){a(this);var e=d(this);e instanceof Function&&e(this)}else this.__requestHeaders=this.__requestHeaders||{},this.__requestHeaders[c]=d,b.apply(this,arguments)}}),c("send",function(a){return function(){var c=this;if(arguments[0]&&arguments[0].__isShim){var d=arguments[0],e={url:c.__url,complete:function(a,b){!a&&c.__listeners.load&&c.__listeners.load({type:"load",loaded:c.__loaded,total:c.__total,target:c,lengthComputable:!0}),!a&&c.__listeners.loadend&&c.__listeners.loadend({type:"loadend",loaded:c.__loaded,total:c.__total,target:c,lengthComputable:!0}),"abort"===a&&c.__listeners.abort&&c.__listeners.abort({type:"abort",loaded:c.__loaded,total:c.__total,target:c,lengthComputable:!0}),void 0!==b.status&&Object.defineProperty(c,"status",{get:function(){return b.status}}),void 0!==b.statusText&&Object.defineProperty(c,"statusText",{get:function(){return b.statusText}}),Object.defineProperty(c,"readyState",{get:function(){return 4}}),void 0!==b.response&&Object.defineProperty(c,"response",{get:function(){return b.response}}),Object.defineProperty(c,"responseText",{get:function(){return b.responseText}}),c.__fileApiXHR=b,c.onreadystatechange()},fileprogress:function(a){a.target=c,c.__listeners.progress&&c.__listeners.progress(a),c.__total=a.total,c.__loaded=a.loaded},headers:c.__requestHeaders};e.data={},e.files={};for(var f=0;f',c=c.firstChild;var d=a.parentNode;d.insertBefore(c,a),d.removeChild(a),c.appendChild(a),a.__isWrapped=!0}},e=function(a){return function(b){for(var c=FileAPI.getFiles(b),d=0;d-1){c=f.substring(0,e);break}null==FileAPI.staticPath&&(FileAPI.staticPath=c),g.setAttribute("src",a||c+"FileAPI.min.js"),document.getElementsByTagName("head")[0].appendChild(g),FileAPI.hasFlash=b()}}()}window.FileReader||(window.FileReader=function(){function a(a,c){var d={type:a,target:b,loaded:c.loaded,total:c.total,error:c.error};return null!=c.result&&(d.target.result=c.result),d}var b=this,c=!1;this.listeners={},this.addEventListener=function(a,c){b.listeners[a]=b.listeners[a]||[],b.listeners[a].push(c)},this.removeEventListener=function(a,c){b.listeners[a]&&b.listeners[a].splice(b.listeners[a].indexOf(c),1)},this.dispatchEvent=function(a){var c=b.listeners[a.type];if(c)for(var d=0;d - * @version 1.5.0 + * @version 1.5.1 */ (function() { @@ -192,22 +192,19 @@ 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(); @@ -215,16 +212,16 @@ angularFileUpload.directive('ngFileDrop', [ '$parse', '$timeout', '$location', f }, 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, diff --git a/dist/angular-file-upload.min.js b/dist/angular-file-upload.min.js index 6e0a9f46..131e83df 100644 --- a/dist/angular-file-upload.min.js +++ b/dist/angular-file-upload.min.js @@ -1,2 +1,2 @@ -/*! 1.5.0 */ -!function(){var a=angular.module("angularFileUpload",[]);a.service("$upload",["$http","$q","$timeout",function(a,b,c){function d(d){d.method=d.method||"POST",d.headers=d.headers||{},d.transformRequest=d.transformRequest||function(b,c){return window.ArrayBuffer&&b instanceof window.ArrayBuffer?b:a.defaults.transformRequest[0](b,c)};var e=b.defer();window.XMLHttpRequest.__isShim&&(d.headers.__setXHR_=function(){return function(a){a&&(d.__XHR=a,d.xhrFn&&d.xhrFn(a),a.upload.addEventListener("progress",function(a){e.notify(a)},!1),a.upload.addEventListener("load",function(a){a.lengthComputable&&e.notify(a)},!1))}}),a(d).then(function(a){e.resolve(a)},function(a){e.reject(a)},function(a){e.notify(a)});var f=e.promise;return f.success=function(a){return f.then(function(b){a(b.data,b.status,b.headers,d)}),f},f.error=function(a){return f.then(null,function(b){a(b.data,b.status,b.headers,d)}),f},f.progress=function(a){return f.then(null,null,function(b){a(b)}),f},f.abort=function(){return d.__XHR&&c(function(){d.__XHR.abort()}),f},f.xhr=function(a){return d.xhrFn=function(b){return function(){b&&b.apply(f,arguments),a.apply(f,arguments)}}(d.xhrFn),f},f}this.upload=function(b){b.headers=b.headers||{},b.headers["Content-Type"]=void 0,b.transformRequest=b.transformRequest||a.defaults.transformRequest;var c=new FormData,e=b.transformRequest,f=b.data;return b.transformRequest=function(a,c){if(f)if(b.formDataAppender)for(var d in f){var g=f[d];b.formDataAppender(a,d,g)}else for(var d in f){var g=f[d];if("function"==typeof e)g=e(g,c);else for(var h=0;h0||navigator.msMaxTouchPoints>0)&&d.bind("touchend",function(a){a.preventDefault(),a.target.click()})}}]),a.directive("ngFileDropAvailable",["$parse","$timeout",function(a,b){return function(c,d,e){if("draggable"in document.createElement("span")){var f=a(e.ngFileDropAvailable);b(function(){f(c)})}}}]),a.directive("ngFileDrop",["$parse","$timeout","$location",function(a,b,c){return function(d,e,f){function g(a){return/^[\000-\177]*$/.test(a)}function h(a,d){var e=[],f=a.dataTransfer.items;if(f&&f.length>0&&f[0].webkitGetAsEntry&&"file"!=c.protocol())for(var h=0;h0||navigator.msMaxTouchPoints>0)&&d.bind("touchend",function(a){a.preventDefault(),a.target.click()})}}]),a.directive("ngFileDropAvailable",["$parse","$timeout",function(a,b){return function(c,d,e){if("draggable"in document.createElement("span")){var f=a(e.ngFileDropAvailable);b(function(){f(c)})}}}]),a.directive("ngFileDrop",["$parse","$timeout","$location",function(a,b,c){return function(d,e,f){function g(a){return/^[\000-\177]*$/.test(a)}function h(a,d){var e=[],f=a.dataTransfer.items;if(f&&f.length>0&&f[0].webkitGetAsEntry&&"file"!=c.protocol())for(var h=0;h angular-file-upload Angular file upload - 1.5.0 + 1.5.1 Danial Farid, Georgios Diamantopoulos (nuget package) Danial Farid https://github.com/danialfarid/angular-file-upload/blob/master/LICENSE diff --git a/package.json b/package.json index ce94fbd4..a77c9526 100644 --- a/package.json +++ b/package.json @@ -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",