芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/media.1/system/js/showon-es5.min.js
!function(){"use strict";!function(i){var e=function(){function e(e){var t=this,n=this;this.container=e||i,this.fields={},this.showonFields=[].slice.call(this.container.querySelectorAll("[data-showon]")),this.showonFields.length&&(this.showonFields.forEach((function(i){if(!i.hasAttribute("data-showon-initialised")){i.setAttribute("data-showon-initialised","");var e,o=i.getAttribute("data-showon")||"",a=JSON.parse(o);a.length&&(e=[].slice.call(n.container.querySelectorAll('[name="'+a[0].field+'"], [name="'+a[0].field+'[]"]')),t.fields[a[0].field]||(t.fields[a[0].field]={origin:[],targets:[]}),e.forEach((function(i){-1===t.fields[a[0].field].origin.indexOf(i)&&t.fields[a[0].field].origin.push(i)})),t.fields[a[0].field].targets.push(i),a.length>1&&a.forEach((function(o,l){0!==l&&(e=[].slice.call(n.container.querySelectorAll('[name="'+o.field+'"], [name="'+o.field+'[]"]')),t.fields[a[0].field]||(t.fields[a[0].field]={origin:[],targets:[]}),e.forEach((function(i){-1===t.fields[a[0].field].origin.indexOf(i)&&t.fields[a[0].field].origin.push(i)})),-1===t.fields[a[0].field].targets.indexOf(i)&&t.fields[a[0].field].targets.push(i))})))}})),this.linkedOptions=this.linkedOptions.bind(this),Object.keys(this.fields).forEach((function(i){t.fields[i].origin.length&&t.fields[i].origin.forEach((function(e){n.linkedOptions(i),e.addEventListener("change",(function(){n.linkedOptions(i)})),e.addEventListener("keyup",(function(){n.linkedOptions(i)})),e.addEventListener("click",(function(){n.linkedOptions(i)}))}))})))}return e.prototype.linkedOptions=function(e){var t=this;this.fields[e].targets.forEach((function(n){var o,a=JSON.parse(n.getAttribute("data-showon"))||[],l=!0;a.forEach((function(n,s){var d=n||{};d.valid=0,t.fields[e].origin.forEach((function(e){if(e.name===n.field){var t=e.id;if(e.getAttribute("type")&&-1!==["checkbox","radio"].indexOf(e.getAttribute("type").toLowerCase())){if(!e.checked)return;o=i.getElementById(t).value}else null===(o=i.getElementById(t).value)&&"select"===e.tagName.toLowerCase()&&(o=[]);"object"!=typeof o&&(o=JSON.parse('["'+o+'"]')),o.forEach((function(i){"="===d.sign&&-1!==d.values.indexOf(i)&&(d.valid=1),"!="===d.sign&&-1===d.values.indexOf(i)&&(d.valid=1)}))}})),""===d.op?0===d.valid&&(l=!1):("AND"===d.op&&d.valid+a[s-1].valid<2&&(l=!1,d.valid=0),"OR"===d.op&&d.valid+a[s-1].valid>0&&(l=!0,d.valid=1))})),"option"!==n.tagName?l?n.classList.remove("hidden"):n.classList.add("hidden"):n.disabled=!l}))},e}();window.Joomla=window.Joomla||{},Joomla.Showon||(Joomla.Showon={initialise:function(i){return new e(i)}}),i.addEventListener("DOMContentLoaded",(function(){Joomla.Showon.initialise(i)})),i.addEventListener("joomla:updated",(function(i){var e=i.target;if(e.classList.contains("subform-repeatable-group")){var t=[].slice.call(e.querySelectorAll("[data-showon]")),n=new RegExp("\\["+e.dataset.baseName+"X\\]","g"),o="["+e.dataset.group+"]";t.forEach((function(i){var e=i.dataset.showon.replace(n,o);i.dataset.showon=e}))}Joomla.Showon.initialise(e)}))}(document)}();