diff --git a/js/fileinput.js b/js/fileinput.js index fe7490f1..3b709695 100755 --- a/js/fileinput.js +++ b/js/fileinput.js @@ -1584,12 +1584,12 @@ var pct = 0, total = event.total, position = event.loaded || event.position; /** @namespace event.lengthComputable */ if (event.lengthComputable) { - pct = Math.ceil(position / total * 100); + pct = Math.floor(position / total * 100); } if (previewId) { self._setAsyncUploadStatus(previewId, pct, fileCount); } else { - self._setProgress(Math.ceil(pct)); + self._setProgress(pct); } }, false); } @@ -1754,7 +1754,7 @@ self.uploadCount = 0; self.uploadStatus = {}; self.uploadLog = []; - self._setProgress(100); + self._setProgress(101); }, 100); }; fnBefore = function (jqXHR) { @@ -1809,6 +1809,7 @@ $btnUpload.removeAttr('disabled'); $btnDelete.removeAttr('disabled'); $thumb.removeClass('file-uploading'); + self._setProgress(101, $('#' + previewId).find('.file-thumb-progress')); } if (!allFiles) { self.unlock(false); @@ -1916,7 +1917,7 @@ } }; fnComplete = function () { - self._setProgress(100); + self._setProgress(101); self.unlock(); self._initSuccessThumbs(); self._clearFileInput(); @@ -1976,7 +1977,7 @@ } }; fnComplete = function () { - self._setProgress(100); + self._setProgress(101); self.unlock(); self._clearFileInput(); self._raise('filebatchuploadcomplete', [self.filestack, self._getExtraData()]); @@ -2337,16 +2338,17 @@ }, _setProgressCancelled: function () { var self = this; - self._setProgress(100, self.$progress, self.msgCancelled); + self._setProgress(101, self.$progress, self.msgCancelled); }, _setProgress: function (p, $el, error) { var self = this, pct = Math.min(p, 100), template = pct < 100 ? self.progressTemplate : - (error ? self.progressErrorTemplate : self.progressCompleteTemplate), + (error ? self.progressErrorTemplate : (p <= 100 ? self.progressTemplate : self.progressCompleteTemplate)), pctLimit = self.progressUploadThreshold; $el = $el || self.$progress; if (!isEmpty(template)) { - if (pctLimit && pct > pctLimit) { - $el.html(template.replace('{percent}%', self.msgUploadThreshold).replace(/\{percent}/g, pctLimit)); + if (pctLimit && pct > pctLimit && p <= 100) { + var out = template.replace('{percent}', pctLimit).replace('{percent}', pctLimit).replace('{percent}%', self.msgUploadThreshold); + $el.html(out); } else { $el.html(template.replace(/\{percent}/g, pct)); } @@ -2378,7 +2380,7 @@ $.each(self.uploadStatus, function (key, value) { sum += value; }); - self._setProgress(Math.ceil(sum / total)); + self._setProgress(Math.floor(sum / total)); }, _validateMinCount: function () { @@ -2813,7 +2815,7 @@ data.abortData = self.ajaxAborted.data || {}; data.abortMessage = self.ajaxAborted.message; self.cancel(); - self._setProgress(100, self.$progress, self.msgCancelled); + self._setProgress(101, self.$progress, self.msgCancelled); self._showUploadError(self.ajaxAborted.message, data, 'filecustomerror'); return true; } @@ -3194,7 +3196,7 @@ progressClass: "progress-bar progress-bar-success progress-bar-striped active", progressCompleteClass: "progress-bar progress-bar-success", progressErrorClass: "progress-bar progress-bar-danger", - progressUploadThreshold: 95, + progressUploadThreshold: 99, previewFileType: 'image', elCaptionContainer: null, elCaptionText: null, diff --git a/js/fileinput.min.js b/js/fileinput.min.js index 0bdcae84..39123fc3 100755 --- a/js/fileinput.min.js +++ b/js/fileinput.min.js @@ -7,6 +7,7 @@ * * Licensed under the BSD 3-Clause * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md - */!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=e(require("jquery")):e(window.jQuery)}(function(e){"use strict";e.fn.fileinputLocales={},e.fn.fileinputThemes={};var t,i,a,n,r,l,o,s,d,c,p,u,f,m,g,v,h,w,b,_,C,x,y,T,F,k,E,$,S,I,P,D,z,A,U,j,L,Z,B,O,R,M,N,H,q,W,V,K,G,X,Y,J,Q,ee,te,ie,ae,ne,re,le,oe,se,de,ce,pe,ue,fe,me;t=".fileinput",i="kvFileinputModal",a='style="width:{width};height:{height};"',n='\n\n\n\n\n\n',r='
\n{previewFileIcon}\n
',l=window.URL||window.webkitURL,o=function(e,t,i){return void 0!==e&&(i?e===t:e.match(t))},s=function(e){if("Microsoft Internet Explorer"!==navigator.appName)return!1;if(10===e)return new RegExp("msie\\s"+e,"i").test(navigator.userAgent);var t,i=document.createElement("div");return i.innerHTML="",t=i.getElementsByTagName("i").length,document.body.appendChild(i),i.parentNode.removeChild(i),t},d=function(e,i,a,n){var r=n?i:i.split(" ").join(t+" ")+t;e.off(r).on(r,a)},c={data:{},init:function(e){var t=e.initialPreview,i=e.id;t.length>0&&!ne(t)&&(t=t.split(e.initialPreviewDelimiter)),c.data[i]={content:t,config:e.initialPreviewConfig,tags:e.initialPreviewThumbTags,delimiter:e.initialPreviewDelimiter,previewFileType:e.initialPreviewFileType,previewAsData:e.initialPreviewAsData,template:e.previewGenericTemplate,showZoom:e.fileActionSettings.showZoom,showDrag:e.fileActionSettings.showDrag,getSize:function(t){return e._getSize(t)},parseTemplate:function(t,i,a,n,r,l,o){var s=" file-preview-initial";return e._generatePreviewTemplate(t,i,a,n,r,!1,null,s,l,o)},msg:function(t){return e._getMsgSelected(t)},initId:e.previewInitId,footer:e._getLayoutTemplate("footer").replace(/\{progress}/g,e._renderThumbProgress()),isDelete:e.initialPreviewShowDelete,caption:e.initialCaption,actions:function(t,i,a,n,r,l,o){return e._renderFileActions(t,i,a,n,r,l,o,!0)}}},fetch:function(e){return c.data[e].content.filter(function(e){return null!==e})},count:function(e,t){return c.data[e]&&c.data[e].content?t?c.data[e].content.length:c.fetch(e).length:0},get:function(t,i,a){var n,r,l,o,s,d,p="init_"+i,u=c.data[t],f=u.config[i],m=u.content[i],g=u.initId+"-"+p,v=" file-preview-initial",h=re("previewAsData",f,u.previewAsData);return a=void 0===a?!0:a,m?(f&&f.frameClass&&(v+=" "+f.frameClass),h?(l=u.previewAsData?re("type",f,u.previewFileType||"generic"):"generic",o=re("caption",f),s=c.footer(t,i,a,f&&f.size||null),d=re("filetype",f,l),n=u.parseTemplate(l,m,o,d,g,s,p,null)):n=u.template.replace(/\{previewId}/g,g).replace(/\{frameClass}/g,v).replace(/\{fileindex}/g,p).replace(/\{content}/g,u.content[i]).replace(/\{template}/g,re("type",f,u.previewFileType)).replace(/\{footer}/g,c.footer(t,i,a,f&&f.size||null)),u.tags.length&&u.tags[i]&&(n=se(n,u.tags[i])),ae(f)||ae(f.frameAttr)||(r=e(document.createElement("div")).html(n),r.find(".file-preview-initial").attr(f.frameAttr),n=r.html(),r.remove()),n):""},add:function(t,i,a,n,r){var l,o=e.extend(!0,{},c.data[t]);return ne(i)||(i=i.split(o.delimiter)),r?(l=o.content.push(i)-1,o.config[l]=a,o.tags[l]=n):(l=i.length-1,o.content=i,o.config=a,o.tags=n),c.data[t]=o,l},set:function(t,i,a,n,r){var l,o,s=e.extend(!0,{},c.data[t]);if(i&&i.length&&(ne(i)||(i=i.split(s.delimiter)),o=i.filter(function(e){return null!==e}),o.length)){if(void 0===s.content&&(s.content=[]),void 0===s.config&&(s.config=[]),void 0===s.tags&&(s.tags=[]),r){for(l=0;lr;r++)i+=c.get(e,r);return t=a.msg(c.count(e)),{content:'
'+i+"
",caption:t}},footer:function(e,t,i,a){var n=c.data[e];if(i=void 0===i?!0:i,0===n.config.length||ae(n.config[t]))return"";var r=n.config[t],l=re("caption",r),o=re("width",r,"auto"),s=re("url",r,!1),d=re("key",r,null),p=re("showDelete",r,!0),u=re("showZoom",r,n.showZoom),f=re("showDrag",r,n.showDrag),m=s===!1&&i,g=n.isDelete?n.actions(!1,p,u,f,m,s,d):"",v=n.footer.replace(/\{actions}/g,g);return v.replace(/\{caption}/g,l).replace(/\{size}/g,n.getSize(a)).replace(/\{width}/g,o).replace(/\{indicator}/g,"").replace(/\{indicatorTitle}/g,"")}},p=function(e,t){return t=t||0,"number"==typeof e?e:("string"==typeof e&&(e=parseFloat(e)),isNaN(e)?t:e)},u=function(){return!(!window.File||!window.FileReader)},f=function(){var e=document.createElement("div");return!s(9)&&(void 0!==e.draggable||void 0!==e.ondragstart&&void 0!==e.ondrop)},m=function(){return u()&&window.FormData},g=function(e,t){e.removeClass(t).addClass(t)},G={showRemove:!0,showUpload:!0,showZoom:!0,showDrag:!0,removeIcon:'',removeClass:"btn btn-xs btn-default",removeTitle:"Remove file",uploadIcon:'',uploadClass:"btn btn-xs btn-default",uploadTitle:"Upload file",zoomIcon:'',zoomClass:"btn btn-xs btn-default",zoomTitle:"View Details",dragIcon:'',dragClass:"text-info",dragTitle:"Move / Rearrange",dragSettings:{},indicatorNew:'',indicatorSuccess:'',indicatorError:'',indicatorLoading:'',indicatorNewTitle:"Not uploaded yet",indicatorSuccessTitle:"Uploaded",indicatorErrorTitle:"Upload Error",indicatorLoadingTitle:"Uploading ..."},v='{preview}\n
\n
\n {caption}\n
\n {remove}\n {cancel}\n {upload}\n {browse}\n
\n
',h='{preview}\n
\n{remove}\n{cancel}\n{upload}\n{browse}\n',w='
\n {close}
\n
\n
\n
\n
\n
\n
',_='
×
\n',b='',C='
\n
\n
\n',x='',y='{icon} {label}',T='
{icon} {label}
',F='',k='\n',E='
\n
\n {percent}%\n
\n
',$="
({sizeText})",S='',I='
\n \n {drag}\n
{indicator}
\n
\n
',P='\n',D='',z='',A='{dragIcon}',U='
\n',L=U+' title="{caption}" '+a+'>
\n',Z="
{footer}\n
\n",B="{content}\n",O='
{data}
\n",R='{caption}\n",M='\n",N='\n",H='\n",q='\n'+n+" "+r+"\n\n",W='\n\n'+n+" "+r+"\n\n",V='\n',K='
\n'+r+"\n
\n",X={main1:v,main2:h,preview:w,close:_,fileIcon:b,caption:C,modalMain:F,modal:k,progress:E,size:$,footer:S,actions:I,actionDelete:P,actionUpload:D,actionZoom:z,actionDrag:A,btnDefault:x,btnLink:y,btnBrowse:T},Y={generic:j+B+Z,html:j+O+Z,image:j+R+Z,text:j+M+Z,video:L+N+Z,audio:L+H+Z,flash:L+q+Z,object:L+W+Z,pdf:L+V+Z,other:L+K+Z},Q=["image","html","text","video","audio","flash","pdf","object"],te={image:{width:"auto",height:"160px"},html:{width:"213px",height:"160px"},text:{width:"213px",height:"160px"},video:{width:"213px",height:"160px"},audio:{width:"213px",height:"80px"},flash:{width:"213px",height:"160px"},object:{width:"160px",height:"160px"},pdf:{width:"160px",height:"160px"},other:{width:"160px",height:"160px"}},J={image:{width:"100%",height:"100%"},html:{width:"100%",height:"100%","min-height":"480px"},text:{width:"100%",height:"100%","min-height":"480px"},video:{width:"auto",height:"100%","max-width":"100%"},audio:{width:"100%",height:"30px"},flash:{width:"auto",height:"480px"},object:{width:"auto",height:"100%","min-height":"480px"},pdf:{width:"100%",height:"100%","min-height":"480px"},other:{width:"auto",height:"100%","min-height":"480px"}},ie={image:function(e,t){return o(e,"image.*")||o(t,/\.(gif|png|jpe?g)$/i)},html:function(e,t){return o(e,"text/html")||o(t,/\.(htm|html)$/i)},text:function(e,t){return o(e,"text.*")||o(t,/\.(xml|javascript)$/i)||o(t,/\.(txt|md|csv|nfo|ini|json|php|js|css)$/i)},video:function(e,t){return o(e,"video.*")&&(o(e,/(ogg|mp4|mp?g|webm|3gp)$/i)||o(t,/\.(og?|mp4|webm|mp?g|3gp)$/i))},audio:function(e,t){return o(e,"audio.*")&&(o(t,/(ogg|mp3|mp?g|wav)$/i)||o(t,/\.(og?|mp3|mp?g|wav)$/i))},flash:function(e,t){return o(e,"application/x-shockwave-flash",!0)||o(t,/\.(swf)$/i)},pdf:function(e,t){return o(e,"application/pdf",!0)||o(t,/\.(pdf)$/i)},object:function(){return!0},other:function(){return!0}},ae=function(t,i){return void 0===t||null===t||0===t.length||i&&""===e.trim(t)},ne=function(e){return Array.isArray(e)||"[object Array]"===Object.prototype.toString.call(e)},re=function(e,t,i){return i=i||"",t&&"object"==typeof t&&e in t?t[e]:i},ee=function(t,i,a){return ae(t)||ae(t[i])?a:e(t[i])},le=function(){return Math.round((new Date).getTime()+100*Math.random())},oe=function(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")},se=function(t,i){var a=t;return i?(e.each(i,function(e,t){"function"==typeof t&&(t=t()),a=a.split(e).join(t)}),a):a},de=function(e){var t=e.is("img")?e.attr("src"):e.find("source").attr("src");l.revokeObjectURL(t)},ce=function(e){var t=e.lastIndexOf("/");return-1===t&&(t=e.lastIndexOf("\\")),e.split(e.substring(t,t+1)).pop()},pe=function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement},ue=function(e){e&&!pe()?document.documentElement.requestFullscreen?document.documentElement.requestFullscreen():document.documentElement.msRequestFullscreen?document.documentElement.msRequestFullscreen():document.documentElement.mozRequestFullScreen?document.documentElement.mozRequestFullScreen():document.documentElement.webkitRequestFullscreen&&document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},fe=function(e,t,i){if(i>=e.length)for(var a=i-e.length;a--+1;)e.push(void 0);return e.splice(i,0,e.splice(t,1)[0]),e},me=function(t,i){var a=this;a.$element=e(t),a._validate()&&(a.isPreviewable=u(),a.isIE9=s(9),a.isIE10=s(10),a.isPreviewable||a.isIE9?(a._init(i),a._listen()):a.$element.removeClass("file-loading"))},me.prototype={constructor:me,_init:function(t){var i,a=this,n=a.$element;e.each(t,function(e,t){switch(e){case"minFileCount":case"maxFileCount":case"maxFileSize":a[e]=p(t);break;default:a[e]=t}}),a.fileInputCleared=!1,a.fileBatchCompleted=!0,a.isPreviewable||(a.showPreview=!1),a.uploadFileAttr=ae(n.attr("name"))?"file_data":n.attr("name"),a.reader=null,a.formdata={},a.clearStack(),a.uploadCount=0,a.uploadStatus={},a.uploadLog=[],a.uploadAsyncCount=0,a.loadedImages=[],a.totalImagesCount=0,a.ajaxRequests=[],a.isError=!1,a.ajaxAborted=!1,a.cancelling=!1,i=a._getLayoutTemplate("progress"),a.progressTemplate=i.replace("{class}",a.progressClass),a.progressCompleteTemplate=i.replace("{class}",a.progressCompleteClass),a.progressErrorTemplate=i.replace("{class}",a.progressErrorClass),a.dropZoneEnabled=f()&&a.dropZoneEnabled,a.isDisabled=a.$element.attr("disabled")||a.$element.attr("readonly"),a.isUploadable=m()&&!ae(a.uploadUrl),a.isClickable=a.browseOnZoneClick&&a.showPreview&&(a.isUploadable&&a.dropZoneEnabled||!ae(a.defaultPreviewContent)),a.slug="function"==typeof t.slugCallback?t.slugCallback:a._slugDefault,a.mainTemplate=a.showCaption?a._getLayoutTemplate("main1"):a._getLayoutTemplate("main2"),a.captionTemplate=a._getLayoutTemplate("caption"),a.previewGenericTemplate=a._getPreviewTemplate("generic"),a.resizeImage&&(a.maxImageWidth||a.maxImageHeight)&&(a.imageCanvas=document.createElement("canvas"),a.imageCanvasContext=a.imageCanvas.getContext("2d")),ae(a.$element.attr("id"))&&a.$element.attr("id",le()),void 0===a.$container?a.$container=a._createContainer():a._refreshContainer(),a.$dropZone=a.$container.find(".file-drop-zone"),a.$progress=a.$container.find(".kv-upload-progress"),a.$btnUpload=a.$container.find(".fileinput-upload"),a.$captionContainer=ee(t,"elCaptionContainer",a.$container.find(".file-caption")),a.$caption=ee(t,"elCaptionText",a.$container.find(".file-caption-name")),a.$previewContainer=ee(t,"elPreviewContainer",a.$container.find(".file-preview")),a.$preview=ee(t,"elPreviewImage",a.$container.find(".file-preview-thumbnails")),a.$previewStatus=ee(t,"elPreviewStatus",a.$container.find(".file-preview-status")),a.$errorContainer=ee(t,"elErrorContainer",a.$previewContainer.find(".kv-fileinput-error")),ae(a.msgErrorClass)||g(a.$errorContainer,a.msgErrorClass),a.$errorContainer.hide(),a.fileActionSettings=e.extend(!0,G,t.fileActionSettings),a.previewInitId="preview-"+le(),a.id=a.$element.attr("id"),c.init(a),a._initPreview(!0),a._initPreviewActions(),a.options=t,a._setFileDropZoneTitle(),a.$element.removeClass("file-loading"),a.$element.attr("disabled")&&a.disable(),a._initZoom()},_validate:function(){var e,t=this;return"file"===t.$element.attr("type")?!0:(e='

Invalid Input Type

You must set an input type = file for bootstrap-fileinput plugin to initialize.
',t.$element.after(e),!1)},_errorsExist:function(){var t,i=this;return i.$errorContainer.find("li").length?!0:(t=e(document.createElement("div")).html(i.$errorContainer.html()),t.find("span.kv-error-close").remove(),t.find("ul").remove(),!!e.trim(t.text()).length)},_errorHandler:function(e,t){var i=this,a=e.target.error;a.code===a.NOT_FOUND_ERR?i._showError(i.msgFileNotFound.replace("{name}",t)):a.code===a.SECURITY_ERR?i._showError(i.msgFileSecured.replace("{name}",t)):a.code===a.NOT_READABLE_ERR?i._showError(i.msgFileNotReadable.replace("{name}",t)):a.code===a.ABORT_ERR?i._showError(i.msgFilePreviewAborted.replace("{name}",t)):i._showError(i.msgFilePreviewError.replace("{name}",t))},_addError:function(e){var t=this,i=t.$errorContainer;e&&i.length&&(i.html(t.errorCloseButton+e),d(i.find(".kv-error-close"),"click",function(){i.fadeOut("slow")}))},_resetErrors:function(e){var t=this,i=t.$errorContainer;t.isError=!1,t.$container.removeClass("has-error"),i.html(""),e?i.fadeOut("slow"):i.hide()},_showFolderError:function(e){var t,i=this,a=i.$errorContainer;e&&(t=i.msgFoldersNotAllowed.replace(/\{n}/g,e),i._addError(t),g(i.$container,"has-error"),a.fadeIn(800),i._raise("filefoldererror",[e,t]))},_showUploadError:function(e,t,i){var a=this,n=a.$errorContainer,r=i||"fileuploaderror",l=t&&t.id?'
  • '+e+"
  • ":"
  • "+e+"
  • ";return 0===n.find("ul").length?a._addError(""):n.find("ul").append(l),n.fadeIn(800),a._raise(r,[t,e]),a.$container.removeClass("file-input-new"),g(a.$container,"has-error"),!0},_showError:function(e,t,i){var a=this,n=a.$errorContainer,r=i||"fileerror";return t=t||{},t.reader=a.reader,a._addError(e),n.fadeIn(800),a._raise(r,[t,e]),a.isUploadable||a._clearFileInput(),a.$container.removeClass("file-input-new"),g(a.$container,"has-error"),a.$btnUpload.attr("disabled",!0),!0},_noFilesError:function(e){var t=this,i=t.minFileCount>1?t.filePlural:t.fileSingle,a=t.msgFilesTooLess.replace("{n}",t.minFileCount).replace("{files}",i),n=t.$errorContainer;t._addError(a),t.isError=!0,t._updateFileDetails(0),n.fadeIn(800),t._raise("fileerror",[e,a]),t._clearFileInput(),g(t.$container,"has-error")},_parseError:function(t,i,a){var n=this,r=e.trim(i+""),l="."===r.slice(-1)?"":".",o=void 0!==t.responseJSON&&void 0!==t.responseJSON.error?t.responseJSON.error:t.responseText;return n.cancelling&&n.msgUploadAborted&&(r=n.msgUploadAborted),n.showAjaxErrorDetails&&o?(o=e.trim(o.replace(/\n\s*\n/g,"\n")),o=o.length>0?"
    "+o+"
    ":"",r+=l+o):r+=l,n.cancelling=!1,a?""+a+": "+r:r},_parseFileType:function(e){var t,i,a,n,r=this;for(n=0;n-1&&(n=i.split(".").pop(),r.previewFileIconSettings&&r.previewFileIconSettings[n]&&(l=r.previewFileIconSettings[n]),r.previewFileExtSettings&&e.each(r.previewFileExtSettings,function(e,t){return r.previewFileIconSettings[e]&&t(n)?void(l=r.previewFileIconSettings[e]):void(a=!0)})),t.indexOf("{previewFileIcon}")>-1?t.replace(/\{previewFileIconClass}/g,r.previewFileIconClass).replace(/\{previewFileIcon}/g,l):t},_raise:function(t,i){var a=this,n=e.Event(t);if(void 0!==i?a.$element.trigger(n,i):a.$element.trigger(n),n.isDefaultPrevented())return!1;if(!n.result)return n.result;switch(t){case"filebatchuploadcomplete":case"filebatchuploadsuccess":case"fileuploaded":case"fileclear":case"filecleared":case"filereset":case"fileerror":case"filefoldererror":case"fileuploaderror":case"filebatchuploaderror":case"filedeleteerror":case"filecustomerror":case"filesuccessremove":break;default:a.ajaxAborted=n.result}return!0},_listenFullScreen:function(e){var t,i,a=this,n=a.$modal;n&&n.length&&(t=n&&n.find(".btn-fullscreen"),i=n&&n.find(".btn-borderless"),t.length&&i.length&&(t.removeClass("active").attr("aria-pressed","false"),i.removeClass("active").attr("aria-pressed","false"),e?t.addClass("active").attr("aria-pressed","true"):i.addClass("active").attr("aria-pressed","true"),n.hasClass("file-zoom-fullscreen")?a._maximizeZoomDialog():e?a._maximizeZoomDialog():i.removeClass("active").attr("aria-pressed","false")))},_listen:function(){var t=this,i=t.$element,a=i.closest("form"),n=t.$container;d(i,"change",e.proxy(t._change,t)),t.showBrowse&&d(t.$btnFile,"click",e.proxy(t._browse,t)),d(a,"reset",e.proxy(t.reset,t)),d(n.find(".fileinput-remove:not([disabled])"),"click",e.proxy(t.clear,t)),d(n.find(".fileinput-cancel"),"click",e.proxy(t.cancel,t)),t._initDragDrop(),t.isUploadable||d(a,"submit",e.proxy(t._submitForm,t)),d(t.$container.find(".fileinput-upload"),"click",e.proxy(t._uploadClick,t)),d(e(window),"resize",function(){t._listenFullScreen(screen.width===window.innerWidth&&screen.height===window.innerHeight)}),d(e(document),"webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange",function(){t._listenFullScreen(pe())}),t._initClickable()},_initClickable:function(){var t,i=this;i.isClickable&&(t=i.isUploadable?i.$dropZone:i.$preview.find(".file-default-preview"),g(t,"clickable"),t.attr("tabindex",-1),d(t,"click",function(a){var n=e(a.target);n.parents(".file-preview-thumbnails").length&&!n.parents(".file-default-preview").length||(i.$element.trigger("click"),t.blur())}))},_initDragDrop:function(){var t=this,i=t.$dropZone;t.isUploadable&&t.dropZoneEnabled&&t.showPreview&&(d(i,"dragenter dragover",e.proxy(t._zoneDragEnter,t)),d(i,"dragleave",e.proxy(t._zoneDragLeave,t)),d(i,"drop",e.proxy(t._zoneDrop,t)),d(e(document),"dragenter dragover drop",t._zoneDragDropInit))},_zoneDragDropInit:function(e){e.stopPropagation(),e.preventDefault()},_zoneDragEnter:function(t){var i=this,a=e.inArray("Files",t.originalEvent.dataTransfer.types)>-1;return i._zoneDragDropInit(t),i.isDisabled||!a?(t.originalEvent.dataTransfer.effectAllowed="none",void(t.originalEvent.dataTransfer.dropEffect="none")):void g(i.$dropZone,"file-highlighted")},_zoneDragLeave:function(e){var t=this;t._zoneDragDropInit(e),t.isDisabled||t.$dropZone.removeClass("file-highlighted")},_zoneDrop:function(e){var t=this;e.preventDefault(),t.isDisabled||ae(e.originalEvent.dataTransfer.files)||(t._change(e,"dragdrop"),t.$dropZone.removeClass("file-highlighted"))},_uploadClick:function(e){var t,i=this,a=i.$container.find(".fileinput-upload"),n=!a.hasClass("disabled")&&ae(a.attr("disabled"));if(!e||!e.isDefaultPrevented()){if(!i.isUploadable)return void(n&&"submit"!==a.attr("type")&&(t=a.closest("form"),t.length&&t.trigger("submit"),e.preventDefault()));e.preventDefault(),n&&i.upload()}},_submitForm:function(){var e=this,t=e.$element,i=t.get(0).files;return i&&e.minFileCount>0&&e._getFileCount(i.length)