%PDF- %PDF-
Direktori : /home1/lightco1/public_html/media/editors/tinymce/js/plugins/dragdrop/ |
Current File : //home1/lightco1/public_html/media/editors/tinymce/js/plugins/dragdrop/plugin.min.js |
tinymce.PluginManager.add("jdragdrop",function(e){function t(t){var r=new FormData;r.append("Filedata",t),r.append("folder",tinyMCE.activeEditor.settings.mediaUploadPath);var n=new XMLHttpRequest;n.upload.onprogress=function(e){var t=e.loaded/e.total*100;document.querySelector(".bar").style.width=t+"%"},removeProgessBar=function(){setTimeout(function(){var t=document.querySelector("#jloader");t.parentNode.removeChild(t),e.contentAreaContainer.style.borderWidth="1px 0 0 0"},200)},n.onload=function(){var t=JSON.parse(n.responseText);if(200==n.status){if("0"==t.status&&(removeProgessBar(),e.windowManager.alert(t.message+": "+tinyMCE.activeEditor.settings.setCustomDir+t.location)),"1"==t.status){removeProgessBar();var r=tinyMCE.activeEditor.getDoc().createElement("img");r.src=tinyMCE.activeEditor.settings.setCustomDir+t.location,tinyMCE.activeEditor.execCommand("mceInsertContent",!1,r.outerHTML)}}else removeProgessBar()},n.onerror=function(){removeProgessBar()},n.open("POST",tinyMCE.activeEditor.settings.uploadUri,!0),n.send(r)}tinyMCE.DOM.bind(document,"dragleave",function(e){return e.stopPropagation(),e.preventDefault(),tinyMCE.activeEditor.contentAreaContainer.style.borderWidth="1px 0 0",!1}),"undefined"!=typeof FormData?(e.on("dragenter",function(e){return e.stopPropagation(),!1}),e.on("dragover",function(t){return t.preventDefault(),e.contentAreaContainer.style.borderStyle="dashed",e.contentAreaContainer.style.borderWidth="5px",!1}),e.on("drop",function(r){if(r.dataTransfer&&r.dataTransfer.files&&r.dataTransfer.files.length>0)for(var n,a=0;n=r.dataTransfer.files[a];a++){if(n.name.toLowerCase().match(/\.(jpg|jpeg|png|gif)$/)){var o,i,s="";(o=document.createElement("div")).id="jloader",(i=document.createElement("div")).classList.add("progress"),i.classList.add("progress-success"),i.classList.add("progress-striped"),i.classList.add("active"),i.style.width="100%",i.style.height="30px",(s=document.createElement("div")).classList.add("bar"),s.style.width="0",i.appendChild(s),o.appendChild(i),document.querySelector(".mce-toolbar-grp").appendChild(o),t(n)}r.preventDefault()}e.contentAreaContainer.style.borderWidth="1px 0 0"})):(Joomla.renderMessages({error:[Joomla.JText._("PLG_TINY_ERR_UNSUPPORTEDBROWSER")]}),e.on("drop",function(e){return e.preventDefault(),!1}))});