CoreFiles by mySites.guru
joomla-field-media-es5.min.js1 lines, 7,108 bytes, from Joomla_4.0.0-alpha3-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha2
md5
1b28149319455ab6ad43b655a3dc5d0a
sha1
e314223a263e3635515069c5de773e808e270988
sha256
2f1e95181097f32c313e077307db2326617dde970e51a585ed37871ec0eaa6ce
!function(){return function t(e,i,n){function r(u,s){if(!i[u]){if(!e[u]){var a="function"==typeof require&&require;if(!s&&a)return a(u,!0);if(o)return o(u,!0);var l=new Error("Cannot find module '"+u+"'");throw l.code="MODULE_NOT_FOUND",l}var c=i[u]={exports:{}};e[u][0].call(c.exports,function(t){return r(e[u][1][t]||t)},c,c.exports,t,e,i,n)}return i[u].exports}for(var o="function"==typeof require&&require,u=0;u<n.length;u++)r(n[u]);return r}}()({1:[function(t,e,i){"use strict";var n=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(t,e,i){if(!e)throw new Error("Joomla API is not properly initiated");e.selectedFile={},window.document.addEventListener("onMediaFileSelected",function(t){e.selectedFile=t.detail}),e.doIt=function(t,i,n){if(!0===t.success){if(t.data[0].url)if(/local-/.test(t.data[0].adapter)){var o=e.getOptions("system.paths").rootFull;e.selectedFile.url=t.data[0].url.split(o)[1],t.data[0].thumb_path?e.selectedFile.thumb=t.data[0].thumb_path:e.selectedFile.thumb=!1}else t.data[0].thumb_path&&(e.selectedFile.thumb=t.data[0].thumb_path);else e.selectedFile.url=!1;var u=function(t){return"object"===("undefined"==typeof HTMLElement?"undefined":r(HTMLElement))?t instanceof HTMLElement:t&&"object"===(void 0===t?"undefined":r(t))&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName};e.selectedFile.url&&(u(i)||"object"===(void 0===i?"undefined":r(i))?!u(i)&&"object"===(void 0===i?"undefined":r(i))&&i.id?parent.window.Joomla.editors.instances[i.id].replaceSelection('<img src="'+e.selectedFile.url+'" alt=""/>'):(i.value=e.selectedFile.url,n.updatePreview()):e.editors.instances[i].replaceSelection('<img src="'+e.selectedFile.url+'" alt=""/>'))}},e.getImage=function(t,i,n){return new Promise(function(r,o){var u=e.getOptions("csrf.token"),s=e.getOptions("system.paths").rootFull+"administrator/index.php?option=com_media&format=json";e.request({url:s+"&task=api.files&url=true&path="+t.path+"&"+u+"=1&format=json",method:"GET",perform:!0,headers:{"Content-Type":"application/json"},onSuccess:function(t){var o=JSON.parse(t);r(e.doIt(o,i,n))},onError:function(){o()}})})};var o=function(t){function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(r.__proto__||Object.getPrototypeOf(r)).apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(r,HTMLElement),n(r,[{key:"connectedCallback",value:function(){var t=this.querySelector(this.buttonSelect),e=this.querySelector(this.buttonClear);this.show=this.show.bind(this),this.modalClose=this.modalClose.bind(this),this.clearValue=this.clearValue.bind(this),this.setValue=this.setValue.bind(this),this.updatePreview=this.updatePreview.bind(this),t.addEventListener("click",this.show),e&&e.addEventListener("click",this.clearValue),this.updatePreview()}},{key:"disconnectedCallback",value:function(){this.querySelector(this.buttonClear).removeEventListener("click",this)}},{key:"show",value:function(){var t=this,e=this;i(this.querySelector('[role="dialog"]')).modal("show"),i(this.querySelector(this.buttonSaveSelected)).on("click",function(i){return i.preventDefault(),i.stopPropagation(),t.selectedPath&&e.setValue(t.selectedPath),e.modalClose(),!1})}},{key:"modalClose",value:function(){var t=this.querySelector(this.input);e.getImage(e.selectedFile,t,this),i(this.querySelector('[role="dialog"]')).modal("hide")}},{key:"setValue",value:function(t){i(this.querySelector(this.input)).val(t).trigger("change"),this.updatePreview()}},{key:"clearValue",value:function(){this.setValue("")}},{key:"updatePreview",value:function(){if(-1!==["true","static"].indexOf(this.preview)&&"false"!==this.preview&&this.preview){var t=this.querySelector(this.input).value,i=this.querySelector(".field-media-preview");if(t){i.innerHTML="";var n=new Image;switch(this.type){case"image":n.src=n.src=/http/.test(t)?t:e.getOptions("system.paths").rootFull+t}i.style.width=this.previewWidth,i.appendChild(n)}else i.innerHTML='<span class="field-media-preview-icon fa fa-picture-o"></span>'}}},{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 this.getAttribute(parseInt("modal-width",10))},set:function(t){this.setAttribute("modal-width",t)}},{key:"modalHeight",get:function(){return this.getAttribute(parseInt("modal-height",10))},set:function(t){this.setAttribute("modal-height",t)}},{key:"previewWidth",get:function(){return this.getAttribute(parseInt("preview-width",10))},set:function(t){this.setAttribute("preview-width",t)}},{key:"previewHeight",get:function(){return this.getAttribute(parseInt("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")}}],[{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"]}}]),r}();t.define("joomla-field-media",o)}(customElements,Joomla,jQuery)},{}]},{},[1]);

No other release has this exact content. See every version of this file.