seeddms-code/styles/bootstrap/fine-uploader/dnd.min.js

3 lines
18 KiB
JavaScript

// Fine Uploader 5.12.0 - (c) 2013-present Widen Enterprises, Inc. MIT licensed. http://fineuploader.com
!function(global){var qq=function(e){"use strict";return{hide:function(){return e.style.display="none",this},attach:function(n,t){return e.addEventListener?e.addEventListener(n,t,!1):e.attachEvent&&e.attachEvent("on"+n,t),function(){qq(e).detach(n,t)}},detach:function(n,t){return e.removeEventListener?e.removeEventListener(n,t,!1):e.attachEvent&&e.detachEvent("on"+n,t),this},contains:function(n){return!!n&&(e===n||(e.contains?e.contains(n):!!(8&n.compareDocumentPosition(e))))},insertBefore:function(n){return n.parentNode.insertBefore(e,n),this},remove:function(){return e.parentNode.removeChild(e),this},css:function(n){if(null==e.style)throw new qq.Error("Can't apply style to node as it is not on the HTMLElement prototype chain!");return null!=n.opacity&&"string"!=typeof e.style.opacity&&"undefined"!=typeof e.filters&&(n.filter="alpha(opacity="+Math.round(100*n.opacity)+")"),qq.extend(e.style,n),this},hasClass:function(n,t){var r=new RegExp("(^| )"+n+"( |$)");return r.test(e.className)||!(!t||!r.test(e.parentNode.className))},addClass:function(n){return qq(e).hasClass(n)||(e.className+=" "+n),this},removeClass:function(n){var t=new RegExp("(^| )"+n+"( |$)");return e.className=e.className.replace(t," ").replace(/^\s+|\s+$/g,""),this},getByClass:function(n,t){var r,o=[];return t&&e.querySelector?e.querySelector("."+n):e.querySelectorAll?e.querySelectorAll("."+n):(r=e.getElementsByTagName("*"),qq.each(r,function(e,t){qq(t).hasClass(n)&&o.push(t)}),t?o[0]:o)},getFirstByClass:function(n){return qq(e).getByClass(n,!0)},children:function(){for(var n=[],t=e.firstChild;t;)1===t.nodeType&&n.push(t),t=t.nextSibling;return n},setText:function(n){return e.innerText=n,e.textContent=n,this},clearText:function(){return qq(e).setText("")},hasAttribute:function(n){var t;return e.hasAttribute?!!e.hasAttribute(n)&&null==/^false$/i.exec(e.getAttribute(n)):(t=e[n],void 0!==t&&null==/^false$/i.exec(t))}}};!function(){"use strict";qq.canvasToBlob=function(e,n,t){return qq.dataUriToBlob(e.toDataURL(n,t))},qq.dataUriToBlob=function(e){var n,t,r,o,i=function(e,n){var t=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,r=t&&new t;return r?(r.append(e),r.getBlob(n)):new Blob([e],{type:n})};return t=e.split(",")[0].indexOf("base64")>=0?atob(e.split(",")[1]):decodeURI(e.split(",")[1]),o=e.split(",")[0].split(":")[1].split(";")[0],n=new ArrayBuffer(t.length),r=new Uint8Array(n),qq.each(t,function(e,n){r[e]=n.charCodeAt(0)}),i(n,o)},qq.log=function(e,n){window.console&&(n&&"info"!==n?window.console[n]?window.console[n](e):window.console.log("<"+n+"> "+e):window.console.log(e))},qq.isObject=function(e){return e&&!e.nodeType&&"[object Object]"===Object.prototype.toString.call(e)},qq.isFunction=function(e){return"function"==typeof e},qq.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)||e&&window.ArrayBuffer&&e.buffer&&e.buffer.constructor===ArrayBuffer},qq.isItemList=function(e){return"[object DataTransferItemList]"===Object.prototype.toString.call(e)},qq.isNodeList=function(e){return"[object NodeList]"===Object.prototype.toString.call(e)||e.item&&e.namedItem},qq.isString=function(e){return"[object String]"===Object.prototype.toString.call(e)},qq.trimStr=function(e){return String.prototype.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},qq.format=function(e){var n=Array.prototype.slice.call(arguments,1),t=e,r=t.indexOf("{}");return qq.each(n,function(e,n){var o=t.substring(0,r),i=t.substring(r+2);if(t=o+n+i,r=t.indexOf("{}",r+n.length),r<0)return!1}),t},qq.isFile=function(e){return window.File&&"[object File]"===Object.prototype.toString.call(e)},qq.isFileList=function(e){return window.FileList&&"[object FileList]"===Object.prototype.toString.call(e)},qq.isFileOrInput=function(e){return qq.isFile(e)||qq.isInput(e)},qq.isInput=function(e,n){var t=function(e){var t=e.toLowerCase();return n?"file"!==t:"file"===t};return!!(window.HTMLInputElement&&"[object HTMLInputElement]"===Object.prototype.toString.call(e)&&e.type&&t(e.type))||!!(e.tagName&&"input"===e.tagName.toLowerCase()&&e.type&&t(e.type))},qq.isBlob=function(e){if(window.Blob&&"[object Blob]"===Object.prototype.toString.call(e))return!0},qq.isXhrUploadSupported=function(){var e=document.createElement("input");return e.type="file",void 0!==e.multiple&&"undefined"!=typeof File&&"undefined"!=typeof FormData&&"undefined"!=typeof qq.createXhrInstance().upload},qq.createXhrInstance=function(){if(window.XMLHttpRequest)return new XMLHttpRequest;try{return new ActiveXObject("MSXML2.XMLHTTP.3.0")}catch(e){return qq.log("Neither XHR or ActiveX are supported!","error"),null}},qq.isFolderDropSupported=function(e){return e.items&&e.items.length>0&&e.items[0].webkitGetAsEntry},qq.isFileChunkingSupported=function(){return!qq.androidStock()&&qq.isXhrUploadSupported()&&(void 0!==File.prototype.slice||void 0!==File.prototype.webkitSlice||void 0!==File.prototype.mozSlice)},qq.sliceBlob=function(e,n,t){var r=e.slice||e.mozSlice||e.webkitSlice;return r.call(e,n,t)},qq.arrayBufferToHex=function(e){var n="",t=new Uint8Array(e);return qq.each(t,function(e,t){var r=t.toString(16);r.length<2&&(r="0"+r),n+=r}),n},qq.readBlobToHex=function(e,n,t){var r=qq.sliceBlob(e,n,n+t),o=new FileReader,i=new qq.Promise;return o.onload=function(){i.success(qq.arrayBufferToHex(o.result))},o.onerror=i.failure,o.readAsArrayBuffer(r),i},qq.extend=function(e,n,t){return qq.each(n,function(n,r){t&&qq.isObject(r)?(void 0===e[n]&&(e[n]={}),qq.extend(e[n],r,!0)):e[n]=r}),e},qq.override=function(e,n){var t={},r=n(t);return qq.each(r,function(n,r){void 0!==e[n]&&(t[n]=e[n]),e[n]=r}),e},qq.indexOf=function(e,n,t){if(e.indexOf)return e.indexOf(n,t);t=t||0;var r=e.length;for(t<0&&(t+=r);t<r;t+=1)if(e.hasOwnProperty(t)&&e[t]===n)return t;return-1},qq.getUniqueId=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=16*Math.random()|0,t="x"==e?n:3&n|8;return t.toString(16)})},qq.ie=function(){return navigator.userAgent.indexOf("MSIE")!==-1||navigator.userAgent.indexOf("Trident")!==-1},qq.ie7=function(){return navigator.userAgent.indexOf("MSIE 7")!==-1},qq.ie8=function(){return navigator.userAgent.indexOf("MSIE 8")!==-1},qq.ie10=function(){return navigator.userAgent.indexOf("MSIE 10")!==-1},qq.ie11=function(){return qq.ie()&&navigator.userAgent.indexOf("rv:11")!==-1},qq.edge=function(){return navigator.userAgent.indexOf("Edge")>=0},qq.safari=function(){return void 0!==navigator.vendor&&navigator.vendor.indexOf("Apple")!==-1},qq.chrome=function(){return void 0!==navigator.vendor&&navigator.vendor.indexOf("Google")!==-1},qq.opera=function(){return void 0!==navigator.vendor&&navigator.vendor.indexOf("Opera")!==-1},qq.firefox=function(){return!qq.edge()&&!qq.ie11()&&navigator.userAgent.indexOf("Mozilla")!==-1&&void 0!==navigator.vendor&&""===navigator.vendor},qq.windows=function(){return"Win32"===navigator.platform},qq.android=function(){return navigator.userAgent.toLowerCase().indexOf("android")!==-1},qq.androidStock=function(){return qq.android()&&navigator.userAgent.toLowerCase().indexOf("chrome")<0},qq.ios6=function(){return qq.ios()&&navigator.userAgent.indexOf(" OS 6_")!==-1},qq.ios7=function(){return qq.ios()&&navigator.userAgent.indexOf(" OS 7_")!==-1},qq.ios8=function(){return qq.ios()&&navigator.userAgent.indexOf(" OS 8_")!==-1},qq.ios800=function(){return qq.ios()&&navigator.userAgent.indexOf(" OS 8_0 ")!==-1},qq.ios=function(){return navigator.userAgent.indexOf("iPad")!==-1||navigator.userAgent.indexOf("iPod")!==-1||navigator.userAgent.indexOf("iPhone")!==-1},qq.iosChrome=function(){return qq.ios()&&navigator.userAgent.indexOf("CriOS")!==-1},qq.iosSafari=function(){return qq.ios()&&!qq.iosChrome()&&navigator.userAgent.indexOf("Safari")!==-1},qq.iosSafariWebView=function(){return qq.ios()&&!qq.iosChrome()&&!qq.iosSafari()},qq.preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},qq.toElement=function(){var e=document.createElement("div");return function(n){e.innerHTML=n;var t=e.firstChild;return e.removeChild(t),t}}(),qq.each=function(e,n){var t,r;if(e)if(window.Storage&&e.constructor===window.Storage)for(t=0;t<e.length&&(r=n(e.key(t),e.getItem(e.key(t))),r!==!1);t++);else if(qq.isArray(e)||qq.isItemList(e)||qq.isNodeList(e))for(t=0;t<e.length&&(r=n(t,e[t]),r!==!1);t++);else if(qq.isString(e))for(t=0;t<e.length&&(r=n(t,e.charAt(t)),r!==!1);t++);else for(t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&(r=n(t,e[t]),r===!1))break},qq.bind=function(e,n){if(qq.isFunction(e)){var t=Array.prototype.slice.call(arguments,2);return function(){var r=qq.extend([],t);return arguments.length&&(r=r.concat(Array.prototype.slice.call(arguments))),e.apply(n,r)}}throw new Error("first parameter must be a function!")},qq.obj2url=function(e,n,t){var r=[],o="&",i=function(e,t){var o=n?/\[\]$/.test(n)?n:n+"["+t+"]":t;"undefined"!==o&&"undefined"!==t&&r.push("object"==typeof e?qq.obj2url(e,o,!0):"[object Function]"===Object.prototype.toString.call(e)?encodeURIComponent(o)+"="+encodeURIComponent(e()):encodeURIComponent(o)+"="+encodeURIComponent(e))};return!t&&n?(o=/\?/.test(n)?/\?$/.test(n)?"":"&":"?",r.push(n),r.push(qq.obj2url(e))):"[object Array]"===Object.prototype.toString.call(e)&&"undefined"!=typeof e?qq.each(e,function(e,n){i(n,e)}):"undefined"!=typeof e&&null!==e&&"object"==typeof e?qq.each(e,function(e,n){i(n,e)}):r.push(encodeURIComponent(n)+"="+encodeURIComponent(e)),n?r.join(o):r.join(o).replace(/^&/,"").replace(/%20/g,"+")},qq.obj2FormData=function(e,n,t){return n||(n=new FormData),qq.each(e,function(e,r){e=t?t+"["+e+"]":e,qq.isObject(r)?qq.obj2FormData(r,n,e):qq.isFunction(r)?n.append(e,r()):n.append(e,r)}),n},qq.obj2Inputs=function(e,n){var t;return n||(n=document.createElement("form")),qq.obj2FormData(e,{append:function(e,r){t=document.createElement("input"),t.setAttribute("name",e),t.setAttribute("value",r),n.appendChild(t)}}),n},qq.parseJson=function(json){return window.JSON&&qq.isFunction(JSON.parse)?JSON.parse(json):eval("("+json+")")},qq.getExtension=function(e){var n=e.lastIndexOf(".")+1;if(n>0)return e.substr(n,e.length-n)},qq.getFilename=function(e){return qq.isInput(e)?e.value.replace(/.*(\/|\\)/,""):qq.isFile(e)&&null!==e.fileName&&void 0!==e.fileName?e.fileName:e.name},qq.DisposeSupport=function(){var e=[];return{dispose:function(){var n;do n=e.shift(),n&&n();while(n)},attach:function(){var e=arguments;this.addDisposer(qq(e[0]).attach.apply(this,Array.prototype.slice.call(arguments,1)))},addDisposer:function(n){e.push(n)}}}}(),function(){"use strict";"function"==typeof define&&define.amd?define(function(){return qq}):"undefined"!=typeof module&&module.exports?module.exports=qq:global.qq=qq}(),qq.version="5.12.0",qq.supportedFeatures=function(){"use strict";function e(){var e,n=!0;try{e=document.createElement("input"),e.type="file",qq(e).hide(),e.disabled&&(n=!1)}catch(e){n=!1}return n}function n(){return(qq.chrome()||qq.opera())&&void 0!==navigator.userAgent.match(/Chrome\/[2][1-9]|Chrome\/[3-9][0-9]/)}function t(){return(qq.chrome()||qq.opera())&&void 0!==navigator.userAgent.match(/Chrome\/[1][4-9]|Chrome\/[2-9][0-9]/)}function r(){if(window.XMLHttpRequest){var e=qq.createXhrInstance();return void 0!==e.withCredentials}return!1}function o(){return void 0!==window.XDomainRequest}function i(){return!!r()||o()}function a(){return void 0!==document.createElement("input").webkitdirectory}function u(){try{return!!window.localStorage&&qq.isFunction(window.localStorage.setItem)}catch(e){return!1}}function c(){var e=document.createElement("span");return("draggable"in e||"ondragstart"in e&&"ondrop"in e)&&!qq.android()&&!qq.ios()}var s,l,q,f,d,p,g,v,h,m,y,b,w,x,E;return s=e(),f=s&&qq.isXhrUploadSupported(),l=f&&!qq.androidStock(),q=f&&c(),d=q&&n(),p=f&&qq.isFileChunkingSupported(),g=f&&p&&u(),v=f&&t(),h=s&&(void 0!==window.postMessage||f),y=r(),m=o(),b=i(),w=a(),x=f&&void 0!==window.FileReader,E=function(){return!!f&&(!qq.androidStock()&&!qq.iosChrome())}(),{ajaxUploading:f,blobUploading:l,canDetermineSize:f,chunking:p,deleteFileCors:b,deleteFileCorsXdr:m,deleteFileCorsXhr:y,dialogElement:!!window.HTMLDialogElement,fileDrop:q,folderDrop:d,folderSelection:w,imagePreviews:x,imageValidation:x,itemSizeValidation:f,pause:p,progressBar:E,resume:g,scaling:x&&l,tiffPreviews:qq.safari(),unlimitedScaledImageSize:!qq.ios(),uploading:s,uploadCors:h,uploadCustomHeaders:f,uploadNonMultipart:f,uploadViaPaste:v}}(),qq.isGenericPromise=function(e){"use strict";return!!(e&&e.then&&qq.isFunction(e.then))},qq.Promise=function(){"use strict";var e,n,t=[],r=[],o=[],i=0;qq.extend(this,{then:function(o,a){return 0===i?(o&&t.push(o),a&&r.push(a)):i===-1?a&&a.apply(null,n):o&&o.apply(null,e),this},done:function(t){return 0===i?o.push(t):t.apply(null,void 0===n?e:n),this},success:function(){return i=1,e=arguments,t.length&&qq.each(t,function(n,t){t.apply(null,e)}),o.length&&qq.each(o,function(n,t){t.apply(null,e)}),this},failure:function(){return i=-1,n=arguments,r.length&&qq.each(r,function(e,t){t.apply(null,n)}),o.length&&qq.each(o,function(e,t){t.apply(null,n)}),this}})},qq.DragAndDrop=function(e){"use strict";function n(e,n){var t=Array.prototype.slice.call(e);s.callbacks.dropLog("Grabbed "+e.length+" dropped files."),n.dropDisabled(!1),s.callbacks.processingDroppedFilesComplete(t,n.getElement())}function t(e){var n=new qq.Promise;return e.isFile?e.file(function(t){var r=e.name,o=e.fullPath,i=o.indexOf(r);o=o.substr(0,i),"/"===o.charAt(0)&&(o=o.substr(1)),t.qqPath=o,d.push(t),n.success()},function(t){s.callbacks.dropLog("Problem parsing '"+e.fullPath+"'. FileError code "+t.code+".","error"),n.failure()}):e.isDirectory&&r(e).then(function(e){var r=e.length;qq.each(e,function(e,o){t(o).done(function(){r-=1,0===r&&n.success()})}),e.length||n.success()},function(t){s.callbacks.dropLog("Problem parsing '"+e.fullPath+"'. FileError code "+t.code+".","error"),n.failure()}),n}function r(e,n,t,o){var i=o||new qq.Promise,a=n||e.createReader();return a.readEntries(function(n){var o=t?t.concat(n):n;n.length?setTimeout(function(){r(e,a,o,i)},0):i.success(o)},i.failure),i}function o(e,n){var r=[],o=new qq.Promise;return s.callbacks.processingDroppedFiles(),n.dropDisabled(!0),e.files.length>1&&!s.allowMultipleItems?(s.callbacks.processingDroppedFilesComplete([]),s.callbacks.dropError("tooManyFilesError",""),n.dropDisabled(!1),o.failure()):(d=[],qq.isFolderDropSupported(e)?qq.each(e.items,function(e,n){var i=n.webkitGetAsEntry();i&&(i.isFile?d.push(n.getAsFile()):r.push(t(i).done(function(){r.pop(),0===r.length&&o.success()})))}):d=e.files,0===r.length&&o.success()),o}function i(e){var t=new qq.UploadDropZone({HIDE_ZONES_EVENT_NAME:l,element:e,onEnter:function(n){qq(e).addClass(s.classes.dropActive),n.stopPropagation()},onLeaveNotDescendants:function(n){qq(e).removeClass(s.classes.dropActive)},onDrop:function(e){o(e.dataTransfer,t).then(function(){n(d,t)},function(){s.callbacks.dropLog("Drop event DataTransfer parsing failed. No files will be uploaded.","error")})}});return p.addDisposer(function(){t.dispose()}),qq(e).hasAttribute(q)&&qq(e).hide(),f.push(t),t}function a(e){var n;return qq.each(e.dataTransfer.types,function(e,t){if("Files"===t)return n=!0,!1}),n}function u(e){return qq.firefox()?!e.relatedTarget:qq.safari()?e.x<0||e.y<0:0===e.x&&0===e.y}function c(){var e=s.dropZoneElements,n=function(){setTimeout(function(){qq.each(e,function(e,n){qq(n).hasAttribute(q)&&qq(n).hide(),qq(n).removeClass(s.classes.dropActive)})},10)};qq.each(e,function(n,t){var r=i(t);e.length&&qq.supportedFeatures.fileDrop&&p.attach(document,"dragenter",function(n){!r.dropDisabled()&&a(n)&&qq.each(e,function(e,n){n instanceof HTMLElement&&qq(n).hasAttribute(q)&&qq(n).css({display:"block"})})})}),p.attach(document,"dragleave",function(e){u(e)&&n()}),p.attach(qq(document).children()[0],"mouseenter",function(e){n()}),p.attach(document,"drop",function(e){e.preventDefault(),n()}),p.attach(document,l,n)}var s,l="qq-hidezones",q="qq-hide-dropzone",f=[],d=[],p=new qq.DisposeSupport;s={dropZoneElements:[],allowMultipleItems:!0,classes:{dropActive:null},callbacks:new qq.DragAndDrop.callbacks},qq.extend(s,e,!0),c(),qq.extend(this,{setupExtraDropzone:function(e){s.dropZoneElements.push(e),i(e)},removeDropzone:function(e){var n,t=s.dropZoneElements;for(n in t)if(t[n]===e)return t.splice(n,1)},dispose:function(){p.dispose(),qq.each(f,function(e,n){n.dispose()})}})},qq.DragAndDrop.callbacks=function(){"use strict";return{processingDroppedFiles:function(){},processingDroppedFilesComplete:function(e,n){},dropError:function(e,n){qq.log("Drag & drop error code '"+e+" with these specifics: '"+n+"'","error")},dropLog:function(e,n){qq.log(e,n)}}},qq.UploadDropZone=function(e){"use strict";function n(){return qq.safari()||qq.firefox()&&qq.windows()}function t(e){l||(n?q.attach(document,"dragover",function(e){e.preventDefault()}):q.attach(document,"dragover",function(e){e.dataTransfer&&(e.dataTransfer.dropEffect="none",e.preventDefault())}),l=!0)}function r(e){if(!qq.supportedFeatures.fileDrop)return!1;var n,t=e.dataTransfer,r=qq.safari();return n=!(!qq.ie()||!qq.supportedFeatures.fileDrop)||"none"!==t.effectAllowed,t&&n&&(t.files||!r&&t.types.contains&&t.types.contains("Files"))}function o(e){return void 0!==e&&(s=e),s}function i(){function e(){n=document.createEvent("Event"),n.initEvent(u.HIDE_ZONES_EVENT_NAME,!0,!0)}var n;if(window.CustomEvent)try{n=new CustomEvent(u.HIDE_ZONES_EVENT_NAME)}catch(n){e()}else e();document.dispatchEvent(n)}function a(){q.attach(c,"dragover",function(e){if(r(e)){var n=qq.ie()&&qq.supportedFeatures.fileDrop?null:e.dataTransfer.effectAllowed;"move"===n||"linkMove"===n?e.dataTransfer.dropEffect="move":e.dataTransfer.dropEffect="copy",e.stopPropagation(),e.preventDefault()}}),q.attach(c,"dragenter",function(e){if(!o()){if(!r(e))return;u.onEnter(e)}}),q.attach(c,"dragleave",function(e){if(r(e)){u.onLeave(e);var n=document.elementFromPoint(e.clientX,e.clientY);qq(this).contains(n)||u.onLeaveNotDescendants(e)}}),q.attach(c,"drop",function(e){if(!o()){if(!r(e))return;e.preventDefault(),e.stopPropagation(),u.onDrop(e),i()}})}var u,c,s,l,q=new qq.DisposeSupport;u={element:null,onEnter:function(e){},onLeave:function(e){},onLeaveNotDescendants:function(e){},onDrop:function(e){}},qq.extend(u,e),c=u.element,t(),a(),qq.extend(this,{dropDisabled:function(e){return o(e)},dispose:function(){q.dispose()},getElement:function(){return c}})}}(window);
//# sourceMappingURL=dnd.min.js.map