CoreFiles by mySites.guru
showon.min.js1 lines, 3,584 bytes, from Joomla_4.0.0-alpha5-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha3
md5
38048a258bd0df6e7074ff165679e39a
sha1
150f3a261f7f2df1470f85328bd97524620a5d54
sha256
1c35a8349e472e73b5f6875b0e50ee89760d4c91a6ba196f21fd88c08a334802
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_createClass=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}();function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Joomla=window.Joomla||{},Joomla.setcollapse=function(e,t,i){document.getElementById("collapse-"+t)||(document.getElementById("container-collapse").innerHTML='<div class="collapse fade" id="collapse-'+t+'"><iframe class="iframe" src="'+e+'" height="'+i+'" width="100%"></iframe></div>')},function(e){"use strict";var t=function(){function t(i){var n=this;_classCallCheck(this,t);var o=this;this.container=i||e,this.fields={},this.showonFields=[].slice.call(this.container.querySelectorAll("[data-showon]")),this.showonFields.length&&(this.showonFields.forEach(function(e){var t=e.getAttribute("data-showon")||"",i=JSON.parse(t),l=void 0;i.length&&(l=[].slice.call(o.container.querySelectorAll('[name="'+i[0].field+'"], [name="'+i[0].field+'[]"]')),n.fields[i[0].field]||(n.fields[i[0].field]={origin:[],targets:[]}),l.forEach(function(e){-1===n.fields[i[0].field].origin.indexOf(e)&&n.fields[i[0].field].origin.push(e)}),n.fields[i[0].field].targets.push(e),i.length>1&&i.forEach(function(t,a){0!==a&&(l=[].slice.call(o.container.querySelectorAll('[name="'+t.field+'"], [name="'+t.field+'[]"]')),n.fields[i[0].field]||(n.fields[i[0].field]={origin:[],targets:[]}),l.forEach(function(e){-1===n.fields[i[0].field].origin.indexOf(e)&&n.fields[i[0].field].origin.push(e)}),-1===n.fields[i[0].field].targets.indexOf(e)&&n.fields[i[0].field].targets.push(e))}))}),this.linkedOptions=this.linkedOptions.bind(this),Object.keys(this.fields).forEach(function(e){n.fields[e].origin.length&&n.fields[e].origin.forEach(function(t){o.linkedOptions(e),t.addEventListener("change",function(){o.linkedOptions(e)})})}))}return _createClass(t,[{key:"linkedOptions",value:function(t){var i=this;this.fields[t].targets.forEach(function(n){var o=JSON.parse(n.getAttribute("data-showon"))||[],l=!0,a=void 0;o.forEach(function(n,s){var r=n||{};r.valid=0,i.fields[t].origin.forEach(function(t){if(t.name===n.field){var i=t.id;if(t.getAttribute("type")&&-1!==["checkbox","radio"].indexOf(t.getAttribute("type").toLowerCase())){if(!t.checked)return;a=e.getElementById(i).value}else null===(a=e.getElementById(i).value)&&"select"===t.tagName.toLowerCase()&&(a=[]);"object"!==(void 0===a?"undefined":_typeof(a))&&(a=JSON.parse('["'+a+'"]')),a.forEach(function(e){"="===r.sign&&-1!==r.values.indexOf(e)&&(r.valid=1),"!="===r.sign&&-1===r.values.indexOf(e)&&(r.valid=1)})}}),""===r.op?0===r.valid&&(l=!1):("AND"===r.op&&r.valid+o[s-1].valid<2&&(l=!1),"OR"===r.op&&r.valid+o[s-1].valid>0&&(l=!0))}),n.style.display=l?"block":"none"})}}]),t}();e.addEventListener("DOMContentLoaded",function(){new t(e)}),e.addEventListener("joomla:updated",function(e){var i=e.target;if(i.classList.contains("subform-repeatable-group")){var n=[].slice.call(i.querySelectorAll("[data-showon]")),o=i.getAttribute("data-baseName"),l=i.getAttribute("data-group"),a=new RegExp("\\["+o+"\\]\\["+o+"X\\]","g"),s="["+o+"]["+l+"]";n.forEach(function(e){var t=e.getAttribute("data-showon").replace(a,s);e.setAttribute("data-showon",t)})}new t(e.target)})}(document);

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