From 80c3579914a5308230ed9808a0e4054c582e2f65 Mon Sep 17 00:00:00 2001 From: Kartik Visweswaran Date: Wed, 1 Feb 2017 15:24:47 +0530 Subject: [PATCH] Updates to release v4.3.7 fix #662 fix #725 fix #852 --- CHANGE.md | 6 +++- js/fileinput.js | 73 ++++++++++++++++++++++++++++++++------------- js/fileinput.min.js | 6 ++-- 3 files changed, 60 insertions(+), 25 deletions(-) diff --git a/CHANGE.md b/CHANGE.md index 5f8b05de..789ff51b 100755 --- a/CHANGE.md +++ b/CHANGE.md @@ -3,7 +3,7 @@ Change Log: `bootstrap-fileinput` ## version 4.3.7 -**Date:** 17-Jan-2017 +**Date:** 01-Feb-2017 1. (enh #812): Update Greek Translations. 2. (enh #815): Enhance parsing of thumbnails that are visible in preview (will allow plugin to be @@ -24,6 +24,10 @@ Change Log: `bootstrap-fileinput` 16. (enh #837): Update Czech Translations. 17. (bug #839): Correct `initialPreview` generation and sortable behavior for async uploads. 18. (enh #844): Display zoom preview navigation buttons only when multiple files exist. +19. (enh #662, #725): Enhance preview modal to be appended to body before each zoom action (if `body` tag exists). +20. (enh #847): Update German Translations. +21. (enh #851): Create Kazakh Translations. +22. (bug #852): Ensure `frameClass` setting in `initialPreviewConfig` is considered. ## version 4.3.6 diff --git a/js/fileinput.js b/js/fileinput.js index dcbd7dd0..5ca15cdc 100755 --- a/js/fileinput.js +++ b/js/fileinput.js @@ -99,8 +99,8 @@ getSize: function (size) { return obj._getSize(size); }, - parseTemplate: function (cat, data, fname, ftype, pId, ftr, ind, tmpl) { - var fc = ' file-preview-initial ' + SORT_CSS; + parseTemplate: function (cat, data, fname, ftype, pId, ftr, ind, fc, tmpl) { + fc = ' file-preview-initial ' + SORT_CSS + (fc ? ' ' + fc : ''); return obj._generatePreviewTemplate(cat, data, fname, ftype, pId, false, null, fc, ftr, ind, tmpl); }, msg: function (n) { @@ -126,12 +126,9 @@ }, get: function (id, i, isDisabled) { var ind = 'init_' + i, data = previewCache.data[id], config = data.config[i], content = data.content[i], - previewId = data.initId + '-' + ind, out, $tmp, cat, ftr, fname, ftype, + previewId = data.initId + '-' + ind, out, $tmp, cat, ftr, fname, ftype, frameClass, asData = ifSet('previewAsData', config, data.previewAsData); isDisabled = isDisabled === undefined ? true : isDisabled; - /** @namespace config.frameAttr */ - /** @namespace config.frameClass */ - /** @namespace config.filetype */ if (!content) { return ''; } @@ -139,15 +136,17 @@ fname = ifSet('filename', config, ifSet('caption', config)); ftype = ifSet('filetype', config, cat); ftr = previewCache.footer(id, i, isDisabled, (config && config.size || null)); + frameClass = ifSet('frameClass', config); if (asData) { - out = data.parseTemplate(cat, content, fname, ftype, previewId, ftr, ind); + out = data.parseTemplate(cat, content, fname, ftype, previewId, ftr, ind, frameClass); } else { - out = data.parseTemplate('generic', content, fname, ftype, previewId, ftr, ind, cat) + out = data.parseTemplate('generic', content, fname, ftype, previewId, ftr, ind, frameClass, cat) .replace(/\{content}/g, data.content[i]); } if (data.tags.length && data.tags[i]) { out = replaceTags(out, data.tags[i]); } + /** @namespace config.frameAttr */ if (!isEmpty(config) && !isEmpty(config.frameAttr)) { $tmp = $(document.createElement('div')).html(out); $tmp.find('.file-preview-initial').attr(config.frameAttr); @@ -372,9 +371,9 @@ ' {percent}%\n' + ' \n' + ''; - tSize = '
({sizeText})'; + tSize = ' ({sizeText})'; tFooter = ''; tActions = '
\n' + @@ -1114,6 +1113,7 @@ out = previewCache.out(self.id); cap = isInit && self.initialCaption ? self.initialCaption : out.caption; self.$preview.html(out.content); + self._setInitThumbAttr(); self._setCaption(cap); self._initSortable(); if (!isEmpty(out.content)) { @@ -1256,12 +1256,14 @@ _setZoomContent: function ($frame, animate) { var self = this, $content, tmplt, body, title, $body, $dataEl, config, pid = $frame.attr('id'), $modal = self.$modal, $prev = $modal.find('.btn-prev'), $next = $modal.find('.btn-next'), $tmp, - $btnFull = $modal.find('.btn-fullscreen'), $btnBord = $modal.find('.btn-borderless'), - $btnTogh = $modal.find('.btn-toggleheader'),$zoomPreview = self.$preview.find('#zoom-' + pid); + $btnFull = $modal.find('.btn-fullscreen'), $btnBord = $modal.find('.btn-borderless'), cap, size, + $btnTogh = $modal.find('.btn-toggleheader'), $zoomPreview = self.$preview.find('#zoom-' + pid); tmplt = $zoomPreview.attr('data-template') || 'generic'; $content = $zoomPreview.find('.kv-file-content'); body = $content.length ? $content.html() : ''; - title = $zoomPreview.find('.file-footer-caption').text() || ''; + cap = $frame.data('caption') || ''; + size = $frame.data('size') || ''; + title = cap + ' ' + size; $modal.find('.kv-zoom-title').html(title); $body = $modal.find('.kv-zoom-body'); $modal.removeClass('kv-single-content'); @@ -1336,14 +1338,17 @@ }); }, _zoomPreview: function ($btn) { - var self = this, $frame; + var self = this, $frame, $body = $('body'), $modal = self.$modal; if (!$btn.length) { throw 'Cannot zoom to detailed preview!'; } - self.$modal.html(self._getModalContent()); + if ($body.length) { + $modal.appendTo($body); + } + $modal.html(self._getModalContent()); $frame = $btn.closest(FRAMES); self._setZoomContent($frame); - self.$modal.modal('show'); + $modal.modal('show'); self._initZoomButtons(); }, _zoomSlideShow: function (dir, previewId) { @@ -1535,6 +1540,7 @@ if (previewCache.count(self.id)) { out = previewCache.out(self.id); self.$preview.html(out.content); + self._setInitThumbAttr(); cap = self.initialCaption ? self.initialCaption : out.caption; self._setCaption(cap); } else { @@ -1569,6 +1575,7 @@ if (self._hasInitialPreview()) { out = previewCache.out(self.id); self.$preview.html(out.content); + self._setInitThumbAttr(); self._setCaption(out.caption); self._initPreviewActions(); } else { @@ -2193,11 +2200,13 @@ if (!self.showPreview) { return; } - var fname = file ? file.name : '', ftype = file ? file.type : '', content, - isError = isDisabled === true && !self.isUploadable, data = objUrl.createObjectURL(file); + var fname = file ? file.name : '', ftype = file ? file.type : '', content, size = file.size, + caption = self.slug(fname), isError = isDisabled === true && !self.isUploadable, + data = objUrl.createObjectURL(file); self._clearDefaultPreview(); - content = self._generatePreviewTemplate('other', data, fname, ftype, previewId, isError, file.size); + content = self._generatePreviewTemplate('other', data, fname, ftype, previewId, isError, size); $preview.append("\n" + content); + self._setFrameAttr(previewId, caption, size); if (isDisabled === true && self.isUploadable) { self._setThumbStatus($('#' + previewId), 'Error'); } @@ -2208,7 +2217,7 @@ } var self = this, cat = self._parseFileType(file), fname = file ? file.name : '', caption = self.slug(fname), types = self.allowedPreviewTypes, mimes = self.allowedPreviewMimeTypes, $preview = self.$preview, - chkTypes = types && types.indexOf(cat) >= 0, + chkTypes = types && types.indexOf(cat) >= 0, size = file.size, iData = (cat === 'text' || cat === 'html' || cat === 'image') ? theFile.target.result : data, content, chkMimes = mimes && mimes.indexOf(file.type) !== -1; /** @namespace window.DOMPurify */ @@ -2216,15 +2225,37 @@ iData = window.DOMPurify.sanitize(iData); } if (chkTypes || chkMimes) { - content = self._generatePreviewTemplate(cat, iData, fname, file.type, previewId, false, file.size); + content = self._generatePreviewTemplate(cat, iData, fname, file.type, previewId, false, size); self._clearDefaultPreview(); $preview.append("\n" + content); self._validateImage(previewId, caption, file.type); } else { self._previewDefault(file, previewId); } + self._setThumbAttr(previewId, caption, size); self._initSortable(); }, + _setThumbAttr: function (id, caption, size) { + var self = this, $frame = $('#' + id); + if ($frame.length) { + size = size && size > 0 ? self._getSize(size) : ''; + $frame.data({'caption': caption, 'size': size}); + } + }, + _setInitThumbAttr: function () { + var self = this, id = self.id, data = previewCache.data[id], len = previewCache.count(id, true), config, + caption, size, previewId; + if (len === 0) { + return; + } + for (var i = 0; i < len; i++) { + config = data.config[i]; + previewId = data.initId + '-' + 'init_' + i; + caption = ifSet('caption', config, ifSet('filename', config)); + size = ifSet('size', config); + self._setThumbAttr(previewId, caption, size); + } + }, _slugDefault: function (text) { return isEmpty(text) ? '' : String(text).replace(/[\-\[\]\/\{}:;#%=\(\)\*\+\?\\\^\$\|<>&"']/g, '_'); }, diff --git a/js/fileinput.min.js b/js/fileinput.min.js index a967d42f..1b53c6d3 100755 --- a/js/fileinput.min.js +++ b/js/fileinput.min.js @@ -7,6 +7,6 @@ * * 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 i,t,a,n,r,o,l,s,d,c,p,u,f,g,v,m,h,w,_,b,C,x,y,T,F,k,P,S,$,E,I,z,D,A,U,j,L,Z,B,O,R,M,N,H,q,W,K,V,G,X,Y,J,Q,ee,ie,te,ae,ne,re,oe,le,se,de,ce,pe,ue,fe,ge,ve,me;i=".fileinput",t="kvFileinputModal",a=".kv-preview-thumb",n="file-sortable",r='style="width:{width};height:{height};"',o='\n\n\n\n\n\n',l='
\n{previewFileIcon}\n
',s=window.URL||window.webkitURL,d=function(e,i,t){return void 0!==e&&(t?e===i:e.match(i))},p=function(e){if("Microsoft Internet Explorer"!==navigator.appName)return!1;if(10===e)return new RegExp("msie\\s"+e,"i").test(navigator.userAgent);var i,t=document.createElement("div");return t.innerHTML="",i=t.getElementsByTagName("i").length,document.body.appendChild(t),t.parentNode.removeChild(t),i},c=function(e,t,a,n){var r=n?t:t.split(" ").join(i+" ")+i;e.length&&e.off(r).on(r,a)},u={data:{},init:function(e){var i=e.initialPreview,t=e.id;i.length>0&&!oe(i)&&(i=i.split(e.initialPreviewDelimiter)),u.data[t]={content:i,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(i){return e._getSize(i)},parseTemplate:function(i,t,a,r,o,l,s,d){var c=" file-preview-initial "+n;return e._generatePreviewTemplate(i,t,a,r,o,!1,null,c,l,s,d)},msg:function(i){return e._getMsgSelected(i)},initId:e.previewInitId,footer:e._getLayoutTemplate("footer").replace(/\{progress}/g,e._renderThumbProgress()),isDelete:e.initialPreviewShowDelete,caption:e.initialCaption,actions:function(i,t,a,n,r,o,l){return e._renderFileActions(i,t,a,n,r,o,l,!0)}}},fetch:function(e){return u.data[e].content.filter(function(e){return null!==e})},count:function(e,i){return u.data[e]&&u.data[e].content?i?u.data[e].content.length:u.fetch(e).length:0},get:function(i,t,a){var n,r,o,l,s,d,c="init_"+t,p=u.data[i],f=p.config[t],g=p.content[t],v=p.initId+"-"+c,m=le("previewAsData",f,p.previewAsData);return a=void 0===a?!0:a,g?(o=le("type",f,p.previewFileType||"generic"),s=le("filename",f,le("caption",f)),d=le("filetype",f,o),l=u.footer(i,t,a,f&&f.size||null),n=m?p.parseTemplate(o,g,s,d,v,l,c):p.parseTemplate("generic",g,s,d,v,l,c,o).replace(/\{content}/g,p.content[t]),p.tags.length&&p.tags[t]&&(n=ce(n,p.tags[t])),re(f)||re(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(i,t,a,n,r){var o,l=e.extend(!0,{},u.data[i]);return oe(t)||(t=t.split(l.delimiter)),r?(o=l.content.push(t)-1,l.config[o]=a,l.tags[o]=n):(o=t.length-1,l.content=t,l.config=a,l.tags=n),u.data[i]=l,o},set:function(i,t,a,n,r){var o,l,s=e.extend(!0,{},u.data[i]);if(t&&t.length&&(oe(t)||(t=t.split(s.delimiter)),l=t.filter(function(e){return null!==e}),l.length)){if(void 0===s.content&&(s.content=[]),void 0===s.config&&(s.config=[]),void 0===s.tags&&(s.tags=[]),r){for(o=0;or;r++)t+=u.get(e,r);return i=a.msg(u.count(e)),{content:t,caption:i}},footer:function(e,i,t,a){var n=u.data[e];if(t=void 0===t?!0:t,!n||!n.config||0===n.config.length||re(n.config[i]))return"";var r=n.config[i],o=le("caption",r),l=le("width",r,"auto"),s=le("url",r,!1),d=le("key",r,null),c=le("showDelete",r,!0),p=le("showZoom",r,n.showZoom),f=le("showDrag",r,n.showDrag),g=s===!1&&t,v=n.isDelete?n.actions(!1,c,p,f,g,s,d):"",m=n.footer.replace(/\{actions}/g,v);return m.replace(/\{caption}/g,o).replace(/\{size}/g,n.getSize(a)).replace(/\{width}/g,l).replace(/\{indicator}/g,"").replace(/\{indicatorTitle}/g,"")}},f=function(e,i){return i=i||0,"number"==typeof e?e:("string"==typeof e&&(e=parseFloat(e)),isNaN(e)?i:e)},g=function(){return!(!window.File||!window.FileReader)},v=function(){var e=document.createElement("div");return!p(9)&&(void 0!==e.draggable||void 0!==e.ondragstart&&void 0!==e.ondrop)},m=function(){return g()&&window.FormData},h=function(e,i){e.removeClass(i).addClass(i)},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 ..."},w='{preview}\n
\n
\n {caption}\n
\n {remove}\n {cancel}\n {upload}\n {browse}\n
\n
',_='{preview}\n
\n{remove}\n{cancel}\n{upload}\n{browse}\n',b='
\n {close}
\n
\n
\n
\n
\n
\n
',x='
×
\n',C='',y='
\n
\n
\n',T='',F='{icon} {label}',k='
{icon} {label}
',P='',S='\n',$='
\n
\n {percent}%\n
\n
',E="
({sizeText})",I='',z='
\n \n {drag}\n
{indicator}
\n
\n
',D='\n',A='',U='',j='{dragIcon}',L='
\n',B=L+' title="{caption}" '+r+'>
\n',O="
{footer}\n
\n",R="{content}\n",M='
{data}
\n",N='{caption}\n",H='\n",q='\n",W='\n",K='\n'+o+" "+l+"\n\n",V='\n\n'+o+" "+l+"\n\n",G='\n',X='
\n'+l+"\n
\n",J={main1:w,main2:_,preview:b,close:x,fileIcon:C,caption:y,modalMain:P,modal:S,progress:$,size:E,footer:I,actions:z,actionDelete:D,actionUpload:A,actionZoom:U,actionDrag:j,btnDefault:T,btnLink:F,btnBrowse:k},Q={generic:Z+R+O,html:Z+M+O,image:Z+N+O,text:Z+H+O,video:B+q+O,audio:B+W+O,flash:B+K+O,object:B+V+O,pdf:B+G+O,other:B+X+O},ie=["image","html","text","video","audio","flash","pdf","object"],ae={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"}},ee={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"}},ne={image:function(e,i){return d(e,"image.*")||d(i,/\.(gif|png|jpe?g)$/i)},html:function(e,i){return d(e,"text/html")||d(i,/\.(htm|html)$/i)},text:function(e,i){return d(e,"text.*")||d(i,/\.(xml|javascript)$/i)||d(i,/\.(txt|md|csv|nfo|ini|json|php|js|css)$/i)},video:function(e,i){return d(e,"video.*")&&(d(e,/(ogg|mp4|mp?g|mov|webm|3gp)$/i)||d(i,/\.(og?|mp4|webm|mp?g|mov|3gp)$/i))},audio:function(e,i){return d(e,"audio.*")&&(d(i,/(ogg|mp3|mp?g|wav)$/i)||d(i,/\.(og?|mp3|mp?g|wav)$/i))},flash:function(e,i){return d(e,"application/x-shockwave-flash",!0)||d(i,/\.(swf)$/i)},pdf:function(e,i){return d(e,"application/pdf",!0)||d(i,/\.(pdf)$/i)},object:function(){return!0},other:function(){return!0}},re=function(i,t){return void 0===i||null===i||0===i.length||t&&""===e.trim(i)},oe=function(e){return Array.isArray(e)||"[object Array]"===Object.prototype.toString.call(e)},le=function(e,i,t){return t=t||"",i&&"object"==typeof i&&e in i?i[e]:t},te=function(i,t,a){return re(i)||re(i[t])?a:e(i[t])},se=function(){return Math.round((new Date).getTime()+100*Math.random())},de=function(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")},ce=function(i,t){var a=i;return t?(e.each(t,function(e,i){"function"==typeof i&&(i=i()),a=a.split(e).join(i)}),a):a},pe=function(e){var i=e.is("img")?e.attr("src"):e.find("source").attr("src");s.revokeObjectURL(i)},ue=function(e){var i=e.lastIndexOf("/");return-1===i&&(i=e.lastIndexOf("\\")),e.split(e.substring(i,i+1)).pop()},fe=function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement},ge=function(e){var i=document,t=i.documentElement;t&&e&&!fe()?t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):i.exitFullscreen?i.exitFullscreen():i.msExitFullscreen?i.msExitFullscreen():i.mozCancelFullScreen?i.mozCancelFullScreen():i.webkitExitFullscreen&&i.webkitExitFullscreen()},ve=function(e,i,t){if(t>=e.length)for(var a=t-e.length;a--+1;)e.push(void 0);return e.splice(t,0,e.splice(i,1)[0]),e},me=function(i,t){var a=this;a.$element=e(i),a._validate()&&(a.isPreviewable=g(),a.isIE9=p(9),a.isIE10=p(10),a.isPreviewable||a.isIE9?(a._init(t),a._listen()):a.$element.removeClass("file-loading"))},me.prototype={constructor:me,_init:function(i){var t,a=this,n=a.$element;e.each(i,function(e,i){switch(e){case"minFileCount":case"maxFileCount":case"maxFileSize":a[e]=f(i);break;default:a[e]=i}}),a.fileInputCleared=!1,a.fileBatchCompleted=!0,a.isPreviewable||(a.showPreview=!1),void 0===a.allowedPreviewTypes&&(a.allowedPreviewTypes=ie),a.uploadFileAttr=re(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,t=a._getLayoutTemplate("progress"),a.progressTemplate=t.replace("{class}",a.progressClass),a.progressCompleteTemplate=t.replace("{class}",a.progressCompleteClass),a.progressErrorTemplate=t.replace("{class}",a.progressErrorClass),a.dropZoneEnabled=v()&&a.dropZoneEnabled,a.isDisabled=a.$element.attr("disabled")||a.$element.attr("readonly"),a.isUploadable=m()&&!re(a.uploadUrl),a.isClickable=a.browseOnZoneClick&&a.showPreview&&(a.isUploadable&&a.dropZoneEnabled||!re(a.defaultPreviewContent)),a.slug="function"==typeof i.slugCallback?i.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")),re(a.$element.attr("id"))&&a.$element.attr("id",se()),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=te(i,"elCaptionContainer",a.$container.find(".file-caption")),a.$caption=te(i,"elCaptionText",a.$container.find(".file-caption-name")),a.$previewContainer=te(i,"elPreviewContainer",a.$container.find(".file-preview")),a.$preview=te(i,"elPreviewImage",a.$container.find(".file-preview-thumbnails")),a.$previewStatus=te(i,"elPreviewStatus",a.$container.find(".file-preview-status")),a.$errorContainer=te(i,"elErrorContainer",a.$previewContainer.find(".kv-fileinput-error")),re(a.msgErrorClass)||h(a.$errorContainer,a.msgErrorClass),a.$errorContainer.hide(),a.fileActionSettings=e.extend(!0,Y,i.fileActionSettings),a.previewInitId="preview-"+se(),a.id=a.$element.attr("id"),u.init(a),a._initPreview(!0),a._initPreviewActions(),a.options=i,a._setFileDropZoneTitle(),a.$element.removeClass("file-loading"),a.$element.attr("disabled")&&a.disable(),a._initZoom()},_log:function(e){var i=this,t=i.$element.attr("id");t&&(e='"'+t+'": '+e),"undefined"!=typeof window.console.log?window.console.log(e):window.alert(e)},_validate:function(){var e=this,i="file"===e.$element.attr("type");return i||e._log('The input "type" must be set to "file" for initializing the "bootstrap-fileinput" plugin.'),i},_errorsExist:function(){var i,t=this;return t.$errorContainer.find("li").length?!0:(i=e(document.createElement("div")).html(t.$errorContainer.html()),i.find("span.kv-error-close").remove(),i.find("ul").remove(),!!e.trim(i.text()).length)},_errorHandler:function(e,i){var t=this,a=e.target.error;a.code===a.NOT_FOUND_ERR?t._showError(t.msgFileNotFound.replace("{name}",i)):a.code===a.SECURITY_ERR?t._showError(t.msgFileSecured.replace("{name}",i)):a.code===a.NOT_READABLE_ERR?t._showError(t.msgFileNotReadable.replace("{name}",i)):a.code===a.ABORT_ERR?t._showError(t.msgFilePreviewAborted.replace("{name}",i)):t._showError(t.msgFilePreviewError.replace("{name}",i))},_addError:function(e){var i=this,t=i.$errorContainer;e&&t.length&&(t.html(i.errorCloseButton+e),c(t.find(".kv-error-close"),"click",function(){t.fadeOut("slow")}))},_resetErrors:function(e){var i=this,t=i.$errorContainer;i.isError=!1,i.$container.removeClass("has-error"),t.html(""),e?t.fadeOut("slow"):t.hide()},_showFolderError:function(e){var i,t=this,a=t.$errorContainer;e&&(i=t.msgFoldersNotAllowed.replace(/\{n}/g,e),t._addError(i),h(t.$container,"has-error"),a.fadeIn(800),t._raise("filefoldererror",[e,i]))},_showUploadError:function(e,i,t){var a=this,n=a.$errorContainer,r=t||"fileuploaderror",o=i&&i.id?'
  • '+e+"
  • ":"
  • "+e+"
  • ";return 0===n.find("ul").length?a._addError("
      "+o+"
    "):n.find("ul").append(o),n.fadeIn(800),a._raise(r,[i,e]),a.$container.removeClass("file-input-new"),h(a.$container,"has-error"),!0},_showError:function(e,i,t){var a=this,n=a.$errorContainer,r=t||"fileerror";return i=i||{},i.reader=a.reader,a._addError(e),n.fadeIn(800),a._raise(r,[i,e]),a.isUploadable||a._clearFileInput(),a.$container.removeClass("file-input-new"),h(a.$container,"has-error"),a.$btnUpload.attr("disabled",!0),!0},_noFilesError:function(e){var i=this,t=i.minFileCount>1?i.filePlural:i.fileSingle,a=i.msgFilesTooLess.replace("{n}",i.minFileCount).replace("{files}",t),n=i.$errorContainer;i._addError(a),i.isError=!0,i._updateFileDetails(0),n.fadeIn(800),i._raise("fileerror",[e,a]),i._clearFileInput(),h(i.$container,"has-error")},_parseError:function(i,t,a){var n=this,r=e.trim(t+""),o="."===r.slice(-1)?"":".",l=void 0!==i.responseJSON&&void 0!==i.responseJSON.error?i.responseJSON.error:i.responseText;return n.cancelling&&n.msgUploadAborted&&(r=n.msgUploadAborted),n.showAjaxErrorDetails&&l?(l=e.trim(l.replace(/\n\s*\n/g,"\n")),l=l.length>0?"
    "+l+"
    ":"",r+=o+l):r+=o,n.cancelling=!1,a?""+a+": "+r:r},_parseFileType:function(e){var i,t,a,n,r=this;for(n=0;n-1&&(t=i.split(".").pop(),a.previewFileIconSettings&&a.previewFileIconSettings[t]&&(n=a.previewFileIconSettings[t]),a.previewFileExtSettings&&e.each(a.previewFileExtSettings,function(e,i){return a.previewFileIconSettings[e]&&i(t)?void(n=a.previewFileIconSettings[e]):void 0})),n},_parseFilePreviewIcon:function(e,i){var t=this,a=t._getPreviewIcon(i)||t.previewFileIcon;return e.indexOf("{previewFileIcon}")>-1&&(e=e.replace(/\{previewFileIconClass}/g,t.previewFileIconClass).replace(/\{previewFileIcon}/g,a)),e},_raise:function(i,t){var a=this,n=e.Event(i);if(void 0!==t?a.$element.trigger(n,t):a.$element.trigger(n),n.isDefaultPrevented())return!1;if(!n.result)return n.result;switch(i){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 i,t,a=this,n=a.$modal;n&&n.length&&(i=n&&n.find(".btn-fullscreen"),t=n&&n.find(".btn-borderless"),i.length&&t.length&&(i.removeClass("active").attr("aria-pressed","false"),t.removeClass("active").attr("aria-pressed","false"),e?i.addClass("active").attr("aria-pressed","true"):t.addClass("active").attr("aria-pressed","true"),n.hasClass("file-zoom-fullscreen")?a._maximizeZoomDialog():e?a._maximizeZoomDialog():t.removeClass("active").attr("aria-pressed","false")))},_listen:function(){var i=this,t=i.$element,a=t.closest("form"),n=i.$container;c(t,"change",e.proxy(i._change,i)),i.showBrowse&&c(i.$btnFile,"click",e.proxy(i._browse,i)),c(a,"reset",e.proxy(i.reset,i)),c(n.find(".fileinput-remove:not([disabled])"),"click",e.proxy(i.clear,i)),c(n.find(".fileinput-cancel"),"click",e.proxy(i.cancel,i)),i._initDragDrop(),i.isUploadable||c(a,"submit",e.proxy(i._submitForm,i)),c(i.$container.find(".fileinput-upload"),"click",e.proxy(i._uploadClick,i)),c(e(window),"resize",function(){i._listenFullScreen(screen.width===window.innerWidth&&screen.height===window.innerHeight)}),c(e(document),"webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange",function(){i._listenFullScreen(fe())}),i._initClickable()},_initClickable:function(){var i,t=this;t.isClickable&&(i=t.isUploadable?t.$dropZone:t.$preview.find(".file-default-preview"),h(i,"clickable"),i.attr("tabindex",-1),c(i,"click",function(a){var n=e(a.target);n.parents(".file-preview-thumbnails").length&&!n.parents(".file-default-preview").length||(t.$element.trigger("click"),i.blur())}))},_initDragDrop:function(){var i=this,t=i.$dropZone;i.isUploadable&&i.dropZoneEnabled&&i.showPreview&&(c(t,"dragenter dragover",e.proxy(i._zoneDragEnter,i)),c(t,"dragleave",e.proxy(i._zoneDragLeave,i)),c(t,"drop",e.proxy(i._zoneDrop,i)),c(e(document),"dragenter dragover drop",i._zoneDragDropInit))},_zoneDragDropInit:function(e){e.stopPropagation(),e.preventDefault()},_zoneDragEnter:function(i){var t=this,a=e.inArray("Files",i.originalEvent.dataTransfer.types)>-1;return t._zoneDragDropInit(i),t.isDisabled||!a?(i.originalEvent.dataTransfer.effectAllowed="none",void(i.originalEvent.dataTransfer.dropEffect="none")):void h(t.$dropZone,"file-highlighted")},_zoneDragLeave:function(e){var i=this;i._zoneDragDropInit(e),i.isDisabled||i.$dropZone.removeClass("file-highlighted")},_zoneDrop:function(e){var i=this;e.preventDefault(),i.isDisabled||re(e.originalEvent.dataTransfer.files)||(i._change(e,"dragdrop"),i.$dropZone.removeClass("file-highlighted"))},_uploadClick:function(e){var i,t=this,a=t.$container.find(".fileinput-upload"),n=!a.hasClass("disabled")&&re(a.attr("disabled"));if(!e||!e.isDefaultPrevented()){if(!t.isUploadable)return void(n&&"submit"!==a.attr("type")&&(i=a.closest("form"),i.length&&i.trigger("submit"),e.preventDefault()));e.preventDefault(),n&&t.upload()}},_submitForm:function(){var e=this,i=e.$element,t=i.get(0).files;return t&&e.minFileCount>0&&e._getFileCount(t.length)