wp-go/static/wp-includes/js/plupload/plupload.min.js

1 line
15 KiB
JavaScript
Raw Normal View History

2022-09-13 03:23:28 +00:00
!function(e,I,S){var T=e.setTimeout,D={};function w(e){var t=e.required_features,r={};function i(e,t,i){var n={chunks:"slice_blob",jpgresize:"send_binary_string",pngresize:"send_binary_string",progress:"report_upload_progress",multi_selection:"select_multiple",dragdrop:"drag_and_drop",drop_element:"drag_and_drop",headers:"send_custom_headers",urlstream_upload:"send_binary_string",canSendBinary:"send_binary",triggerDialog:"summon_file_dialog"};n[e]?r[n[e]]=t:i||(r[e]=t)}return"string"==typeof t?F.each(t.split(/\s*,\s*/),function(e){i(e,!0)}):"object"==typeof t?F.each(t,function(e,t){i(t,e)}):!0===t&&(0<e.chunk_size&&(r.slice_blob=!0),!e.resize.enabled&&e.multipart||(r.send_binary_string=!0),F.each(e,function(e,t){i(t,!!e,!0)})),e.runtimes="html5,html4",r}var t,F={VERSION:"2.1.9",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,FILE_DUPLICATE_ERROR:-602,IMAGE_FORMAT_ERROR:-700,MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,mimeTypes:I.mimes,ua:I.ua,typeOf:I.typeOf,extend:I.extend,guid:I.guid,getAll:function(e){for(var t,i=[],n=(e="array"!==F.typeOf(e)?[e]:e).length;n--;)(t=F.get(e[n]))&&i.push(t);return i.length?i:null},get:I.get,each:I.each,getPos:I.getPos,getSize:I.getSize,xmlEncode:function(e){var t={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"};return e&&(""+e).replace(/[<>&\"\']/g,function(e){return t[e]?"&"+t[e]+";":e})},toArray:I.toArray,inArray:I.inArray,addI18n:I.addI18n,translate:I.translate,isEmptyObj:I.isEmptyObj,hasClass:I.hasClass,addClass:I.addClass,removeClass:I.removeClass,getStyle:I.getStyle,addEvent:I.addEvent,removeEvent:I.removeEvent,removeAllEvents:I.removeAllEvents,cleanName:function(e){for(var t=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"],i=0;i<t.length;i+=2)e=e.replace(t[i],t[i+1]);return e=(e=e.replace(/\s+/g,"_")).replace(/[^a-z0-9_\-\.]+/gi,"")},buildUrl:function(e,t){var i="";return F.each(t,function(e,t){i+=(i?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(e)}),i&&(e+=(0<e.indexOf("?")?"&":"?")+i),e},formatSize:function(e){if(e===S||/\D/.test(e))return F.translate("N/A");function t(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}var i=Math.pow(1024,4);return i<e?t(e/i,1)+" "+F.translate("tb"):e>(i/=1024)?t(e/i,1)+" "+F.translate("gb"):e>(i/=1024)?t(e/i,1)+" "+F.translate("mb"):1024<e?Math.round(e/1024)+" "+F.translate("kb"):e+" "+F.translate("b")},parseSize:I.parseSizeStr,predictRuntime:function(e,t){var i=new F.Uploader(e),t=I.Runtime.thatCan(i.getOption().required_features,t||e.runtimes);return i.destroy(),t},addFileFilter:function(e,t){D[e]=t}};F.addFileFilter("mime_types",function(e,t,i){e.length&&!e.regexp.test(t.name)?(this.trigger("Error",{code:F.FILE_EXTENSION_ERROR,message:F.translate("File extension error."),file:t}),i(!1)):i(!0)}),F.addFileFilter("max_file_size",function(e,t,i){e=F.parseSize(e),void 0!==t.size&&e&&t.size>e?(this.trigger("Error",{code:F.FILE_SIZE_ERROR,message:F.translate("File size error."),file:t}),i(!1)):i(!0)}),F.addFileFilter("prevent_duplicates",function(e,t,i){if(e)for(var n=this.files.length;n--;)if(t.name===this.files[n].name&&t.size===this.files[n].size)return this.trigger("Error",{code:F.FILE_DUPLICATE_ERROR,message:F.translate("Duplicate file error."),file:t}),void i(!1);i(!0)}),F.Uploader=function(e){var u,i,n,p,t=F.guid(),l=[],h={},o=[],d=[],c=!1;function r(){var e,t,i=0;if(this.state==F.STARTED){for(t=0;t<l.length;t++)e||l[t].status!=F.QUEUED?i++:(e=l[t],this.trigger("BeforeUpload",e)&&(e.status=F.UPLOADING,this.trigger("UploadFile",e)));i==l.length&&(this.state!==F.STOPPED&&(this.state=F.STOPPED,this.trigger("StateChanged")),this.trigger("UploadComplete",l))}}function s(e){e.percent=0<e.size?Math.ceil(e.loaded/e.size*100):100,a()}function a(){var e,t;for(n.reset(),e=0;e<l.length;e++)(t=l[e]).size!==S?(n.