CoreFiles by mySites.guru
edit-images-es5.min.js1 lines, 8,450 bytes, from Joomla_4.0.0-rc5-Release_Candidate-Full_Package.zip
Raw History Compare with 4.0.0-rc4
md5
1e8b9ed6a189ef54ae2181ef40cc3e19
sha1
245e637f91d3727e0e0c2494a831cf79d0cfcf26
sha256
22a02f6859f7cc59e0e6ef213fd01d7a4d16f435756d797e9bd4af852adcca96
!function(){"use strict";function e(e,t,i,r,a,n,o){try{var s=e[n](o),c=s.value}catch(e){return void i(e)}s.done?t(c):Promise.resolve(c).then(r,a)}function t(t){return function(){var i=this,r=arguments;return new Promise((function(a,n){var o=t.apply(i,r);function s(t){e(o,a,n,s,c,"next",t)}function c(t){e(o,a,n,s,c,"throw",t)}s(void 0)}))}}if(!Joomla)throw new Error("Joomla API is not properly initialized");Joomla.MediaManager=Joomla.MediaManager||{},new(function(){function e(){var e=this;if(this.options=Joomla.getOptions("com_media",{}),!this.options)throw new Error('Initialization error "edit-images.js"');if(this.extension=this.options.uploadPath.split(".").pop(),this.fileType=["jpeg","jpg"].includes(this.extension)?"jpeg":this.extension,this.options.currentUrl=new URL(window.location.href),this.original={filename:this.options.uploadPath.split("/").pop(),extension:this.extension,contents:"data:image/"+this.fileType+";base64,"+this.options.contents},this.history={},this.current=this.original,this.plugins={},this.baseContainer=document.getElementById("media-manager-edit-container"),!this.baseContainer)throw new Error("The image preview container is missing");this.createImageContainer(this.original),Joomla.MediaManager.Edit=this,window.dispatchEvent(new CustomEvent("media-manager-edit-init")),customElements.whenDefined("joomla-tab").then(t(regeneratorRuntime.mark((function i(){var r,a,n;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:r=document.getElementById("myTab"),a=r.firstElementChild,(n=[].slice.call(a.querySelectorAll("button[aria-controls]"))).forEach((function(i,r){var a=document.getElementById(i.getAttribute("aria-controls"));0===r&&a.insertAdjacentElement("beforeend",e.baseContainer),i.addEventListener("joomla.tab.shown",function(){var i=t(regeneratorRuntime.mark((function t(i){var r,n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=i.relatedTarget,n=i.target,!r){t.next=10;break}return t.prev=2,t.next=5,e.plugins[r.getAttribute("aria-controls").replace("attrib-","")].Deactivate(e.imagePreview);case 5:t.next=10;break;case 7:t.prev=7,t.t0=t.catch(2),console.log(t.t0);case 10:return a.insertAdjacentElement("beforeend",e.baseContainer),t.prev=11,t.next=14,e.activate(n.getAttribute("aria-controls").replace("attrib-",""));case 14:t.next=19;break;case 16:t.prev=16,t.t1=t.catch(11),console.log(t.t1);case 19:case"end":return t.stop()}}),t,null,[[2,7],[11,16]])})));return function(e){return i.apply(this,arguments)}}())})),n.map((function(e){return e.click()})),n[0].click(),n[0].blur(),setTimeout((function(){n[0].click(),n[0].blur()}),400);case 8:case"end":return i.stop()}}),i)})))),this.addHistoryPoint=this.addHistoryPoint.bind(this),this.createImageContainer=this.createImageContainer.bind(this),this.activate=this.activate.bind(this),this.Reset=this.Reset.bind(this),this.Undo=this.Undo.bind(this),this.Redo=this.Redo.bind(this),this.createProgressBar=this.createProgressBar.bind(this),this.updateProgressBar=this.updateProgressBar.bind(this),this.removeProgressBar=this.removeProgressBar.bind(this),this.upload=this.upload.bind(this),window.addEventListener("mediaManager.history.point",this.addHistoryPoint.bind(this))}var i=e.prototype;return i.addHistoryPoint=function(){if(this.original!==this.current){var e=Object.keys(this.history).length;if(this.history[e]&&this.history[e-1]&&this.history[e]===this.history[e-1])return;this.history[e+1]=this.current}},i.createImageContainer=function(e){if(!e.contents)throw new Error('Initialization error "edit-images.js"');this.imagePreview=document.createElement("img"),this.imagePreview.src=e.contents,this.imagePreview.id="image-preview",this.imagePreview.style.width="100%",this.imagePreview.style.height="auto",this.imagePreview.style.maxWidth="100%",this.baseContainer.appendChild(this.imagePreview)},i.activate=function(){var e=t(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=9;break}return e.prev=1,e.next=4,this.plugins[t.toLowerCase()].Activate(this.imagePreview);case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(1),console.log(e.t0);case 9:case"end":return e.stop()}}),e,this,[[1,6]])})));return function(t){return e.apply(this,arguments)}}(),i.Reset=function(e){var i=this;(!e||e&&"initial"===e)&&(this.current.contents=this.original.contents,this.history={},this.imagePreview.src=this.original.contents);var r=document.getElementById("myTab").firstElementChild;[].slice.call(r.querySelectorAll("button[aria-controls]")).forEach(function(){var e=t(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("true"===t.getAttribute("aria-expanded")){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,i.plugins[t.getAttribute("aria-controls").replace("attrib-","")].Deactivate(i.imagePreview);case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(2),console.log(e.t0);case 10:return t.click(),e.prev=11,e.next=14,i.activate(t.getAttribute("aria-controls").replace("attrib-",""));case 14:e.next=19;break;case 16:e.prev=16,e.t1=e.catch(11),console.log(e.t1);case 19:case"end":return e.stop()}}),e,null,[[2,7],[11,16]])})));return function(t){return e.apply(this,arguments)}}())},i.Undo=function(){},i.Redo=function(){},i.createProgressBar=function(){},i.updateProgressBar=function(){},i.removeProgressBar=function(){},i.upload=function(e,t){var i,r=this,a="jpg"===Joomla.MediaManager.Edit.original.extension?"jpeg":Joomla.MediaManager.Edit.original.extension;if(a||(a=/data:image\/(.+);/gm.exec(Joomla.MediaManager.Edit.original.contents)[1]),!a)throw new Error("Unable to determine image format");this.xhr=new XMLHttpRequest,"function"==typeof t&&(this.xhr.onreadystatechange=t),this.xhr.upload.onprogress=function(e){r.updateProgressBar(e.loaded/e.total*100)},this.xhr.onload=function(){var e;try{e=JSON.parse(r.xhr.responseText)}catch(t){e=null}e?200===r.xhr.status&&(!0===e.success&&r.removeProgressBar(),"1"===e.status&&(Joomla.renderMessages({success:[e.message]},"true"),r.removeProgressBar())):r.removeProgressBar(),r.xhr=null},this.xhr.onerror=function(){r.removeProgressBar(),r.xhr=null},this.xhr.open("PUT",e,!0),this.xhr.setRequestHeader("Content-Type","application/json"),this.createProgressBar(),this.xhr.send(JSON.stringify(((i={name:Joomla.MediaManager.Edit.options.uploadPath.split("/").pop(),content:Joomla.MediaManager.Edit.current.contents.replace("data:image/"+a+";base64,","")})[Joomla.MediaManager.Edit.options.csrfToken]=1,i)))},e}());var i=function(e){var t=Joomla.MediaManager.Edit.options.currentUrl,i=new URLSearchParams(t.search);i.set("view","media"),i.delete("path"),i.delete("mediatypes");var r=Joomla.MediaManager.Edit.options.uploadPath.split("/");r.pop(),(r=r.join("/")).endsWith(":")&&(r+="/"),i.set("path",r);var a=document.querySelector('input[name="mediatypes"]');return i.set("mediatypes",a&&a.value?a.value:"0"),e&&i.set("tmpl","component"),t.search=i,t};Joomla.submitbutton=function(e){var r=new URL(Joomla.MediaManager.Edit.options.apiBaseUrl+"&task=api.files&path="+Joomla.MediaManager.Edit.options.uploadPath);switch(e){case"apply":Joomla.MediaManager.Edit.upload(r,null),Joomla.MediaManager.Edit.imagePreview.src=Joomla.MediaManager.Edit.current.contents,Joomla.MediaManager.Edit.original=Joomla.MediaManager.Edit.current,Joomla.MediaManager.Edit.history={},t(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[].slice.call(document.querySelectorAll("joomla-tab-element")).filter((function(e){return e.hasAttribute("active")})),e.prev=1,e.next=4,Joomla.MediaManager.Edit.plugins[t[0].id.replace("attrib-","")].Deactivate(Joomla.MediaManager.Edit.imagePreview);case 4:return e.next=6,Joomla.MediaManager.Edit.plugins[t[0].id.replace("attrib-","")].Activate(Joomla.MediaManager.Edit.imagePreview);case 6:e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),console.log(e.t0);case 11:case"end":return e.stop()}}),e,null,[[1,8]])})))();break;case"save":Joomla.MediaManager.Edit.upload(r,(function(){Joomla.MediaManager.Edit.xhr.readyState===XMLHttpRequest.DONE&&(window.self!==window.top?window.location=i(!0):window.location=i())}));break;case"cancel":window.self!==window.top?window.location=i(!0):window.location=i();break;case"reset":Joomla.MediaManager.Edit.Reset("initial")}}}();

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