- md5
- 6fa96dfb67572843086d48a5dc71d68b
- sha1
- 7b4d3190e04fc122de634e4b8855e1035bf378ac
- sha256
- 79863d89f0992393cb6c2c52438e0b5f244858e11e9d7bbea89a60e744b3c4d1
!function t(e,i,n){function r(u,s){if(!i[u]){if(!e[u]){var l="function"==typeof require&&require;if(!s&&l)return l(u,!0);if(o)return o(u,!0);var a=new Error("Cannot find module '"+u+"'");throw a.code="MODULE_NOT_FOUND",a}var c=i[u]={exports:{}};e[u][0].call(c.exports,function(t){var i=e[u][1][t];return r(i||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"==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},r=function(){function t(t,e){for(var i,n=0;n<e.length;n++)(i=e[n]).enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),o="function"==typeof Symbol&&"symbol"==n(Symbol.iterator)?function(t){return void 0===t?"undefined":n(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":void 0===t?"undefined":n(t)};!function(){var t=window.Joomla||{};t.selectedFile={},window.document.addEventListener("onMediaFileSelected",function(e){t.selectedFile=e.detail}),t.doIt=function(e,i,n){if(!0===e.success){if(e.data[0].url)if(/local-/.test(e.data[0].adapter)){var r=t.getOptions("system.paths").rootFull;t.selectedFile.url=e.data[0].url.split(r)[1],t.selectedFile.thumb=!!e.data[0].thumb_path&&e.data[0].thumb_path}else e.data[0].thumb_path&&(t.selectedFile.thumb=e.data[0].thumb_path);else t.selectedFile.url=!1;var u=function(t){return"object"===("undefined"==typeof HTMLElement?"undefined":o(HTMLElement))?t instanceof HTMLElement:t&&"object"===(void 0===t?"undefined":o(t))&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName};t.selectedFile.url&&(u(i)||"object"===(void 0===i?"undefined":o(i))?!u(i)&&"object"===(void 0===i?"undefined":o(i))&&i.id?parent.window.Joomla.editors.instances[i.id].replaceSelection('<img src="'+t.selectedFile.url+'" alt=""/>'):(i.value=t.selectedFile.url,n.updatePreview()):t.editors.instances[i].replaceSelection('<img src="'+t.selectedFile.url+'" alt=""/>'))}},t.getImage=function(e,i,n){return new Promise(function(r,o){var u=t.getOptions("csrf.token"),s=t.getOptions("system.paths").rootFull+"administrator/index.php?option=com_media&format=json";t.request({url:s+"&task=api.files&url=true&path="+e.path+"&"+u+"=1&format=json",method:"GET",perform:!0,headers:{"Content-Type":"application/json"},onSuccess:function(e){var o=JSON.parse(e);r(t.doIt(o,i,n))},onError:function(){o()}})})};var e=function(e){function i(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=(void 0===e?"undefined":n(e))&&"function"!=typeof e?t:e}(this,(i.__proto__||Object.getPrototypeOf(i)).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 "+(void 0===e?"undefined":n(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)}(i,HTMLElement),r(i,[{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",self)}},{key:"show",value:function(){var t=this,e=this;this.querySelector(this.input);window.jQuery(this.querySelector('[role="dialog"]')).modal("show"),window.jQuery(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 e=this.querySelector(this.input);t.getImage(t.selectedFile,e,this),window.jQuery(this.querySelector('[role="dialog"]')).modal("hide")}},{key:"setValue",value:function(t){window.jQuery(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,e=this.querySelector(".field-media-preview");if(t){e.innerHTML="";var i=new Image;switch(this.type){case"image":i.src=i.src=/http/.test(t)?t:"/"+t}e.style.width=this.previewWidth,e.appendChild(i)}else e.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"]}}]),i}();customElements.define("joomla-field-media",e)}()},{}]},{},[1]);
No other release has this exact content. See every version of this file.