All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.dirigible.ide-bpm.libs.ng-file-upload.ng-file-upload-all.min.js Maven / Gradle / Ivy

There is a newer version: 10.6.37
Show newest version
/*! 4.1.0 */
!function(){function a(a,b){window.XMLHttpRequest.prototype[a]=b(window.XMLHttpRequest.prototype[a])}function b(a,b,c,d,g,h){function i(){return"input"===b[0].tagName.toLowerCase()&&b.attr("type")&&"file"===b.attr("type").toLowerCase()}function j(b){if(!p){p=!0;try{for(var i=b.__files_||b.target&&b.target.files,j=[],k=[],l=0;l');return k(a),i()?(b.replaceWith(a),b=a):(a.css("display","none").attr("tabindex","-1").attr("__ngf_gen__",!0),b.__ngf_ref_elem__&&b.__ngf_ref_elem__.remove(),b.__ngf_ref_elem__=a,document.body.appendChild(a[0])),a}}function m(b){e(g,h,a,d,c,o,[],[],b,!0)}function n(a){function c(){d[0].click(),i()&&(b.bind("click touchend",n),a.preventDefault())}a.preventDefault();var d=l(a);d&&(d.bind("change",j),m(a),navigator.userAgent.toLowerCase().match(/android/)?setTimeout(function(){c()},0):c())}var o=c.ngfChange||c.ngfSelect&&c.ngfSelect.indexOf("(")>0,p=!1;window.FileAPI&&window.FileAPI.ngfFixIE?window.FileAPI.ngfFixIE(b,l,k,j,m):b.bind("click touchend",n)}function c(a,b,c,g,h,i,j){function k(a,b,c){var d=!0,e=c.dataTransfer.items;if(null!=e)for(var g=0;g0&&"file"!=j.protocol())for(var q=0;q0)break}else{var t=b.dataTransfer.files;if(null!=t)for(var q=0;q0));q++);}var u=0;!function v(a){i(function(){if(p)10*u++<2e4&&v(10);else{if(!g&&m.length>1){for(q=0;"directory"==m[q].type;)q++;m=[m[q]]}d(m,n)}},a||0)}()}var m=d();if(c.dropAvailable&&i(function(){a[c.dropAvailable]?a[c.dropAvailable].value=m:a[c.dropAvailable]=m}),!m)return 1==h(c.ngfHideOnDropNotAvailable)(a)&&b.css("display","none"),void 0;var n,o=null,p=h(c.ngfStopPropagation),q=1,r=(h(c.ngfAccept),h(c.ngfDisabled));b[0].addEventListener("dragover",function(d){if(!r(a)){if(d.preventDefault(),p(a)&&d.stopPropagation(),navigator.userAgent.indexOf("Chrome")>-1){var e=d.dataTransfer.effectAllowed;d.dataTransfer.dropEffect="move"===e||"linkMove"===e?"move":"copy"}i.cancel(o),a.actualDragOverClass||(n=k(a,c,d)),b.addClass(n)}},!1),b[0].addEventListener("dragenter",function(b){r(a)||(b.preventDefault(),p(a)&&b.stopPropagation())},!1),b[0].addEventListener("dragleave",function(){r(a)||(o=i(function(){b.removeClass(n),n=null},q||1))},!1),b[0].addEventListener("drop",function(d){r(a)||(d.preventDefault(),p(a)&&d.stopPropagation(),b.removeClass(n),n=null,l(d,function(b,f){e(h,i,a,g,c,c.ngfChange||c.ngfDrop&&c.ngfDrop.indexOf("(")>0,b,f,d)},0!=h(c.ngfAllowDir)(a),c.multiple||h(c.ngfMultiple)(a)))},!1)}function d(){var a=document.createElement("div");return"draggable"in a&&"ondrop"in a}function e(a,b,c,d,e,f,g,h,i,j){function k(){d&&(a(e.ngModel).assign(c,g),b(function(){d&&d.$setViewValue(null!=g&&0==g.length?null:g)})),e.ngModelRejected&&a(e.ngModelRejected).assign(c,h),f&&a(f)(c,{$files:g,$rejectedFiles:h,$event:i})}j?k():b(function(){k()})}function f(a,b,c,d,e){var f=b(c.ngfAccept),h=b(c.ngfMaxSize)(a)||9007199254740991,i=b(c.ngfMinSize)(a)||-1,j=f(a,{$file:d,$event:e}),k=!1;if(null!=j&&angular.isString(j)){var l=new RegExp(g(j),"gi");k=null!=d.type&&d.type.match(l)||null!=d.name&&d.name.match(l)}return(null==j||k)&&(null==d.size||d.sizei)}function g(a){if(a.length>2&&"/"===a[0]&&"/"===a[a.length-1])return a.substring(1,a.length-1);var b=a.split(","),c="";if(b.length>1)for(var d=0;d|:\\-]","g"),"\\$&")+"$",c=c.replace(/\\\*/g,".*").replace(/\\\?/g,".");return c}var h;window.XMLHttpRequest&&!window.XMLHttpRequest.__isFileAPIShim&&a("setRequestHeader",function(a){return function(b,c){if("__setXHR_"===b){var d=c(this);d instanceof Function&&d(this)}else a.apply(this,arguments)}});var i=angular.module("ngFileUpload",[]);i.version="4.1.0",i.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(),f=e.promise;return d.headers.__setXHR_=function(){return function(a){a&&(d.__XHR=a,d.xhrFn&&d.xhrFn(a),a.upload.addEventListener("progress",function(a){a.config=d,e.notify?e.notify(a):f.progress_fn&&c(function(){f.progress_fn(a)})},!1),a.upload.addEventListener("load",function(a){a.lengthComputable&&(a.config=d,e.notify?e.notify(a):f.progress_fn&&c(function(){f.progress_fn(a)}))},!1))}},a(d).then(function(a){e.resolve(a)},function(a){e.reject(a)},function(a){e.notify(a)}),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.progress_fn=a,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(a){return a.headers=a.headers||{},a.headers["Content-Type"]=void 0,a.transformRequest=a.transformRequest?angular.isArray(a.transformRequest)?a.transformRequest:[a.transformRequest]:[],a.transformRequest.push(function(b){var c=new FormData,d={};for(h in a.fields)a.fields.hasOwnProperty(h)&&(d[h]=a.fields[h]);if(b&&(d.data=b),a.formDataAppender)for(h in d)d.hasOwnProperty(h)&&a.formDataAppender(c,h,d[h]);else for(h in d)if(d.hasOwnProperty(h)){var e=d[h];void 0!==e&&(angular.isDate(e)&&(e=e.toISOString()),angular.isString(e)?c.append(h,e):a.sendObjectsAsJsonBlob&&angular.isObject(e)?c.append(h,new Blob([e],{type:"application/json"})):c.append(h,JSON.stringify(e)))}if(null!=a.file){var f=a.fileFormDataName||"file";if(angular.isArray(a.file))for(var g=angular.isString(f),i=0;i-1&&(this.__origError=f,a.apply(this,[b,"_fix_for_ie_crossdomain__",d]))}}}),a("getResponseHeader",function(a){return function(b){return this.__fileApiXHR&&this.__fileApiXHR.getResponseHeader?this.__fileApiXHR.getResponseHeader(b):null==a?null:a.apply(this,[b])}}),a("getAllResponseHeaders",function(a){return function(){return this.__fileApiXHR&&this.__fileApiXHR.getAllResponseHeaders?this.__fileApiXHR.getAllResponseHeaders():null==a?null:a.apply(this)}}),a("abort",function(a){return function(){return this.__fileApiXHR&&this.__fileApiXHR.abort?this.__fileApiXHR.abort():null==a?null:a.apply(this)}}),a("setRequestHeader",function(a){return function(b,c){if("__setXHR_"===b){e(this);var d=c(this);d instanceof Function&&d(this)}else this.__requestHeaders=this.__requestHeaders||{},this.__requestHeaders[b]=c,a.apply(this,arguments)}}),a("send",function(a){return function(){var c=this;if(arguments[0]&&arguments[0].__isFileAPIShim){var e=arguments[0],f={url:c.__url,jsonp:!1,cache:!0,complete:function(a,d){c.__completed=!0,!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!==d.status&&b(c,"status",function(){return 0==d.status&&a&&"abort"!==a?500:d.status}),void 0!==d.statusText&&b(c,"statusText",function(){return d.statusText}),b(c,"readyState",function(){return 4}),void 0!==d.response&&b(c,"response",function(){return d.response});var e=d.responseText||(a&&0==d.status&&"abort"!==a?a:void 0);b(c,"responseText",function(){return e}),b(c,"response",function(){return e}),a&&b(c,"err",function(){return a}),c.__fileApiXHR=d,c.onreadystatechange&&c.onreadystatechange(),c.onload&&c.onload()},fileprogress:function(a){if(a.target=c,c.__listeners.progress&&c.__listeners.progress(a),c.__total=a.total,c.__loaded=a.loaded,a.total===a.loaded){var b=this;setTimeout(function(){c.__completed||(c.getAllResponseHeaders=function(){},b.complete(null,{status:204,statusText:"No Content"}))},FileAPI.noContentTimeout||1e4)}},headers:c.__requestHeaders};f.data={},f.files={};for(var g=0;g-1){b=f.substring(0,e+1);break}null==FileAPI.staticPath&&(FileAPI.staticPath=b),g.setAttribute("src",a||b+"FileAPI.min.js"),document.getElementsByTagName("head")[0].appendChild(g),FileAPI.hasFlash=d()}}(),FileAPI.ngfFixIE=function(a,b,e,f){if(!d())throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';var g=function(){function d(a){var b,c;if(b=c=0,a.offsetParent)do b+=a.offsetLeft,c+=a.offsetTop;while(a=a.offsetParent);return{left:b,top:c}}if(a.attr("disabled"))a.__ngf_elem__.removeClass("js-fileapi-wrapper");else{var i=a.__ngf_elem__;i?e(a.__ngf_elem__):(i=a.__ngf_elem__=b(),i.addClass("js-fileapi-wrapper"),!c(a),setTimeout(function(){i.bind("mouseenter",g)},10),i.bind("change",function(a){h.apply(this,[a]),f.apply(this,[a])})),c(a)||i.css("position","absolute").css("top",d(a[0]).top+"px").css("left",d(a[0]).left+"px").css("width",a[0].offsetWidth+"px").css("height",a[0].offsetHeight+"px").css("filter","alpha(opacity=0)").css("display",a.css("display")).css("overflow","hidden").css("z-index","900000")}};a.bind("mouseenter",g);var h=function(a){for(var b=FileAPI.getFiles(a),c=0;c




© 2015 - 2025 Weber Informatics LLC | Privacy Policy