%PDF- %PDF-
Direktori : /home/bitrix/www/bitrix/components/bitrix/landing.site_edit/templates/.default/ |
Current File : /home/bitrix/www/bitrix/components/bitrix/landing.site_edit/templates/.default/script.min.js |
BX.namespace("BX.Landing");BX.Landing.EditComponent=function(){this.actionCloseId=BX("action-close");if(this.actionCloseId){BX.bind(this.actionCloseId,"click",BX.delegate(this.actionClose,this))}};BX.Landing.EditComponent.prototype={actionClose:function(){if(typeof top.BX.Bitrix24!=="undefined"&&typeof top.BX.Bitrix24.PageSlider!=="undefined"){top.BX.Bitrix24.PageSlider.close()}else if(typeof top.BX.SidePanel!=="undefined"){setTimeout(function(){top.BX.SidePanel.Instance.close()},300)}}};BX.Landing.SelectColor=function(e){this.id=e.id?e.id:"";this.options=e.options?e.options:[];this.value=e.value?e.value:"";this.DOM={}};BX.Landing.SelectColor.prototype={show:function(){this.initSectionSelector()},initSectionSelector:function(){this.DOM.sectionWrap=BX(this.id+"_select_color_wrap");this.DOM.sectionInput=BX(this.id+"_select_color");this.DOM.sectionSelect=this.DOM.sectionWrap.appendChild(BX.create("DIV",{props:{className:"select-color-field"}}));this.DOM.sectionSelectInner=this.DOM.sectionSelect.appendChild(BX.create("DIV",{props:{className:"select-color-field-icon"},style:{backgroundColor:this.options[this.value].color}}));this.DOM.sectionSelectInnerText=this.DOM.sectionSelect.appendChild(BX.create("SPAN",{text:this.options[this.value].name}));BX.bind(this.DOM.sectionSelect,"click",o);var e=this,t=this.options;function o(){if(e.sectionMenu&&e.sectionMenu.popupWindow&&e.sectionMenu.popupWindow.isShown()){return e.sectionMenu.close()}var o,n=[],i;for(var s in t){n.push({id:"bx-select-color-option-"+s,text:BX.util.htmlspecialchars(t[s].name),color:t[s].color,className:"select-color-popup-menu-item "+(t[s].class?t[s].class:""),onclick:function(o){return function(){var n=t[o];e.DOM.sectionInput.value=o;e.DOM.sectionSelectInner.style.backgroundColor=n.color;e.DOM.sectionSelectInnerText.innerHTML=BX.util.htmlspecialchars(n.name);e.sectionMenu.close()}}(s)})}e.sectionMenu=BX.PopupMenu.create("selectColor"+e.id,e.DOM.sectionSelect,n,{closeByEsc:true,autoHide:true,offsetTop:0,offsetLeft:0});e.sectionMenu.popupWindow.contentContainer.style.maxHeight="300px";e.sectionMenu.popupWindow.setWidth(e.DOM.sectionSelect.offsetWidth-2);e.sectionMenu.show();for(o=0;o<e.sectionMenu.menuItems.length;o++){if(e.sectionMenu.menuItems[o].layout.item){i=e.sectionMenu.menuItems[o].layout.item.querySelector(".menu-popup-item-icon");if(i){i.style.backgroundColor=e.sectionMenu.menuItems[o].color}}}BX.addClass(e.DOM.sectionSelect,"active");BX.addCustomEvent(e.sectionMenu.popupWindow,"onPopupClose",function(){BX.removeClass(e.DOM.sectionSelect,"active");e.sectionMenu=null;BX.PopupMenu.destroy("selectColor"+e.id)})}}};