!function(e){"use strict";function r(){if(!e.trumbowyg&&!e.trumbowyg.addedXhrProgressEvent){var r=e.ajaxSettings.xhr;e.ajaxSetup({xhr:function(){var e=r(),o=this;return e&&"object"==typeof e.upload&&void 0!==o.progressUpload&&e.upload.addEventListener("progress",function(e){o.progressUpload(e)},!1),e}}),e.trumbowyg.addedXhrProgressEvent=!0}}r(),e.extend(!0,e.trumbowyg,{langs:{en:{upload:"Upload",file:"File",uploadError:"Error"},fr:{upload:"Envoi",file:"Fichier",uploadError:"Erreur"}},upload:{serverPath:"./src/plugins/upload/trumbowyg.upload.php"},opts:{btnsDef:{upload:{func:function(r,o){var a,t=o.o.prefix,n=o.openModalInsert(o.lang.upload,{file:{type:"file",required:!0},alt:{label:"description"}},function(){var r=new FormData;r.append("fileToUpload",a),0===e("."+t+"progress",n).length&&e("."+t+"modal-title",n).after(e("
",{"class":t+"progress"}).append(e("",{"class":t+"progress-bar"}))),e.ajax({url:e.trumbowyg.upload.serverPath,type:"POST",data:r,cache:!1,dataType:"json",processData:!1,contentType:!1,progressUpload:function(r){e("."+t+"progress-bar").stop().animate({width:Math.round(100*r.loaded/r.total)+"%"},200)},success:function(r){"uploadSuccess"==r.message?(o.execCmd("insertImage",r.file),setTimeout(function(){o.closeModal()},250)):o.addErrorOnModalField(e("input[type=file]",n),o.lang[r.message])},error:function(){o.addErrorOnModalField(e("input[type=file]",n),o.lang.uploadError)}})});e("input[type=file]").on("change",function(e){a=e.target.files[0]})}}}}})}(jQuery);