diff --git a/CHANGE.md b/CHANGE.md index a2af3298..b81420fb 100755 --- a/CHANGE.md +++ b/CHANGE.md @@ -1,6 +1,12 @@ Change Log: `bootstrap-fileinput` ================================= +## version 4.3.7 + +**Date:** 24-Dec-2016 + +- (enh #816): New property `msgFileTypes` to control descriptions/localizations of file types displayed. + ## version 4.3.6 **Date:** 17-Dec-2016 diff --git a/README.md b/README.md index 5953ea3f..6f9c151c 100755 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ An enhanced HTML 5 file input for Bootstrap 3.x with file preview for various fi ![File Input Screenshot](https://lh3.googleusercontent.com/-3FiEmc_okc4/VBw_d2LBAJI/AAAAAAAAAL8/KbVj5X9Dus0/w596-h454-no/FileInput.jpg) -> NOTE: The latest version of the plugin is v4.3.6. Refer the [CHANGE LOG](https://github.com/kartik-v/bootstrap-fileinput/blob/master/CHANGE.md) for details. +> NOTE: The latest version of the plugin is v4.3.7 (under development). Refer the [CHANGE LOG](https://github.com/kartik-v/bootstrap-fileinput/blob/master/CHANGE.md) for details. ## Documentation and Demo diff --git a/bower.json b/bower.json index eb044129..343ac4a6 100755 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "bootstrap-fileinput", - "version": "4.3.6", + "version": "4.3.7", "homepage": "https://github.com/kartik-v/bootstrap-fileinput", "authors": [ "Kartik Visweswaran " diff --git a/css/fileinput.css b/css/fileinput.css index fac4293f..eca4e3c8 100755 --- a/css/fileinput.css +++ b/css/fileinput.css @@ -1,5 +1,5 @@ /*! - * bootstrap-fileinput v4.3.6 + * bootstrap-fileinput v4.3.7 * http://plugins.krajee.com/file-input * * Author: Kartik Visweswaran diff --git a/css/fileinput.min.css b/css/fileinput.min.css index f747a279..fff9f8af 100755 --- a/css/fileinput.min.css +++ b/css/fileinput.min.css @@ -1,5 +1,5 @@ /*! - * bootstrap-fileinput v4.3.6 + * bootstrap-fileinput v4.3.7 * http://plugins.krajee.com/file-input * * Author: Kartik Visweswaran diff --git a/examples/index.html b/examples/index.html index 32555ce5..d2b7a161 100755 --- a/examples/index.html +++ b/examples/index.html @@ -1,5 +1,5 @@ - + diff --git a/js/fileinput.js b/js/fileinput.js index 2ac60eee..3b0442df 100755 --- a/js/fileinput.js +++ b/js/fileinput.js @@ -1,5 +1,5 @@ /*! - * bootstrap-fileinput v4.3.6 + * bootstrap-fileinput v4.3.7 * http://plugins.krajee.com/file-input * * Author: Kartik Visweswaran @@ -2220,9 +2220,15 @@ var node = ctr + i, previewId = previewInitId + "-" + node, isText, isImage, file = files[i], fSizeKB, caption = file.name ? self.slug(file.name) : '', fileSize = (file.size || 0) / 1000, checkFile, fileExtExpr = '', previewData = objUrl.createObjectURL(file), fileCount = 0, j, msg, typ, chk, - fileTypes = self.allowedFileTypes, strTypes = isEmpty(fileTypes) ? '' : fileTypes.join(', '), + fileTypes = self.allowedFileTypes, typ1, typ2, strTypes = '', typLen = fileTypes ? fileTypes.length : 0, fileExt = self.allowedFileExtensions, strExt = isEmpty(fileExt) ? '' : fileExt.join(', '); - + if (typLen > 0) { + for (j = 0; j < typLen; j++) { + typ1 = fileTypes[j]; + typ2 = self.msgFileTypes[typ1] || typ1; + strTypes += j === 0 ? typ2 : ', ' + typ2; + } + } if (caption === false) { readFile(i + 1); return; @@ -3314,6 +3320,16 @@ msgInvalidFileName: 'Invalid or unsupported characters in file name "{name}".', msgInvalidFileType: 'Invalid type for file "{name}". Only "{types}" files are supported.', msgInvalidFileExtension: 'Invalid extension for file "{name}". Only "{extensions}" files are supported.', + msgFileTypes: { + 'image': 'image', + 'html': 'HTML', + 'text': 'text', + 'video': 'video', + 'audio': 'audio', + 'flash': 'flash', + 'pdf': 'PDF', + 'object': 'object' + }, msgUploadAborted: 'The file upload was aborted', msgUploadThreshold: 'Processing...', msgValidationError: 'Validation Error', diff --git a/js/fileinput.min.js b/js/fileinput.min.js index 6555192f..dcddbd2f 100755 --- a/js/fileinput.min.js +++ b/js/fileinput.min.js @@ -1,5 +1,5 @@ /*! - * bootstrap-fileinput v4.3.6 + * bootstrap-fileinput v4.3.7 * http://plugins.krajee.com/file-input * * Author: Kartik Visweswaran @@ -7,6 +7,6 @@ * * Licensed under the BSD 3-Clause * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md - */!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(window.jQuery)}(function(a){"use strict";a.fn.fileinputLocales={},a.fn.fileinputThemes={};var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,aa,ba,ca,da,ea,fa,ga,ha,ia,ja,ka,la,ma,na,oa,pa;b=".fileinput",c="kvFileinputModal",d=".file-preview-frame:visible",e='style="width:{width};height:{height};"',f='\n\n\n\n\n\n',g='
\n{previewFileIcon}\n
',h=window.URL||window.webkitURL,i=function(a,b,c){return void 0!==a&&(c?a===b:a.match(b))},j=function(a){if("Microsoft Internet Explorer"!==navigator.appName)return!1;if(10===a)return new RegExp("msie\\s"+a,"i").test(navigator.userAgent);var c,b=document.createElement("div");return b.innerHTML="",c=b.getElementsByTagName("i").length,document.body.appendChild(b),b.parentNode.removeChild(b),c},k=function(a,c,d,e){var f=e?c:c.split(" ").join(b+" ")+b;a.off(f).on(f,d)},l={data:{},init:function(a){var b=a.initialPreview,c=a.id;b.length>0&&!fa(b)&&(b=b.split(a.initialPreviewDelimiter)),l.data[c]={content:b,config:a.initialPreviewConfig,tags:a.initialPreviewThumbTags,delimiter:a.initialPreviewDelimiter,previewFileType:a.initialPreviewFileType,previewAsData:a.initialPreviewAsData,template:a.previewGenericTemplate,showZoom:a.fileActionSettings.showZoom,showDrag:a.fileActionSettings.showDrag,getSize:function(b){return a._getSize(b)},parseTemplate:function(b,c,d,e,f,g,h,i){var j=" file-preview-initial";return a._generatePreviewTemplate(b,c,d,e,f,!1,null,j,g,h,i)},msg:function(b){return a._getMsgSelected(b)},initId:a.previewInitId,footer:a._getLayoutTemplate("footer").replace(/\{progress}/g,a._renderThumbProgress()),isDelete:a.initialPreviewShowDelete,caption:a.initialCaption,actions:function(b,c,d,e,f,g,h){return a._renderFileActions(b,c,d,e,f,g,h,!0)}}},fetch:function(a){return l.data[a].content.filter(function(a){return null!==a})},count:function(a,b){return l.data[a]&&l.data[a].content?b?l.data[a].content.length:l.fetch(a).length:0},get:function(b,c,d){var j,k,m,n,o,p,e="init_"+c,f=l.data[b],g=f.config[c],h=f.content[c],i=f.initId+"-"+e,q=ga("previewAsData",g,f.previewAsData);return d=void 0===d||d,h?(m=ga("type",g,f.previewFileType||"generic"),o=ga("filename",g,ga("caption",g)),p=ga("filetype",g,m),n=l.footer(b,c,d,g&&g.size||null),j=q?f.parseTemplate(m,h,o,p,i,n,e):f.parseTemplate("generic",h,o,p,i,n,e,m).replace(/\{content}/g,f.content[c]),f.tags.length&&f.tags[c]&&(j=ja(j,f.tags[c])),ea(g)||ea(g.frameAttr)||(k=a(document.createElement("div")).html(j),k.find(".file-preview-initial").attr(g.frameAttr),j=k.html(),k.remove()),j):""},add:function(b,c,d,e,f){var h,g=a.extend(!0,{},l.data[b]);return fa(c)||(c=c.split(g.delimiter)),f?(h=g.content.push(c)-1,g.config[h]=d,g.tags[h]=e):(h=c.length-1,g.content=c,g.config=d,g.tags=e),l.data[b]=g,h},set:function(b,c,d,e,f){var h,i,g=a.extend(!0,{},l.data[b]);if(c&&c.length&&(fa(c)||(c=c.split(g.delimiter)),i=c.filter(function(a){return null!==a}),i.length)){if(void 0===g.content&&(g.content=[]),void 0===g.config&&(g.config=[]),void 0===g.tags&&(g.tags=[]),f){for(h=0;h'+b+"",caption:d}},footer:function(a,b,c,d){var e=l.data[a];if(c=void 0===c||c,!e||!e.config||0===e.config.length||ea(e.config[b]))return"";var f=e.config[b],g=ga("caption",f),h=ga("width",f,"auto"),i=ga("url",f,!1),j=ga("key",f,null),k=ga("showDelete",f,!0),m=ga("showZoom",f,e.showZoom),n=ga("showDrag",f,e.showDrag),o=i===!1&&c,p=e.isDelete?e.actions(!1,k,m,n,o,i,j):"",q=e.footer.replace(/\{actions}/g,p);return q.replace(/\{caption}/g,g).replace(/\{size}/g,e.getSize(d)).replace(/\{width}/g,h).replace(/\{indicator}/g,"").replace(/\{indicatorTitle}/g,"")}},m=function(a,b){return b=b||0,"number"==typeof a?a:("string"==typeof a&&(a=parseFloat(a)),isNaN(a)?b:a)},n=function(){return!(!window.File||!window.FileReader)},o=function(){var a=document.createElement("div");return!j(9)&&(void 0!==a.draggable||void 0!==a.ondragstart&&void 0!==a.ondrop)},p=function(){return n()&&window.FormData},q=function(a,b){a.removeClass(b).addClass(b)},Y={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 ..."},r='{preview}\n
\n
\n {caption}\n
\n {remove}\n {cancel}\n {upload}\n {browse}\n
\n
',s='{preview}\n
\n{remove}\n{cancel}\n{upload}\n{browse}\n',t='
\n {close}
\n
\n
\n
\n
\n
\n
',v='
×
\n',u='',w='
\n
\n
\n',x='',y='{icon} {label}',z='
{icon} {label}
',A='',B='\n',C='
\n
\n {percent}%\n
\n
',D="
({sizeText})",E='',F='
\n \n {drag}\n
{indicator}
\n
\n
',G='\n',H='',I='',J='{dragIcon}',K='
\n',M=K+' title="{caption}" '+e+'>
\n',N="
{footer}\n
\n",O="{content}\n",P='
{data}
\n",Q='{caption}\n",R='\n",S='\n",T='\n",U='\n'+f+" "+g+"\n\n",V='\n\n'+f+" "+g+"\n\n",W='\n',X='
\n'+g+"\n
\n",Z={main1:r,main2:s,preview:t,close:v,fileIcon:u,caption:w,modalMain:A,modal:B,progress:C,size:D,footer:E,actions:F,actionDelete:G,actionUpload:H,actionZoom:I,actionDrag:J,btnDefault:x,btnLink:y,btnBrowse:z},$={generic:L+O+N,html:L+P+N,image:L+Q+N,text:L+R+N,video:M+S+N,audio:M+T+N,flash:M+U+N,object:M+V+N,pdf:M+W+N,other:M+X+N},aa=["image","html","text","video","audio","flash","pdf","object"],ca={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"}},_={image:{width:"auto",height:"auto","max-width":"100%","max-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"}},da={image:function(a,b){return i(a,"image.*")||i(b,/\.(gif|png|jpe?g)$/i)},html:function(a,b){return i(a,"text/html")||i(b,/\.(htm|html)$/i)},text:function(a,b){return i(a,"text.*")||i(b,/\.(xml|javascript)$/i)||i(b,/\.(txt|md|csv|nfo|ini|json|php|js|css)$/i)},video:function(a,b){return i(a,"video.*")&&(i(a,/(ogg|mp4|mp?g|mov|webm|3gp)$/i)||i(b,/\.(og?|mp4|webm|mp?g|mov|3gp)$/i))},audio:function(a,b){return i(a,"audio.*")&&(i(b,/(ogg|mp3|mp?g|wav)$/i)||i(b,/\.(og?|mp3|mp?g|wav)$/i))},flash:function(a,b){return i(a,"application/x-shockwave-flash",!0)||i(b,/\.(swf)$/i)},pdf:function(a,b){return i(a,"application/pdf",!0)||i(b,/\.(pdf)$/i)},object:function(){return!0},other:function(){return!0}},ea=function(b,c){return void 0===b||null===b||0===b.length||c&&""===a.trim(b)},fa=function(a){return Array.isArray(a)||"[object Array]"===Object.prototype.toString.call(a)},ga=function(a,b,c){return c=c||"",b&&"object"==typeof b&&a in b?b[a]:c},ba=function(b,c,d){return ea(b)||ea(b[c])?d:a(b[c])},ha=function(){return Math.round((new Date).getTime()+100*Math.random())},ia=function(a){return a.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")},ja=function(b,c){var d=b;return c?(a.each(c,function(a,b){"function"==typeof b&&(b=b()),d=d.split(a).join(b)}),d):d},ka=function(a){var b=a.is("img")?a.attr("src"):a.find("source").attr("src");h.revokeObjectURL(b)},la=function(a){var b=a.lastIndexOf("/");return b===-1&&(b=a.lastIndexOf("\\")),a.split(a.substring(b,b+1)).pop()},ma=function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement},na=function(a){var b=document,c=b.documentElement;c&&a&&!ma()?c.requestFullscreen?c.requestFullscreen():c.msRequestFullscreen?c.msRequestFullscreen():c.mozRequestFullScreen?c.mozRequestFullScreen():c.webkitRequestFullscreen&&c.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):b.exitFullscreen?b.exitFullscreen():b.msExitFullscreen?b.msExitFullscreen():b.mozCancelFullScreen?b.mozCancelFullScreen():b.webkitExitFullscreen&&b.webkitExitFullscreen()},oa=function(a,b,c){if(c>=a.length)for(var d=c-a.length;d--+1;)a.push(void 0);return a.splice(c,0,a.splice(b,1)[0]),a},pa=function(b,c){var d=this;d.$element=a(b),d._validate()&&(d.isPreviewable=n(),d.isIE9=j(9),d.isIE10=j(10),d.isPreviewable||d.isIE9?(d._init(c),d._listen()):d.$element.removeClass("file-loading"))},pa.prototype={constructor:pa,_init:function(b){var e,c=this,d=c.$element;a.each(b,function(a,b){switch(a){case"minFileCount":case"maxFileCount":case"maxFileSize":c[a]=m(b);break;default:c[a]=b}}),c.fileInputCleared=!1,c.fileBatchCompleted=!0,c.isPreviewable||(c.showPreview=!1),c.uploadFileAttr=ea(d.attr("name"))?"file_data":d.attr("name"),c.reader=null,c.formdata={},c.clearStack(),c.uploadCount=0,c.uploadStatus={},c.uploadLog=[],c.uploadAsyncCount=0,c.loadedImages=[],c.totalImagesCount=0,c.ajaxRequests=[],c.isError=!1,c.ajaxAborted=!1,c.cancelling=!1,e=c._getLayoutTemplate("progress"),c.progressTemplate=e.replace("{class}",c.progressClass),c.progressCompleteTemplate=e.replace("{class}",c.progressCompleteClass),c.progressErrorTemplate=e.replace("{class}",c.progressErrorClass),c.dropZoneEnabled=o()&&c.dropZoneEnabled,c.isDisabled=c.$element.attr("disabled")||c.$element.attr("readonly"),c.isUploadable=p()&&!ea(c.uploadUrl),c.isClickable=c.browseOnZoneClick&&c.showPreview&&(c.isUploadable&&c.dropZoneEnabled||!ea(c.defaultPreviewContent)),c.slug="function"==typeof b.slugCallback?b.slugCallback:c._slugDefault,c.mainTemplate=c.showCaption?c._getLayoutTemplate("main1"):c._getLayoutTemplate("main2"),c.captionTemplate=c._getLayoutTemplate("caption"),c.previewGenericTemplate=c._getPreviewTemplate("generic"),c.resizeImage&&(c.maxImageWidth||c.maxImageHeight)&&(c.imageCanvas=document.createElement("canvas"),c.imageCanvasContext=c.imageCanvas.getContext("2d")),ea(c.$element.attr("id"))&&c.$element.attr("id",ha()),void 0===c.$container?c.$container=c._createContainer():c._refreshContainer(),c.$dropZone=c.$container.find(".file-drop-zone"),c.$progress=c.$container.find(".kv-upload-progress"),c.$btnUpload=c.$container.find(".fileinput-upload"),c.$captionContainer=ba(b,"elCaptionContainer",c.$container.find(".file-caption")),c.$caption=ba(b,"elCaptionText",c.$container.find(".file-caption-name")),c.$previewContainer=ba(b,"elPreviewContainer",c.$container.find(".file-preview")),c.$preview=ba(b,"elPreviewImage",c.$container.find(".file-preview-thumbnails")),c.$previewStatus=ba(b,"elPreviewStatus",c.$container.find(".file-preview-status")),c.$errorContainer=ba(b,"elErrorContainer",c.$previewContainer.find(".kv-fileinput-error")),ea(c.msgErrorClass)||q(c.$errorContainer,c.msgErrorClass),c.$errorContainer.hide(),c.fileActionSettings=a.extend(!0,Y,b.fileActionSettings),c.previewInitId="preview-"+ha(),c.id=c.$element.attr("id"),l.init(c),c._initPreview(!0),c._initPreviewActions(),c.options=b,c._setFileDropZoneTitle(),c.$element.removeClass("file-loading"),c.$element.attr("disabled")&&c.disable(),c._initZoom()},_log:function(a){var b=this,c=b.$element.attr("id");c&&(a='"'+c+'": '+a),"undefined"!=typeof window.console.log?window.console.log(a):window.alert(a)},_validate:function(){var a=this,b="file"===a.$element.attr("type");return b||a._log('The input "type" must be set to "file" for initializing the "bootstrap-fileinput" plugin.'),b},_errorsExist:function(){var c,b=this;return!!b.$errorContainer.find("li").length||(c=a(document.createElement("div")).html(b.$errorContainer.html()),c.find("span.kv-error-close").remove(),c.find("ul").remove(),!!a.trim(c.text()).length)},_errorHandler:function(a,b){var c=this,d=a.target.error;d.code===d.NOT_FOUND_ERR?c._showError(c.msgFileNotFound.replace("{name}",b)):d.code===d.SECURITY_ERR?c._showError(c.msgFileSecured.replace("{name}",b)):d.code===d.NOT_READABLE_ERR?c._showError(c.msgFileNotReadable.replace("{name}",b)):d.code===d.ABORT_ERR?c._showError(c.msgFilePreviewAborted.replace("{name}",b)):c._showError(c.msgFilePreviewError.replace("{name}",b))},_addError:function(a){var b=this,c=b.$errorContainer;a&&c.length&&(c.html(b.errorCloseButton+a),k(c.find(".kv-error-close"),"click",function(){c.fadeOut("slow")}))},_resetErrors:function(a){var b=this,c=b.$errorContainer;b.isError=!1,b.$container.removeClass("has-error"),c.html(""),a?c.fadeOut("slow"):c.hide()},_showFolderError:function(a){var d,b=this,c=b.$errorContainer;a&&(d=b.msgFoldersNotAllowed.replace(/\{n}/g,a),b._addError(d),q(b.$container,"has-error"),c.fadeIn(800),b._raise("filefoldererror",[a,d]))},_showUploadError:function(a,b,c){var d=this,e=d.$errorContainer,f=c||"fileuploaderror",g=b&&b.id?'
  • '+a+"
  • ":"
  • "+a+"
  • ";return 0===e.find("ul").length?d._addError("
      "+g+"
    "):e.find("ul").append(g),e.fadeIn(800),d._raise(f,[b,a]),d.$container.removeClass("file-input-new"),q(d.$container,"has-error"),!0},_showError:function(a,b,c){var d=this,e=d.$errorContainer,f=c||"fileerror";return b=b||{},b.reader=d.reader,d._addError(a),e.fadeIn(800),d._raise(f,[b,a]),d.isUploadable||d._clearFileInput(),d.$container.removeClass("file-input-new"),q(d.$container,"has-error"),d.$btnUpload.attr("disabled",!0),!0},_noFilesError:function(a){var b=this,c=b.minFileCount>1?b.filePlural:b.fileSingle,d=b.msgFilesTooLess.replace("{n}",b.minFileCount).replace("{files}",c),e=b.$errorContainer;b._addError(d),b.isError=!0,b._updateFileDetails(0),e.fadeIn(800),b._raise("fileerror",[a,d]),b._clearFileInput(),q(b.$container,"has-error")},_parseError:function(b,c,d){var e=this,f=a.trim(c+""),g="."===f.slice(-1)?"":".",h=void 0!==b.responseJSON&&void 0!==b.responseJSON.error?b.responseJSON.error:b.responseText;return e.cancelling&&e.msgUploadAborted&&(f=e.msgUploadAborted),e.showAjaxErrorDetails&&h?(h=a.trim(h.replace(/\n\s*\n/g,"\n")),h=h.length>0?"
    "+h+"
    ":"",f+=g+h):f+=g,e.cancelling=!1,d?""+d+": "+f:f},_parseFileType:function(a){var c,d,e,f,b=this;for(f=0;f-1&&(d=b.split(".").pop(),c.previewFileIconSettings&&c.previewFileIconSettings[d]&&(e=c.previewFileIconSettings[d]),c.previewFileExtSettings&&a.each(c.previewFileExtSettings,function(a,b){if(c.previewFileIconSettings[a]&&b(d))return void(e=c.previewFileIconSettings[a])})),e},_parseFilePreviewIcon:function(a,b){var c=this,d=c._getPreviewIcon(b)||c.previewFileIcon;return a.indexOf("{previewFileIcon}")>-1&&(a=a.replace(/\{previewFileIconClass}/g,c.previewFileIconClass).replace(/\{previewFileIcon}/g,d)),a},_raise:function(b,c){var d=this,e=a.Event(b);if(void 0!==c?d.$element.trigger(e,c):d.$element.trigger(e),e.isDefaultPrevented())return!1;if(!e.result)return e.result;switch(b){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:d.ajaxAborted=e.result}return!0},_listenFullScreen:function(a){var d,e,b=this,c=b.$modal;c&&c.length&&(d=c&&c.find(".btn-fullscreen"),e=c&&c.find(".btn-borderless"),d.length&&e.length&&(d.removeClass("active").attr("aria-pressed","false"),e.removeClass("active").attr("aria-pressed","false"),a?d.addClass("active").attr("aria-pressed","true"):e.addClass("active").attr("aria-pressed","true"),c.hasClass("file-zoom-fullscreen")?b._maximizeZoomDialog():a?b._maximizeZoomDialog():e.removeClass("active").attr("aria-pressed","false")))},_listen:function(){var b=this,c=b.$element,d=c.closest("form"),e=b.$container;k(c,"change",a.proxy(b._change,b)),b.showBrowse&&k(b.$btnFile,"click",a.proxy(b._browse,b)),k(d,"reset",a.proxy(b.reset,b)),k(e.find(".fileinput-remove:not([disabled])"),"click",a.proxy(b.clear,b)),k(e.find(".fileinput-cancel"),"click",a.proxy(b.cancel,b)),b._initDragDrop(),b.isUploadable||k(d,"submit",a.proxy(b._submitForm,b)),k(b.$container.find(".fileinput-upload"),"click",a.proxy(b._uploadClick,b)),k(a(window),"resize",function(){b._listenFullScreen(screen.width===window.innerWidth&&screen.height===window.innerHeight)}),k(a(document),"webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange",function(){b._listenFullScreen(ma())}),b._initClickable()},_initClickable:function(){var c,b=this;b.isClickable&&(c=b.isUploadable?b.$dropZone:b.$preview.find(".file-default-preview"),q(c,"clickable"),c.attr("tabindex",-1),k(c,"click",function(d){var e=a(d.target);e.parents(".file-preview-thumbnails").length&&!e.parents(".file-default-preview").length||(b.$element.trigger("click"),c.blur())}))},_initDragDrop:function(){var b=this,c=b.$dropZone;b.isUploadable&&b.dropZoneEnabled&&b.showPreview&&(k(c,"dragenter dragover",a.proxy(b._zoneDragEnter,b)),k(c,"dragleave",a.proxy(b._zoneDragLeave,b)),k(c,"drop",a.proxy(b._zoneDrop,b)),k(a(document),"dragenter dragover drop",b._zoneDragDropInit))},_zoneDragDropInit:function(a){a.stopPropagation(),a.preventDefault()},_zoneDragEnter:function(b){var c=this,d=a.inArray("Files",b.originalEvent.dataTransfer.types)>-1;return c._zoneDragDropInit(b),c.isDisabled||!d?(b.originalEvent.dataTransfer.effectAllowed="none",void(b.originalEvent.dataTransfer.dropEffect="none")):void q(c.$dropZone,"file-highlighted")},_zoneDragLeave:function(a){var b=this;b._zoneDragDropInit(a),b.isDisabled||b.$dropZone.removeClass("file-highlighted")},_zoneDrop:function(a){var b=this;a.preventDefault(),b.isDisabled||ea(a.originalEvent.dataTransfer.files)||(b._change(a,"dragdrop"),b.$dropZone.removeClass("file-highlighted"))},_uploadClick:function(a){var d,b=this,c=b.$container.find(".fileinput-upload"),e=!c.hasClass("disabled")&&ea(c.attr("disabled"));if(!a||!a.isDefaultPrevented()){if(!b.isUploadable)return void(e&&"submit"!==c.attr("type")&&(d=c.closest("form"),d.length&&d.trigger("submit"),a.preventDefault()));a.preventDefault(),e&&b.upload()}},_submitForm:function(){var a=this,b=a.$element,c=b.get(0).files;return c&&a.minFileCount>0&&a._getFileCount(c.length)