CoreFiles by mySites.guru
joomla-field-module-order.min.js1 lines, 2,244 bytes, from Joomla_4.0.0-beta7-Beta-Full_Package.zip
Raw History Compare with 4.0.0-beta6
md5
8685dd66716ac882b95c0f40d888d005
sha1
1c5d2c0f43f44f7fbca232e6f9a37330c73af465
sha256
8eaf86b3b97de78f3ead10b78dcacb409df3c677e655edfd5283dd8aa62857ce
"use strict";customElements.define("joomla-field-module-order",class extends HTMLElement{constructor(){super(),this.linkedFieldSelector="",this.linkedFieldElement="",this.originalPosition="",this.writeDynaList.bind(this),this.getNewOrder.bind(this)}connectedCallback(){if(this.linkedFieldSelector=this.getAttribute("data-linked-field")||"jform_position",!this.linkedFieldSelector)throw new Error("No linked field defined!");if(this.linkedFieldElement=document.getElementById(this.linkedFieldSelector),!this.linkedFieldElement)throw new Error("No linked field defined!");const a=this;this.originalPosition=this.linkedFieldElement.value,this.getNewOrder(this.originalPosition),this.linkedFieldElement.addEventListener("change",()=>{a.originalPosition=a.linkedFieldElement.value,a.getNewOrder(a.linkedFieldElement.value)})}writeDynaList(a,b,c,d){let e=0;const f=document.createElement("select");for(const g in this.hasAttribute("disabled")&&f.setAttribute("disabled",""),this.getAttribute("onchange")&&f.setAttribute("onchange",this.getAttribute("onchange")),this.getAttribute("size")&&f.setAttribute("size",this.getAttribute("size")),f.classList.add(a.itemClass),f.setAttribute("name",a.name),f.id=a.id,b){if(!b.hasOwnProperty(g))continue;const a=document.createElement("option"),h=b[g];a.value=h[1],a.innerHTML=h[2],(c&&d===h[1]||!c&&0===e)&&a.setAttribute("selected","selected"),f.appendChild(a),e+=1}this.innerHTML="",this.appendChild(f)}getNewOrder(a){const b=this.getAttribute("data-url"),c=this.getAttribute("data-client-id"),d=this.getAttribute("data-ordering"),e=this.getAttribute("data-name"),f=this.getAttribute("data-client-attr")?this.getAttribute("data-client-attr"):"form-select",g=`${this.getAttribute("data-id")}`,h=`${this.getAttribute("data-module-id")}`,j=[],k=this;Joomla.request({url:`${b}&client_id=${c}&position=${a}&module_id=${h}`,method:"GET",perform:!0,headers:{"Content-Type":"application/x-www-form-urlencoded"},onSuccess(a){if(a){let b;try{b=JSON.parse(a)}catch(a){console.error(a)}if(0<b.data.length){for(let a=0;a<b.data.length;a+=1)j[a]=b.data[a].split(",");k.writeDynaList({name:e,id:g,itemClass:f},j,k.originalPosition,d)}}"object"==typeof a.messages&&null!==a.messages&&Joomla.renderMessages(a.messages)}})}});

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