-
Notifications
You must be signed in to change notification settings - Fork 10
/
jQuery.FileDrop.all.min.js
1 lines (1 loc) · 2.11 KB
/
jQuery.FileDrop.all.min.js
1
!function($){"use strict";function e(e){e.stopPropagation(),e.preventDefault()}function n(e){var n=window.atob(e);try{return decodeURIComponent(window.escape(n))}catch(t){return""}}function t(e){$.isFunction(e)&&(e={onFileRead:e});var n=$.extend({},$.fn.fileDrop.defaults,e);if(n.decodeBase64&&(n.removeDataUriScheme=!0),n.addClassTo=$(n.addClassTo),!$.isFunction(n.onFileRead))throw'The option "onFileRead" is not set to a function!';return n}function a(n,t){n.addEventListener("dragenter",function(n){$(t.addClassTo).addClass(t.overClass),e(n)},!1),n.addEventListener("dragover",function(n){clearTimeout(r),r=setTimeout(function(){$(t.addClassTo).removeClass(t.overClass)},100),e(n)},!1),n.addEventListener("drop",function(n){$(t.addClassTo).removeClass(t.overClass),e(n);for(var a=n.dataTransfer.files,r=[],i=0;i<=a.length-1;i++){var d=new FileReader,s=o(a[i],r,a.length,t);d.addEventListener?d.addEventListener("loadend",s,!1):d.onloadend=s,d.readAsDataURL(a[i])}},!1)}function o(e,t,a,o){return function(r){var i=r.target.result;o.removeDataUriScheme&&(i=$.removeUriScheme(i)),o.decodeBase64&&(i=n(i)),t.push({name:e.name,size:e.size,type:e.type,lastModified:e.lastModifiedDate,data:r.target.result}),t.length===a&&$.isFunction(o.onFileRead)&&o.onFileRead(t,o)}}var r=null;$.removeUriScheme=function(e){return e.replace(/^data:.*;base64,/,"")},$.support.fileDrop=function(){return!!window.FileList}(),$.fn.fileDrop=function(e){var n=t(e);return this.each(function(){var e=n;0===e.addClassTo.length&&(e.addClassTo=$(this)),a(this,e)})},$.fn.fileDrop.defaults={overClass:"state-over",addClassTo:null,onFileRead:null,removeDataUriScheme:!0,decodeBase64:!1}}(jQuery),function(e){function n(e){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",t,a,o,r,i,d,s,l,u=0,f=0,c="",v=[];if(!e)return e;e+="";do r=n.indexOf(e.charAt(u++)),i=n.indexOf(e.charAt(u++)),d=n.indexOf(e.charAt(u++)),s=n.indexOf(e.charAt(u++)),l=r<<18|i<<12|d<<6|s,t=l>>16&255,a=l>>8&255,o=255&l,64==d?v[f++]=String.fromCharCode(t):64==s?v[f++]=String.fromCharCode(t,a):v[f++]=String.fromCharCode(t,a,o);while(u<e.length);return c=v.join("")}e.atob||(e.atob=n)}(window);