| Server IP : 54.36.91.62 / Your IP : 216.73.217.117 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/votreville/media/plg_system_nrframework/js/ |
Upload File : |
var NRF_ChainedFields=function(){function e(){this.ajaxURL="?option=com_ajax&format=raw&plugin=nrframework&path=plugins/system/nrframework/fields/&class=JFormFieldNRChainedFields&file=nrchainedfields&task=Include",this.nextSelect=null,this.isJ4=Joomla.Modal,this.initEvents()}var t=e.prototype;return t.initEvents=function(){this.isJ4||jQuery(document).on("change",function(e){this.handleChange(e)}.bind(this)),document.addEventListener("change",function(e){this.handleChange(e)}.bind(this))},t.handleChange=function(e){var t=e.target.closest(".nr-chained-fields-select");if(t&&this.getNextSelect(t)){var n=this,i=e.target.closest(".nr-chained-fields");if(this.resetNextSelects(t),t.value){this.setNextSelectIsLoading(t);var o=new FormData;o.append("select_id",e.target.id),o.append("value",JSON.stringify(this.getValue(i))),o.append("data_source",i.dataset.dataSource),o.append("csv",i.dataset.csv),o.append(Joomla.getOptions("csrf.token"),1),fetch(i.dataset.baseUrl+this.ajaxURL,{method:"post",body:o}).then(function(e){return e.json()}).then(function(e){e.error?alert(e.response):n.populateNextSelect(e.response)})}}},t.populateNextSelect=function(e){this.populateDropdown(e,this.nextSelect),this.nextSelect.removeAttribute("disabled"),this.nextSelect.querySelector("option.placeholder").innerHTML=this.nextSelect.querySelector("option.placeholder").dataset.original,window.jQuery&&jQuery().chosen&&jQuery(this.nextSelect).chosen("destroy").chosen()},t.getValue=function(e){var t={};return e.querySelectorAll(".nr-chained-fields-select").forEach(function(e){t[e.name]=e.options[e.selectedIndex].classList.contains("placeholder")?"":e.value}),t},t.populateDropdown=function(e,t){for(var n=0;n<e.length;n++){var i=document.createElement("option");i.value=e[n].value,i.text=e[n].text,t.appendChild(i)}},t.resetNextSelects=function(e){var t=this.getNextSelect(e);t&&(t.setAttribute("disabled","disabled"),t.querySelector("option.placeholder").innerHTML=t.querySelector("option.placeholder").dataset.original,t.querySelectorAll("option:not(.placeholder)").forEach(function(e){e.remove()}),window.jQuery&&jQuery().chosen&&jQuery(t).chosen("destroy").chosen(),this.resetNextSelects(t))},t.getNextSelect=function(e){return this.isJ4?!!e.nextElementSibling&&("select"==e.nextElementSibling.nodeName.toLowerCase()&&e.nextElementSibling):!!e.nextElementSibling.nextElementSibling&&("select"==e.nextElementSibling.nextElementSibling.nodeName.toLowerCase()&&e.nextElementSibling.nextElementSibling)},t.setNextSelectIsLoading=function(e){var t=this.getNextSelect(e);if(t){this.nextSelect=t;var n=e.closest(".nr-chained-fields").dataset.loading;t.querySelector("option").innerHTML=n,window.jQuery&&jQuery().chosen&&jQuery(t).chosen("destroy").chosen()}},e}();document.addEventListener("DOMContentLoaded",function(){new NRF_ChainedFields});