Your IP : 3.17.77.29
(function(){"use strict";var e=BX.namespace("BX.UI");if(e.Switcher){return}var t=[];function i(e){this.init(e);t.push(this)}i.getById=function(e){return t.filter(function(t){return t.id===e})[0]||null};i.getList=function(){return t};i.className="ui-switcher";i.initByClassName=function(){var e=document.getElementsByClassName(i.className);e=BX.convert.nodeListToArray(e);e.forEach(function(e){new i({node:e})})};i.prototype={events:{toggled:"toggled",checked:"checked",unchecked:"unchecked"},attributeName:"data-switcher",attributeInitName:"data-switcher-init",classNameOff:"ui-switcher-off",popup:null,content:null,popupParameters:null,init:function(e){e=e||{};if(e.attributeName){this.attributeName=e.attributeName}if(e.node){if(!BX.type.isDomNode(e.node)){throw new Error("Parameter `node` DOM Node expected.")}this.node=e.node;var t=this.node.getAttribute(this.attributeName);try{t=JSON.parse(t)}catch(e){t={}}this.id=t.id;this.checked=!!t.checked;this.inputName=t.inputName}else{this.node=document.createElement("span")}if(e.id){this.id=e.id}if(!this.id){throw new Error("Parameter `id` expected.")}if(typeof e.checked==="boolean"){this.checked=e.checked}if(e.inputName){this.inputName=e.inputName}this.initNode();this.check(this.checked)},getNode:function(){return this.node},initNode:function(){var e=this.node;if(e.getAttribute(this.attributeInitName)){return}e.setAttribute(this.attributeInitName,"y");BX.addClass(e,i.className);e.innerHTML='<span class="ui-switcher-enabled">\n'+'<span class="ui-switcher-enabled-text">'+BX.message("UI_SWITCHER_ON")+"</span>\n"+"</span>\n"+'<span class="ui-switcher-disabled">\n'+'<span class="ui-switcher-cursor"></span>\n'+'<span class="ui-switcher-disabled-text">'+BX.message("UI_SWITCHER_OFF")+"</span>\n"+"</span>";if(this.inputName){this.inputNode=document.createElement("input");this.inputNode.type="hidden";this.inputNode.name=this.inputName;this.node.appendChild(this.inputNode)}BX.bind(e,"click",this.toggle.bind(this))},toggle:function(){this.check(!this.isChecked())},isChecked:function(){return this.checked},check:function(e){this.checked=e;if(this.inputNode){this.inputNode.value=this.checked?"Y":"N"}if(this.checked){BX.removeClass(this.node,this.classNameOff);BX.onCustomEvent(this,this.events.unchecked)}else{BX.addClass(this.node,this.classNameOff);BX.onCustomEvent(this,this.events.checked)}BX.onCustomEvent(this,this.events.toggled)}};i.initByClassName();e.Switcher=i})();
//# sourceMappingURL=ui.switcher.map.js