- md5
- 6485bd1638a2c6d2c0b94ae171f6003d
- sha1
- 4453ec0f60b4840a3ad232b84dcd3f076eaf7f63
- sha256
- 6c8d8161073752995966fc368b96056e935d89f4557f3fda4a6ac312277483a0
(a=>{"use strict";class b{constructor(b){const c=this;this.container=b||a,this.fields={},this.showonFields=[].slice.call(this.container.querySelectorAll("[data-showon]")),this.showonFields.length&&(this.showonFields.forEach(a=>{const b=a.getAttribute("data-showon")||"",d=JSON.parse(b);let e;d.length&&(e=[].slice.call(c.container.querySelectorAll(`[name="${d[0].field}"], [name="${d[0].field}[]"]`)),!this.fields[d[0].field]&&(this.fields[d[0].field]={origin:[],targets:[]}),e.forEach(a=>{-1===this.fields[d[0].field].origin.indexOf(a)&&this.fields[d[0].field].origin.push(a)}),this.fields[d[0].field].targets.push(a),1<d.length&&d.forEach((b,f)=>{0===f||(e=[].slice.call(c.container.querySelectorAll(`[name="${b.field}"], [name="${b.field}[]"]`)),!this.fields[d[0].field]&&(this.fields[d[0].field]={origin:[],targets:[]}),e.forEach(a=>{-1===this.fields[d[0].field].origin.indexOf(a)&&this.fields[d[0].field].origin.push(a)}),-1===this.fields[d[0].field].targets.indexOf(a)&&this.fields[d[0].field].targets.push(a))}))}),this.linkedOptions=this.linkedOptions.bind(this),Object.keys(this.fields).forEach(a=>{this.fields[a].origin.length&&this.fields[a].origin.forEach(b=>{c.linkedOptions(a),b.addEventListener("change",()=>{c.linkedOptions(a)})})}))}linkedOptions(b){this.fields[b].targets.forEach(c=>{const d=JSON.parse(c.getAttribute("data-showon"))||[];let e,f=!0;d.forEach((c,g)=>{const h=c||{};h.valid=0,this.fields[b].origin.forEach(b=>{if(b.name===c.field){const c=b.id;if(b.getAttribute("type")&&-1!==["checkbox","radio"].indexOf(b.getAttribute("type").toLowerCase())){if(!b.checked)return;e=a.getElementById(c).value}else e=a.getElementById(c).value,null===e&&"select"===b.tagName.toLowerCase()&&(e=[]);"object"==typeof e||(e=JSON.parse(`["${e}"]`)),e.forEach(a=>{"="===h.sign&&-1!==h.values.indexOf(a)&&(h.valid=1),"!="===h.sign&&-1===h.values.indexOf(a)&&(h.valid=1)})}}),""===h.op?0===h.valid&&(f=!1):("AND"===h.op&&2>h.valid+d[g-1].valid&&(f=!1),"OR"===h.op&&0<h.valid+d[g-1].valid&&(f=!0))}),c.style.display=f?"block":"none"})}}a.addEventListener("DOMContentLoaded",()=>{new b(a)}),a.addEventListener("joomla:updated",a=>{const c=a.target;if(c.classList.contains("subform-repeatable-group")){const a=[].slice.call(c.querySelectorAll("[data-showon]")),b=c.getAttribute("data-baseName"),d=c.getAttribute("data-group"),e=new RegExp(`\\[${b}\\]\\[${b}X\\]`,"g");a.forEach(a=>{const c=a.getAttribute("data-showon").replace(e,`[${b}][${d}]`);a.setAttribute("data-showon",c)})}new b(a.target)})})(document);
No other release has this exact content. See every version of this file.