- md5
- e2b2df7e58561abc384c86c14979a7a0
- sha1
- 795dbb91afff05a5bf1aa2b7b28597d20c6ecc03
- sha256
- be0b5b3fe4d9d6d664e56d6bcf24d1cc82b72dee2670368006d71a2ad8189361
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
'use strict';var _createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),_typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&'function'==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?'symbol':typeof a};function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}(function(a,b){if(!b)throw new Error('Joomla API is not properly initiated');b.selectedFile={},window.document.addEventListener('onMediaFileSelected',function(a){b.selectedFile=a.detail}),b.doIt=function(a,c,d){if(!0===a.success){if(!a.data[0].url)b.selectedFile.url=!1;else if(/local-/.test(a.data[0].adapter)){var e=b.getOptions('system.paths').rootFull;b.selectedFile.url=a.data[0].url.split(e)[1],b.selectedFile.thumb=!!a.data[0].thumb_path&&a.data[0].thumb_path}else a.data[0].thumb_path&&(b.selectedFile.thumb=a.data[0].thumb_path);var f=function(a){return'object'===('undefined'==typeof HTMLElement?'undefined':_typeof(HTMLElement))?a instanceof HTMLElement:a&&'object'===('undefined'==typeof a?'undefined':_typeof(a))&&null!==a&&1===a.nodeType&&'string'==typeof a.nodeName};b.selectedFile.url&&(f(c)||'object'===('undefined'==typeof c?'undefined':_typeof(c))?!f(c)&&'object'===('undefined'==typeof c?'undefined':_typeof(c))&&c.id?window.parent.Joomla.editors.instances[c.id].replaceSelection('<img src="'+b.selectedFile.url+'" alt=""/>'):(c.value=b.selectedFile.url,d.updatePreview()):b.editors.instances[c].replaceSelection('<img src="'+b.selectedFile.url+'" alt=""/>'))}},b.getImage=function(a,c,d){return new Promise(function(e,f){var g=b.getOptions('system.paths').rootFull+'administrator/index.php?option=com_media&format=json';b.request({url:g+'&task=api.files&url=true&path='+a.path+'&'+b.getOptions('csrf.token')+'=1&format=json',method:'GET',perform:!0,headers:{"Content-Type":'application/json'},onSuccess:function onSuccess(a){var f=JSON.parse(a);e(b.doIt(f,c,d))},onError:function onError(){f()}})})};var c=function(a){function c(){return _classCallCheck(this,c),_possibleConstructorReturn(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}return _inherits(c,a),_createClass(c,[{key:'connectedCallback',value:function connectedCallback(){var a=this.querySelector(this.buttonSelect),b=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),a.addEventListener('click',this.show),b&&b.addEventListener('click',this.clearValue),this.updatePreview()}},{key:'disconnectedCallback',value:function disconnectedCallback(){var a=this.querySelector(this.buttonClear);a.removeEventListener('click',this)}},{key:'show',value:function show(){var a=this,b=this;this.querySelector('[role="dialog"]').open(),this.querySelector(this.buttonSaveSelected).addEventListener('click',function(c){return c.preventDefault(),c.stopPropagation(),a.selectedPath&&b.setValue(a.selectedPath),b.modalClose(),!1})}},{key:'modalClose',value:function modalClose(){var a=this.querySelector(this.input);b.getImage(b.selectedFile,a,this),b.Modal.getCurrent().close()}},{key:'setValue',value:function setValue(a){this.querySelector(this.input).value=a,this.updatePreview()}},{key:'clearValue',value:function clearValue(){this.setValue('')}},{key:'updatePreview',value:function updatePreview(){if(-1!==['true','static'].indexOf(this.preview)&&'false'!==this.preview&&this.preview){var a=this.querySelector(this.input),c=a.value,d=this.querySelector('.field-media-preview');if(!c)d.innerHTML='<span class="field-media-preview-icon fa fa-picture-o"></span>';else{d.innerHTML='';var e=new Image;switch(this.type){case'image':e.src=e.src=/http/.test(c)?c:b.getOptions('system.paths').rootFull+c;break;default:}d.style.width=this.previewWidth,d.appendChild(e)}}}},{key:'type',get:function get(){return this.getAttribute('type')},set:function set(a){this.setAttribute('type',a)}},{key:'basePath',get:function get(){return this.getAttribute('base-path')},set:function set(a){this.setAttribute('base-path',a)}},{key:'rootFolder',get:function get(){return this.getAttribute('root-folder')},set:function set(a){this.setAttribute('root-folder',a)}},{key:'url',get:function get(){return this.getAttribute('url')},set:function set(a){this.setAttribute('url',a)}},{key:'modalContainer',get:function get(){return this.getAttribute('modal-container')},set:function set(a){this.setAttribute('modal-container',a)}},{key:'input',get:function get(){return this.getAttribute('input')},set:function set(a){this.setAttribute('input',a)}},{key:'buttonSelect',get:function get(){return this.getAttribute('button-select')},set:function set(a){this.setAttribute('button-select',a)}},{key:'buttonClear',get:function get(){return this.getAttribute('button-clear')},set:function set(a){this.setAttribute('button-clear',a)}},{key:'buttonSaveSelected',get:function get(){return this.getAttribute('button-save-selected')},set:function set(a){this.setAttribute('button-save-selected',a)}},{key:'modalWidth',get:function get(){return this.getAttribute(parseInt('modal-width',10))},set:function set(a){this.setAttribute('modal-width',a)}},{key:'modalHeight',get:function get(){return this.getAttribute(parseInt('modal-height',10))},set:function set(a){this.setAttribute('modal-height',a)}},{key:'previewWidth',get:function get(){return this.getAttribute(parseInt('preview-width',10))},set:function set(a){this.setAttribute('preview-width',a)}},{key:'previewHeight',get:function get(){return this.getAttribute(parseInt('preview-height',10))},set:function set(a){this.setAttribute('preview-height',a)}},{key:'preview',get:function get(){return this.getAttribute('preview')},set:function set(a){this.setAttribute('preview',a)}},{key:'previewContainer',get:function get(){return this.getAttribute('preview-container')}}],[{key:'observedAttributes',get:function get(){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']}}]),c}(HTMLElement);a.define('joomla-field-media',c)})(customElements,Joomla);
},{}]},{},[1]);
No other release has this exact content. See every version of this file.