Your IP : 18.117.151.127


Current Path : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/landing/ui/panel/
Upload File :
Current File : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/landing/ui/panel/top_panel.min.js

(function(){"use strict";BX.namespace("BX.Landing.UI.Panel");var t=BX.Landing.Utils.removeClass;var n=BX.Landing.Utils.addClass;var i=BX.Landing.Utils.onCustomEvent;var e=BX.Landing.Utils.bind;var a=BX.Landing.Utils.unbind;var s=BX.Landing.Utils.makeFilterablePopupMenu;var o=BX.Landing.Utils.makeSelectablePopupMenu;var d=BX.Landing.Utils.style;var l=BX.Landing.Utils.encodeDataValue;BX.Landing.UI.Panel.Top=function(t,n){BX.Landing.UI.Panel.BasePanel.apply(this,arguments);this.layout=document.querySelector(".landing-ui-panel-top");this.siteButton=this.layout.querySelector(".landing-ui-panel-top-chain-link-site");this.pageButton=this.layout.querySelector(".landing-ui-panel-top-chain-link-page");this.undoButton=this.layout.querySelector(".landing-ui-panel-top-history-undo");this.redoButton=this.layout.querySelector(".landing-ui-panel-top-history-redo");this.desktopButton=this.layout.querySelector(".landing-ui-button-desktop");this.tabletButton=this.layout.querySelector(".landing-ui-button-tablet");this.mobileButton=this.layout.querySelector(".landing-ui-button-mobile");this.iframeWrapper=document.querySelector(".landing-ui-view-iframe-wrapper");this.iframe=document.querySelector(".landing-ui-view");this.lastActive=this.desktopButton;this.loader=null;this.onDesktopSizeChange=this.onDesktopSizeChange.bind(this);this.onTabletSizeChange=this.onTabletSizeChange.bind(this);this.onMobileSizeChange=this.onMobileSizeChange.bind(this);this.onIframeClick=this.onIframeClick.bind(this);this.onSiteButtonClick=this.onSiteButtonClick.bind(this);this.onPageButtonClick=this.onPageButtonClick.bind(this);this.onUndo=this.onUndo.bind(this);this.onRedo=this.onRedo.bind(this);this.adjustHistoryButtonsState=this.adjustHistoryButtonsState.bind(this);this.bindEvents();i(window,"BX.Landing.History:init",this.adjustHistoryButtonsState);i(window,"BX.Landing.History:update",this.adjustHistoryButtonsState);var a=parseInt(BX.Landing.Main.getInstance().options.sites_count);var s=parseInt(BX.Landing.Main.getInstance().options.pages_count);if(a>1&&this.siteButton){e(this.siteButton,"click",this.onSiteButtonClick)}if(s>1&&this.pageButton){e(this.pageButton,"click",this.onPageButtonClick)}var o=BX.Landing.PageObject.getRootWindow();var d=o.BX.getClass("BX.Landing.History");if(d){o.BX.Landing.History.instance=null}BX.Landing.History.getInstance()};BX.Landing.UI.Panel.Top.instance=null;BX.Landing.UI.Panel.Top.resetInstance=function(){if(BX.Landing.UI.Panel.Top.instance){BX.Landing.UI.Panel.Top.instance.unbindEvents();BX.Landing.UI.Panel.Top.instance=null}};BX.Landing.UI.Panel.Top.getInstance=function(){var t=BX.Landing.PageObject.getRootWindow();if(!t.BX.Landing.UI.Panel.Top.instance){t.BX.Landing.UI.Panel.Top.instance=new BX.Landing.UI.Panel.Top("top_panel")}return t.BX.Landing.UI.Panel.Top.instance};BX.Landing.UI.Panel.Top.prototype={constructor:BX.Landing.UI.Panel.Top,__proto__:BX.Landing.UI.Panel.BasePanel.prototype,superclass:BX.Landing.UI.Panel.BasePanel.prototype,bindEvents:function(){e(this.desktopButton,"click",this.onDesktopSizeChange);e(this.tabletButton,"click",this.onTabletSizeChange);e(this.mobileButton,"click",this.onMobileSizeChange);e(this.iframe.contentDocument,"click",this.onIframeClick);e(this.undoButton,"click",this.onUndo);e(this.redoButton,"click",this.onRedo)},unbindEvents:function(){a(this.desktopButton,"click",this.onDesktopSizeChange);a(this.tabletButton,"click",this.onTabletSizeChange);a(this.mobileButton,"click",this.onMobileSizeChange);a(this.iframe.contentDocument,"click",this.onIframeClick);a(this.undoButton,"click",this.onUndo);a(this.redoButton,"click",this.onRedo)},onKeyDown:function(t){const n=t.keyCode||t.which;if(n===90&&(window.navigator.userAgent.match(/win/i)?t.ctrlKey:t.metaKey)){}},onUndo:function(){if(BX.Landing.History.getInstance().canUndo()&&!this.undoButton.hasAttribute("data-disabled")){this.getLoader().show(this.undoButton);n(this.undoButton,"landing-ui-onload");BX.Landing.History.getInstance().undo().then(function(){this.getLoader().hide();t(this.undoButton,"landing-ui-onload")}.bind(this))}else{this.getLoader().hide();t(this.undoButton,"landing-ui-onload")}},onRedo:function(){if(BX.Landing.History.getInstance().canRedo()&&!this.redoButton.hasAttribute("data-disabled")){this.getLoader().show(this.redoButton);n(this.redoButton,"landing-ui-onload");BX.Landing.History.getInstance().redo().then(function(){this.getLoader().hide();t(this.redoButton,"landing-ui-onload")}.bind(this))}else{this.getLoader().hide();t(this.redoButton,"landing-ui-onload")}},getLoader:function(){if(this.loader===null){this.loader=new BX.Loader({size:23,offset:{top:"3px",left:"1px"}});void d(this.loader.layout.querySelector(".main-ui-loader-svg-circle"),{"stroke-width":"4px"});void d(this.loader.layout.querySelector(".main-ui-loader-svg"),{"margin-top":"-3px"})}return this.loader},adjustHistoryButtonsState:function(t){if(t.canUndo()){this.undoButton.classList.remove("landing-ui-disabled");this.undoButton.removeAttribute("data-disabled")}else{this.undoButton.classList.add("landing-ui-disabled")}if(t.canRedo()){this.redoButton.classList.remove("landing-ui-disabled");this.redoButton.removeAttribute("data-disabled")}else{this.redoButton.classList.add("landing-ui-disabled")}},disableHistory:function(){this.undoButton.classList.add("landing-ui-disabled");this.undoButton.setAttribute("data-disabled","");this.redoButton.classList.add("landing-ui-disabled");this.redoButton.setAttribute("data-disabled","")},enableHistory:function(){this.adjustHistoryButtonsState(BX.Landing.History.getInstance())},disableDevices:function(){this.desktopButton.classList.add("landing-ui-disabled");this.tabletButton.classList.add("landing-ui-disabled");this.mobileButton.classList.add("landing-ui-disabled")},enableDevices:function(){this.desktopButton.classList.remove("landing-ui-disabled");this.tabletButton.classList.remove("landing-ui-disabled");this.mobileButton.classList.remove("landing-ui-disabled")},onDesktopSizeChange:function(){this.lastActive.classList.remove("active");this.lastActive=this.desktopButton;this.desktopButton.classList.add("active");BX.DOM.write(function(){this.iframeWrapper.style.width=null}.bind(this));document.body.setAttribute("data-device","desktop");BX.Landing.Main.getInstance().setDeviceCode("desktop");this.iframeWrapper.dataset.postfix="";BX.Landing.Main.getInstance().enableControls();BX.Landing.Main.getInstance().setNoTouchDevice();BX.Landing.Main.getInstance().makeControlsInternal();BX.Landing.UI.Panel.StylePanel.getInstance().hide();BX.onCustomEvent("BX.Landing.Main:editorSizeChange",["desktop"])},onTabletSizeChange:function(){this.lastActive.classList.remove("active");this.lastActive=this.tabletButton;this.tabletButton.classList.add("active");BX.DOM.write(function(){this.iframeWrapper.style.width="990px"}.bind(this));document.body.setAttribute("data-device","tablet");BX.Landing.Main.getInstance().setDeviceCode("tablet");this.iframeWrapper.dataset.postfix="--md";BX.Landing.Main.getInstance().setTouchDevice();BX.Landing.Main.getInstance().makeControlsInternal();BX.Landing.UI.Panel.StylePanel.getInstance().hide();BX.onCustomEvent("BX.Landing.Main:editorSizeChange",["tablet"])},onMobileSizeChange:function(){this.lastActive.classList.remove("active");this.lastActive=this.mobileButton;this.mobileButton.classList.add("active");BX.DOM.write(function(){this.iframeWrapper.style.width="375px"}.bind(this));document.body.setAttribute("data-device","mobile");BX.Landing.Main.getInstance().setDeviceCode("mobile");this.iframeWrapper.dataset.postfix="--md";BX.Landing.Main.getInstance().setTouchDevice();BX.Landing.Main.getInstance().makeControlsExternal();BX.Landing.UI.Panel.StylePanel.getInstance().hide();BX.onCustomEvent("BX.Landing.Main:editorSizeChange",["mobile"])},onSiteButtonClick:function(t){t.preventDefault();if(!this.siteMenu){var n=new BX.Loader({size:40});this.siteMenu=new BX.PopupMenuWindow({id:"site_list_menu",bindElement:this.siteButton,events:{onPopupClose:function(){this.siteButton.classList.remove("landing-ui-active");this.siteButton.blur()}.bind(this)},menuShowDelay:0,offsetTop:9});this.siteMenu.popupWindow.contentContainer.style.minHeight="60px";this.siteMenu.popupWindow.contentContainer.style.minWidth="160px";n.show(this.siteMenu.popupWindow.contentContainer);var i={siteId:BX.Landing.Main.getInstance().options.site_id,landingId:BX.Landing.Main.getInstance().id,filter:{"=TYPE":BX.Landing.Main.getInstance().options.params.type,SPECIAL:"N"}};BX.Landing.Backend.getInstance().getSites(i).then((function(t){return new Promise((function(n){setTimeout(n.bind(null,t),300)}))})).then(function(t){s(this.siteMenu);o(this.siteMenu);t.forEach((function(t){this.siteMenu.addMenuItem({id:t.ID,text:l(t.TITLE),items:function(){var n=[];var i=BX.Landing.Main.getInstance().options.params.sef_url.site_edit;var e=BX.Landing.Main.getInstance().options.params.sef_url.site_show;n.push({text:BX.Landing.Loc.getMessage("LANDING_ENTITIES_MENU_PAGES_LIST"),href:e.replace("#site_show#",t.ID)});n.push({text:BX.Landing.Loc.getMessage("LANDING_ENTITIES_MENU_EDIT"),href:i.replace("#site_edit#",t.ID)});return n}()})}),this);n.hide()}.bind(this))}this.siteButton.classList.add("landing-ui-active");this.siteMenu.show()},onPageButtonClick:function(t){t.preventDefault();if(!this.pageMenu){var n=new BX.Loader({size:40});this.pageMenu=new BX.PopupMenuWindow({id:"page_list_menu",bindElement:this.pageButton,events:{onPopupClose:function(){this.pageButton.classList.remove("landing-ui-active");this.pageButton.blur()}.bind(this)},menuShowDelay:0,offsetTop:9});this.pageMenu.popupWindow.contentContainer.style.minHeight="60px";this.pageMenu.popupWindow.contentContainer.style.minWidth="160px";n.show(this.pageMenu.popupWindow.contentContainer);var i={siteId:BX.Landing.Main.getInstance().options.site_id,landingId:BX.Landing.Main.getInstance().id,filter:{"=TYPE":BX.Landing.Main.getInstance().options.params.type}};BX.Landing.Backend.getInstance().getLandings({siteId:i.siteId}).then((function(t){return new Promise((function(n){setTimeout(n.bind(null,t),300)}))})).then(function(t){s(this.pageMenu);o(this.pageMenu);t.forEach((function(t){if((t.FOLDER_ID===null||parseInt(t.FOLDER_ID)===0)&&!t.IS_AREA){this.pageMenu.addMenuItem({id:t.ID,text:l(t.TITLE),items:function(){var n=[];var i=BX.Landing.Main.getInstance().options.params.sef_url.landing_edit;var e=BX.Landing.Main.getInstance().options.params.sef_url.landing_view;if(t.FOLDER==="Y"){var a=BX.Landing.Main.getInstance().options.params.sef_url.site_show;n.push({text:BX.Landing.Loc.getMessage("LANDING_ENTITIES_MENU_PAGES_LIST"),href:BX.Landing.Utils.addQueryParams(a.replace("#site_show#",t.SITE_ID),{folderId:t.ID})})}n.push({text:BX.Landing.Loc.getMessage("LANDING_ENTITIES_MENU_PAGES_EDIT"),href:e.replace("#site_show#",t.SITE_ID).replace("#landing_edit#",t.ID)});n.push({text:BX.Landing.Loc.getMessage("LANDING_ENTITIES_MENU_PAGES_SETTINGS"),href:i.replace("#site_show#",t.SITE_ID).replace("#landing_edit#",t.ID)});return n}()})}}),this);requestAnimationFrame((function(){n.hide()}))}.bind(this))}this.pageButton.classList.add("landing-ui-active");this.pageMenu.show()},onIframeClick:function(){if(this.siteMenu){this.siteMenu.close()}if(this.pageMenu){this.pageMenu.close()}},getFormNameLayout:function(){return this.layout.querySelector(".landing-ui-panel-top-form-name")},setFormName:function(t){if(BX.Type.isString(t)){var n=this.getFormNameLayout();if(BX.Type.isDomNode(n)){n.firstElementChild.textContent=t;n.firstElementChild.setAttribute("title",t)}}}}})();
//# sourceMappingURL=top_panel.map.js