keycloak-theme/entropia/common/resources/lib/fileupload/angular-file-upload-shim.mi...

2 lines
3.9 KiB
JavaScript
Raw Normal View History

/*! 1.1.10 */
!function(){if(window.XMLHttpRequest&&(XMLHttpRequest=window.FormData?function(a){return function(){var b=new a;return b.send=function(a){return function(){if(arguments[0]instanceof FormData&&arguments[0].__setXHR_){var c=arguments[0];c.__setXHR_(b)}a.apply(b,arguments)}}(b.send),b}}(XMLHttpRequest):function(a){return function(){var b=new a,c=b.send;return b.__requestHeaders=[],b.open=function(a){return b.upload={addEventListener:function(a,c){"progress"==a&&(b.__progress=c)}},function(c,d,e){a.apply(b,[c,d,e]),b.__url=d}}(b.open),b.getResponseHeader=function(a){return function(c){return b.__fileApiXHR?b.__fileApiXHR.getResponseHeader(c):a.apply(b,[c])}}(b.getResponseHeader),b.getAllResponseHeaders=function(a){return function(){return b.__fileApiXHR?b.__fileApiXHR.getAllResponseHeaders():a.apply(b)}}(b.getAllResponseHeaders),b.abort=function(a){return function(){return b.__fileApiXHR?b.__fileApiXHR.abort():null==a?null:a.apply(b)}}(b.abort),b.send=function(){if(null!=arguments[0]&&arguments[0].__isShim&&arguments[0].__setXHR_){var a=arguments[0];if(arguments[0].__setXHR_){var a=arguments[0];a.__setXHR_(b)}var d={url:b.__url,complete:function(a,c){Object.defineProperty(b,"status",{get:function(){return c.status}}),Object.defineProperty(b,"statusText",{get:function(){return c.statusText}}),Object.defineProperty(b,"readyState",{get:function(){return 4}}),Object.defineProperty(b,"response",{get:function(){return c.response}}),Object.defineProperty(b,"responseText",{get:function(){return c.responseText}}),b.__fileApiXHR=c,b.onreadystatechange()},progress:function(a){b.__progress(a)},headers:b.__requestHeaders};d.data={},d.files={};for(var e=0;e<a.data.length;e++){var f=a.data[e];null!=f.val&&null!=f.val.name&&null!=f.val.size&&null!=f.val.type?d.files[f.key]=f.val:d.data[f.key]=f.val}setTimeout(function(){b.__fileApiXHR=FileAPI.upload(d)},1)}else c.apply(b,arguments)},b}}(XMLHttpRequest)),!window.FormData){var a=!1;try{var b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");b&&(a=!0)}catch(c){void 0!=navigator.mimeTypes["application/x-shockwave-flash"]&&(a=!0)}var d=function(b){if(!b.__isWrapped&&(null!=b.getAttribute("ng-file-select")||null!=b.getAttribute("data-ng-file-select"))){var c=document.createElement("div");c.innerHTML='<div class="js-fileapi-wrapper" style="position:relative; overflow:hidden"></div>',c=c.firstChild;var d=b.parentNode;d.insertBefore(c,b),d.removeChild(b),c.appendChild(b),a||c.appendChild(document.createTextNode("Flash is required")),b.__isWrapped=!0}},e=function(a){return function(b){var c=FileAPI.getFiles(b);b.target||(b.target={}),b.target.files=c,b.target.files.item=function(a){return b.target.files[a]||null},a(b)}},f=function(a,b){return("change"===b.toLowerCase()||"onchange"===b.toLowerCase())&&"file"==a.getAttribute("type")};HTMLInputElement.prototype.addEventListener&&(HTMLInputElement.prototype.addEventListener=function(a){return function(b,c,g,h){f(this,b)?(d(this),a.apply(this,[b,e(c),g,h])):a.apply(this,[b,c,g,h])}}(HTMLInputElement.prototype.addEventListener)),HTMLInputElement.prototype.attachEvent&&(HTMLInputElement.prototype.attachEvent=function(a){return function(b,c){f(this,b)?(d(this),a.apply(this,[b,e(c)])):a.apply(this,[b,c])}}(HTMLInputElement.prototype.attachEvent)),window.FormData=FormData=function(){return{append:function(a,b,c){this.data.push({key:a,val:b,name:c})},data:[],__isShim:!0}},function(){if(!window.FileAPI||!FileAPI.upload){var a,b,c,d="",e=document.createElement("script"),f=document.getElementsByTagName("script");if(window.FileAPI&&window.FileAPI.jsPath)d=window.FileAPI.jsPath;else for(a=0;a<f.length;a++)if(c=f[a].src,b=c.indexOf("angular-file-upload-shim.js"),-1==b&&(b=c.indexOf("angular-file-upload-shim.min.js")),b>-1){d=c.substring(0,b);break}window.FileAPI&&null!=FileAPI.staticPath||(FileAPI={staticPath:d}),e.setAttribute("src",d+"FileAPI.min.js"),document.getElementsByTagName("head")[0].appendChild(e)}}()}}();