iotgateway/IoTGateway/wwwroot/layuiadmin/ueditor/third-party/webuploader/webuploader.custom.js

3 lines
46 KiB
JavaScript
Raw Normal View History

2021-12-12 06:55:48 +00:00
/** layuiAdmin.pro-v1.2.1 LPPL License By http://www.layui.com/admin/ */
;!function(e,t){var n,i={},r=function(e,t){var n,i,r;if("string"==typeof e)return s(e);for(n=[],i=e.length,r=0;r<i;r++)n.push(s(e[r]));return t.apply(null,n)},o=function(e,t,n){2===arguments.length&&(n=t,t=null),r(t||[],function(){a(e,n,arguments)})},a=function(e,t,n){var o,a={exports:t};"function"==typeof t&&(n.length||(n=[r,a.exports,a]),o=t.apply(null,n),void 0!==o&&(a.exports=o)),i[e]=a.exports},s=function(t){var n=i[t]||e[t];if(!n)throw new Error("`"+t+"` is undefined");return n},u=function(e){var t,n,r,o,a,s;s=function(e){return e&&e.charAt(0).toUpperCase()+e.substr(1)};for(t in i)if(n=e,i.hasOwnProperty(t)){for(r=t.split("/"),a=s(r.pop());o=s(r.shift());)n[o]=n[o]||{},n=n[o];n[a]=i[t]}},c=t(e,o,r);u(c),"object"==typeof module&&"object"==typeof module.exports?module.exports=c:"function"==typeof define&&define.amd?define([],c):(n=e.WebUploader,e.WebUploader=c,e.WebUploader.noConflict=function(){e.WebUploader=n})}(this,function(e,t,n){return t("dollar-third",[],function(){return e.jQuery||e.Zepto}),t("dollar",["dollar-third"],function(e){return e}),t("promise-third",["dollar"],function(e){return{Deferred:e.Deferred,when:e.when,isPromise:function(e){return e&&"function"==typeof e.then}}}),t("promise",["promise-third"],function(e){return e}),t("base",["dollar","promise"],function(t,n){function i(e){return function(){return s.apply(e,arguments)}}function r(e,t){return function(){return e.apply(t,arguments)}}function o(e){var t;return Object.create?Object.create(e):(t=function(){},t.prototype=e,new t)}var a=function(){},s=Function.call;return{version:"0.1.2",$:t,Deferred:n.Deferred,isPromise:n.isPromise,when:n.when,browser:function(e){var t={},n=e.match(/WebKit\/([\d.]+)/),i=e.match(/Chrome\/([\d.]+)/)||e.match(/CriOS\/([\d.]+)/),r=e.match(/MSIE\s([\d\.]+)/)||e.match(/(?:trident)(?:.*rv:([\w.]+))?/i),o=e.match(/Firefox\/([\d.]+)/),a=e.match(/Safari\/([\d.]+)/),s=e.match(/OPR\/([\d.]+)/);return n&&(t.webkit=parseFloat(n[1])),i&&(t.chrome=parseFloat(i[1])),r&&(t.ie=parseFloat(r[1])),o&&(t.firefox=parseFloat(o[1])),a&&(t.safari=parseFloat(a[1])),s&&(t.opera=parseFloat(s[1])),t}(navigator.userAgent),os:function(e){var t={},n=e.match(/(?:Android);?[\s\/]+([\d.]+)?/),i=e.match(/(?:iPad|iPod|iPhone).*OS\s([\d_]+)/);return n&&(t.android=parseFloat(n[1])),i&&(t.ios=parseFloat(i[1].replace(/_/g,"."))),t}(navigator.userAgent),inherits:function(e,n,i){var r;return"function"==typeof n?(r=n,n=null):r=n&&n.hasOwnProperty("constructor")?n.constructor:function(){return e.apply(this,arguments)},t.extend(!0,r,e,i||{}),r.__super__=e.prototype,r.prototype=o(e.prototype),n&&t.extend(!0,r.prototype,n),r},noop:a,bindFn:r,log:function(){return e.console?r(console.log,console):a}(),nextTick:function(){return function(e){setTimeout(e,1)}}(),slice:i([].slice),guid:function(){var e=0;return function(t){for(var n=(+new Date).toString(32),i=0;i<5;i++)n+=Math.floor(65535*Math.random()).toString(32);return(t||"wu_")+n+(e++).toString(32)}}(),formatSize:function(e,t,n){var i;for(n=n||["B","K","M","G","TB"];(i=n.shift())&&e>1024;)e/=1024;return("B"===i?e:e.toFixed(t||2))+i}}}),t("mediator",["base"],function(e){function t(e,t,n,i){return o.grep(e,function(e){return e&&(!t||e.e===t)&&(!n||e.cb===n||e.cb._cb===n)&&(!i||e.ctx===i)})}function n(e,t,n){o.each((e||"").split(s),function(e,i){n(i,t)})}function i(e,t){for(var n,i=!1,r=-1,o=e.length;++r<o;)if(n=e[r],n.cb.apply(n.ctx2,t)===!1){i=!0;break}return!i}var r,o=e.$,a=[].slice,s=/\s+/;return r={on:function(e,t,i){var r,o=this;return t?(r=this._events||(this._events=[]),n(e,t,function(e,t){var n={e:e};n.cb=t,n.ctx=i,n.ctx2=i||o,n.id=r.length,r.push(n)}),this):this},once:function(e,t,i){var r=this;return t?(n(e,t,function(e,t){var n=function(){return r.off(e,n),t.apply(i||r,arguments)};n._cb=t,r.on(e,n,i)}),r):r},off:function(e,i,r){var a=this._events;return a?e||i||r?(n(e,i,function(e,n){o.each(t(a,e,n,r),function(){delete a[this.id]})}),this):(this._events=[],this):this},trigger:function(e){var n,r,o;return this._events&&e?(n=a.call(arguments,1),r=t(this._events,e),o=t(this._events,"all"),i(r,n)&&i(o,argume
return e.getUint32(t,n)},size:4},5:{getValue:function(e,t,n){return e.getUint32(t,n)/e.getUint32(t+4,n)},size:8},9:{getValue:function(e,t,n){return e.getInt32(t,n)},size:4},10:{getValue:function(e,t,n){return e.getInt32(t,n)/e.getInt32(t+4,n)},size:8}},n.exifTagTypes[7]=n.exifTagTypes[1],n.getExifValue=function(t,i,r,o,a,s){var u,c,l,f,h,d,p=n.exifTagTypes[o];if(!p)return void e.log("Invalid Exif data: Invalid tag type.");if(u=p.size*a,c=u>4?i+t.getUint32(r+8,s):r+8,c+u>t.byteLength)return void e.log("Invalid Exif data: Invalid data offset.");if(1===a)return p.getValue(t,c,s);for(l=[],f=0;f<a;f+=1)l[f]=p.getValue(t,c+f*p.size,s);if(p.ascii){for(h="",f=0;f<l.length&&(d=l[f],"\0"!==d);f+=1)h+=d;return h}return l},n.parseExifTag=function(e,t,i,r,o){var a=e.getUint16(i,r);o.exif[a]=n.getExifValue(e,t,i,e.getUint16(i+2,r),e.getUint32(i+4,r),r)},n.parseExifTags=function(t,n,i,r,o){var a,s,u;if(i+6>t.byteLength)return void e.log("Invalid Exif data: Invalid directory offset.");if(a=t.getUint16(i,r),s=i+2+12*a,s+4>t.byteLength)return void e.log("Invalid Exif data: Invalid directory size.");for(u=0;u<a;u+=1)this.parseExifTag(t,n,i+2+12*u,r,o);return t.getUint32(s,r)},n.parseExifData=function(t,i,r,o){var a,s,u=i+10;if(1165519206===t.getUint32(i+4)){if(u+8>t.byteLength)return void e.log("Invalid Exif data: Invalid segment size.");if(0!==t.getUint16(i+8))return void e.log("Invalid Exif data: Missing byte alignment offset.");switch(t.getUint16(u)){case 18761:a=!0;break;case 19789:a=!1;break;default:return void e.log("Invalid Exif data: Invalid byte alignment marker.")}if(42!==t.getUint16(u+2,a))return void e.log("Invalid Exif data: Missing TIFF marker.");s=t.getUint32(u+4,a),o.exif=new n.ExifMap,s=n.parseExifTags(t,u,u+s,a,o)}},t.parsers[65505].push(n.parseExifData),n}),t("runtime/html5/image",["base","runtime/html5/runtime","runtime/html5/util"],function(e,t,n){var i="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D";return t.register("Image",{modified:!1,init:function(){var e=this,t=new Image;t.onload=function(){e._info={type:e.type,width:this.width,height:this.height},e._metas||"image/jpeg"!==e.type?e.owner.trigger("load"):n.parseMeta(e._blob,function(t,n){e._metas=n,e.owner.trigger("load")})},t.onerror=function(){e.owner.trigger("error")},e._img=t},loadFromBlob:function(e){var t=this,i=t._img;t._blob=e,t.type=e.type,i.src=n.createObjectURL(e.getSource()),t.owner.once("load",function(){n.revokeObjectURL(i.src)})},resize:function(e,t){var n=this._canvas||(this._canvas=document.createElement("canvas"));this._resize(this._img,n,e,t),this._blob=null,this.modified=!0,this.owner.trigger("complete")},getAsBlob:function(e){var t,i=this._blob,r=this.options;if(e=e||this.type,this.modified||this.type!==e){if(t=this._canvas,"image/jpeg"===e){if(i=n.canvasToDataUrl(t,"image/jpeg",r.quality),r.preserveHeaders&&this._metas&&this._metas.imageHead)return i=n.dataURL2ArrayBuffer(i),i=n.updateImageHead(i,this._metas.imageHead),i=n.arrayBufferToBlob(i,e)}else i=n.canvasToDataUrl(t,e);i=n.dataURL2Blob(i)}return i},getAsDataUrl:function(e){var t=this.options;return e=e||this.type,"image/jpeg"===e?n.canvasToDataUrl(this._canvas,e,t.quality):this._canvas.toDataURL(e)},getOrientation:function(){return this._metas&&this._metas.exif&&this._metas.exif.get("Orientation")||1},info:function(e){return e?(this._info=e,this):this._info},meta:function(e){return e?(this._meta=e,this):this._meta},destroy:function(){var e=this._canvas;this._img.onload=null,e&&(e.getContext("2d").clearRect(0,0,e.width,e.height),e.width=e.height=0,this._canvas=null),this._img.src=i,this._img=this._blob=null},_resize:function(e,t,n,i){var r,o,a,s,u,c=this.options,l=e.width,f=e.height,h=this.getOrientation();~[5,6,7,8].indexOf(h)&&(n^=i,i^=n,n^=i),r=Math[c.crop?"max":"min"](n/l,i/f),c.allowMagnify||(r=Math.min(1,r)),o=l*r,a=f*r,c.crop?(t.width=n,t.height=i):(t.width=o,t.height=a),s=(t.width-o)/2,u=(t.height-a)/2,c.preserveHeaders||this._rotate2Orientaion(t,h),this._renderImageToCanvas(t,e,s,u,o,a)},_rotate2Orientaion:function(e,t){var n=e.width,i=e.height,r=e.getContext("2d"