芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/media.2/system/js/fields/joomla-field-media-es5.min.js
!function(){"use strict";function t(t,e,i,n,o,r,s){try{var u=t[r](s),l=u.value}catch(t){return void i(t)}u.done?e(l):Promise.resolve(l).then(n,o)}function e(t,e){for(var i=0;i
1?e[1].split(/[?]/)[0].split(".").pop().trim():t.split(/[#?]/)[0].split(".").pop().trim();o.images.includes(u)&&(r="images"),o.audios.includes(u)&&(r="audios"),o.videos.includes(u)&&(r="videos"),o.documents.includes(u)&&(r="documents");var l={images:function(){o.images.includes(u)&&((s=new Image).src=/http/.test(n)?n:Joomla.getOptions("system.paths").rootFull+n,s.setAttribute("alt",""))},audios:function(){o.audios.includes(u)&&((s=document.createElement("audio")).src=/http/.test(n)?n:Joomla.getOptions("system.paths").rootFull+n,s.setAttribute("controls",""))},videos:function(){if(o.videos.includes(u)){s=document.createElement("video");var t=document.createElement("source");t.src=/http/.test(n)?n:Joomla.getOptions("system.paths").rootFull+n,t.type="video/"+u,s.setAttribute("controls",""),s.setAttribute("width",i.previewWidth),s.setAttribute("height",i.previewHeight),s.appendChild(t)}},documents:function(){o.documents.includes(u)&&((s=document.createElement("object")).data=/http/.test(n)?n:Joomla.getOptions("system.paths").rootFull+n,s.type="application/"+u,s.setAttribute("width",i.previewWidth),s.setAttribute("height",i.previewHeight))}};if(this.givenType&&["images","audios","videos","documents"].includes(this.givenType))l[this.givenType]();else{if(!r||!["images","audios","videos","documents"].includes(r))return;l[r]()}this.previewElement.style.width=this.previewWidth,this.previewElement.appendChild(s)}else this.buttonClearEl.style.display="none",this.previewElement.innerHTML=Joomla.sanitizeHtml('
')}},l=s,c=[{key:"observedAttributes",get:function(){return["type","base-path","root-folder","url","modal-container","modal-width","modal-height","input","button-select","button-clear","button-save-selected","preview","preview-width","preview-height"]}}],(a=[{key:"type",get:function(){return this.getAttribute("type")},set:function(t){this.setAttribute("type",t)}},{key:"basePath",get:function(){return this.getAttribute("base-path")},set:function(t){this.setAttribute("base-path",t)}},{key:"rootFolder",get:function(){return this.getAttribute("root-folder")},set:function(t){this.setAttribute("root-folder",t)}},{key:"url",get:function(){return this.getAttribute("url")},set:function(t){this.setAttribute("url",t)}},{key:"modalContainer",get:function(){return this.getAttribute("modal-container")},set:function(t){this.setAttribute("modal-container",t)}},{key:"input",get:function(){return this.getAttribute("input")},set:function(t){this.setAttribute("input",t)}},{key:"buttonSelect",get:function(){return this.getAttribute("button-select")},set:function(t){this.setAttribute("button-select",t)}},{key:"buttonClear",get:function(){return this.getAttribute("button-clear")},set:function(t){this.setAttribute("button-clear",t)}},{key:"buttonSaveSelected",get:function(){return this.getAttribute("button-save-selected")},set:function(t){this.setAttribute("button-save-selected",t)}},{key:"modalWidth",get:function(){return parseInt(this.getAttribute("modal-width"),10)},set:function(t){this.setAttribute("modal-width",t)}},{key:"modalHeight",get:function(){return parseInt(this.getAttribute("modal-height"),10)},set:function(t){this.setAttribute("modal-height",t)}},{key:"previewWidth",get:function(){return parseInt(this.getAttribute("preview-width"),10)},set:function(t){this.setAttribute("preview-width",t)}},{key:"previewHeight",get:function(){return parseInt(this.getAttribute("preview-height"),10)},set:function(t){this.setAttribute("preview-height",t)}},{key:"preview",get:function(){return this.getAttribute("preview")},set:function(t){this.setAttribute("preview",t)}},{key:"previewContainer",get:function(){return this.getAttribute("preview-container")}}])&&e(l.prototype,a),c&&e(l,c),s}(s(HTMLElement));customElements.define("joomla-field-media",l)}();