chess/public/assets/js/pages/crud/file-upload/uppy.min.js

1 line
6.2 KiB
JavaScript
Raw Normal View History

2024-08-29 03:56:32 +00:00
"use strict";var KTUppy=function(){const e=Uppy.Tus,t=Uppy.ProgressBar,i=Uppy.StatusBar,a=Uppy.FileInput,p=Uppy.Informer,s=Uppy.Dashboard,n=Uppy.Dropbox,o=Uppy.GoogleDrive,r=Uppy.Instagram,u=Uppy.Webcam;return{init:function(){var l,m,d,c;l={proudlyDisplayPoweredByUppy:!1,target:"#kt_uppy_1",inline:!0,replaceTargetContent:!0,showProgressDetails:!0,note:"No filetype restrictions.",height:470,metaFields:[{id:"name",name:"Name",placeholder:"file name"},{id:"caption",name:"Caption",placeholder:"describe what the image is about"}],browserBackButtonClose:!0},(m=Uppy.Core({autoProceed:!0,restrictions:{maxFileSize:1e6,maxNumberOfFiles:5,minNumberOfFiles:1}})).use(s,l),m.use(e,{endpoint:"https://master.tus.io/files/"}),m.use(o,{target:s,companionUrl:"https://companion.uppy.io"}),m.use(n,{target:s,companionUrl:"https://companion.uppy.io"}),m.use(r,{target:s,companionUrl:"https://companion.uppy.io"}),m.use(u,{target:s}),function(){var t={proudlyDisplayPoweredByUppy:!1,target:"#kt_uppy_2",inline:!0,replaceTargetContent:!0,showProgressDetails:!0,note:"Images and video only, 23 files, up to 1 MB",height:470,metaFields:[{id:"name",name:"Name",placeholder:"file name"},{id:"caption",name:"Caption",placeholder:"describe what the image is about"}],browserBackButtonClose:!0},i=Uppy.Core({autoProceed:!0,restrictions:{maxFileSize:1e6,maxNumberOfFiles:5,minNumberOfFiles:1,allowedFileTypes:["image/*","video/*"]}});i.use(s,t),i.use(e,{endpoint:"https://master.tus.io/files/"})}(),d="#kt_uppy_3",(c=Uppy.Core({autoProceed:!0,restrictions:{maxFileSize:1e6,maxNumberOfFiles:5,minNumberOfFiles:1,allowedFileTypes:["image/*","video/*"]}})).use(Uppy.DragDrop,{target:d+" .uppy-drag"}),c.use(t,{target:d+" .uppy-progress",hideUploadButton:!1,hideAfterFinish:!1}),c.use(p,{target:d+" .uppy-informer"}),c.use(e,{endpoint:"https://master.tus.io/files/"}),c.on("complete",function(e){var t="";$.each(e.successful,function(e,i){var a="";/image/.test(i.type)&&(a='<div class="uppy-thumbnail"><img src="'+i.uploadURL+'"/></div>');var p="bytes",s=i.size;s>1024&&(p="kb",(s/=1024)>1024&&(s/=1024,p="MB")),t+='<div class="uppy-thumbnail-container" data-id="'+i.id+'">'+a+' <span class="uppy-thumbnail-label">'+i.name+" ("+Math.round(s,2)+" "+p+')</span><span data-id="'+i.id+'" class="uppy-remove-thumbnail"><i class="flaticon2-cancel-music"></i></span></div>'}),$(d+" .uppy-thumbnails").append(t)}),$(document).on("click",d+" .uppy-thumbnails .uppy-remove-thumbnail",function(){var e=$(this).attr("data-id");c.removeFile(e),$(d+' .uppy-thumbnail-container[data-id="'+e+'"').remove()}),function(){var i="#kt_uppy_4",a=Uppy.Core({autoProceed:!1,restrictions:{maxFileSize:1e6,maxNumberOfFiles:5,minNumberOfFiles:1}});a.use(Uppy.DragDrop,{target:i+" .uppy-drag"}),a.use(t,{target:i+" .uppy-progress"}),a.use(p,{target:i+" .uppy-informer"}),a.use(e,{endpoint:"https://master.tus.io/files/"}),a.on("complete",function(e){var t="";$.each(e.successful,function(e,i){var a="";/image/.test(i.type)&&(a='<div class="uppy-thumbnail"><img src="'+i.uploadURL+'"/></div>');var p="bytes",s=i.size;s>1024&&(p="kb",(s/=1024)>1024&&(s/=1024,p="MB")),t+='<div class="uppy-thumbnail-container" data-id="'+i.id+'">'+a+' <span class="uppy-thumbnail-label">'+i.name+" ("+Math.round(s,2)+" "+p+')</span><span data-id="'+i.id+'" class="uppy-remove-thumbnail"><i class="flaticon2-cancel-music"></i></span></div>'}),$(i+" .uppy-thumbnails").append(t)}),$(i+" .uppy-btn").click(function(){a.upload()}),$(document).on("click",i+" .uppy-thumbnails .uppy-remove-thumbnail",function(){var e=$(this).attr("data-id");a.removeFile(e),$(i+' .uppy-thumbnail-container[data-id="'+e+'"').remove()})}(),function(){var t="#kt_uppy_5",s=$(t+" .uppy-status"),n=$(t+" .uppy-list"),o=Uppy.Core({debug:!0,autoProceed:!0,showProgressDetails:!0,restrictions:{maxFileSize:1e6,maxNumberOfFiles:5,minNumberOfFiles:1}});o.use(a,{target:t+" .uppy-wrapper",pretty:!1}),o.use(p,{target:t+" .uppy-informer"}),o.use(e,{endpoint:"https://master.tus.io/files/"}),o.use(i,{target:t+" .uppy-status",hideUploadButton:!0,hideAfterFinish:!1}),$(t+" .uppy-FileInput-input").ad