Current Path : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/landing/ui/panel/ |
Current File : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/landing/ui/panel/image_panel.min.js |
(function(){"use strict";BX.namespace("BX.Landing.UI.Panel");BX.Landing.UI.Panel.Image=function(n){BX.Landing.UI.Panel.Content.apply(this,arguments);this.layout.classList.add("landing-ui-panel-image");this.onChangeHandler=function(){};this.headerButtonsField=this.createHeaderButtons();this.cards=new BX.Landing.Collection.BaseCollection;this.overlay.classList.add("landing-ui-panel-image");this.title.appendChild(this.headerButtonsField.layout);this.title.innerText=BX.Landing.Loc.getMessage("LANDING_IMAGE_LIBRARY_PANEL_TITLE");if(BX.Landing.Main.isEditorMode()){if(BX.Landing.Main.isExternalControlsEnabled()||window.parent&&window.parent!==top){window.parent.document.body.appendChild(this.layout);return}}this.overlay.parentNode.removeChild(this.overlay);document.body.appendChild(this.overlay);document.body.appendChild(this.layout)};BX.Landing.UI.Panel.Image.getInstance=function(){if(!BX.Landing.UI.Panel.Image.instance){BX.Landing.UI.Panel.Image.instance=new BX.Landing.UI.Panel.Image("image_panel")}return BX.Landing.UI.Panel.Image.instance};BX.Landing.UI.Panel.Image.instance=null;BX.Landing.UI.Panel.Image.prototype={constructor:BX.Landing.UI.Panel.Image,__proto__:BX.Landing.UI.Panel.Content.prototype,onChangeView:function(n){if(n==="unsplash"){this.showUnsplash()}if(n==="google"){this.showGoogle()}if(n==="disk"){this.showUploader()}},showUploader:function(){var n=this.cards.get("uploader");if(!n){n=new BX.Landing.UI.Card.Uploader({id:"uploader"});this.appendCard(n);this.cards.add(n)}this.hideAll();n.show()},showGoogle:function(){var n=this.cards.get("google");if(!n){n=new BX.Landing.UI.Card.Google({id:"google",searchLabel:BX.Landing.Loc.getMessage("GOOGLE_SEARCH_FIELD_LABEL"),searchTips:[{name:"Nature",value:"Nature"},{name:"People",value:"People"},{name:"Buildings",value:"Buildings"},{name:"Sunset",value:"Sunset"}],description:BX.Landing.Loc.getMessage("LANDING_IMAGE_GOOGLE_DESCRIPTION"),onChange:this.onChange.bind(this),params:this.uploadParams});this.appendCard(n);this.cards.add(n)}this.hideAll();n.showPopular();n.show()},showUnsplash:function(){var n=this.cards.get("unsplash");if(!n){n=new BX.Landing.UI.Card.Unsplash({id:"unsplash",searchLabel:BX.Landing.Loc.getMessage("UNSPLASH_SEARCH_FIELD_LABEL"),searchTips:[{name:"Nature",value:"Nature"},{name:"People",value:"People"},{name:"Buildings",value:"Buildings"},{name:"Sunset",value:"Sunset"}],description:BX.Landing.Loc.getMessage("LANDING_IMAGE_UNSPLASH_DESCRIPTION"),onChange:this.onChange.bind(this)});this.appendCard(n);this.cards.add(n)}this.hideAll();n.show()},hideAll:function(){this.cards.forEach((function(n){n.layout.hidden=true}))},createHeaderButtons:function(){return new BX.Landing.UI.Field.ButtonGroup({items:[{name:BX.Landing.Loc.getMessage("LANDING_CONTENT_EDIT_IMAGE_HEADER_BUTTON_UNSPLASH"),value:"unsplash",active:true},{name:BX.Landing.Loc.getMessage("LANDING_CONTENT_EDIT_IMAGE_HEADER_BUTTON_GOOGLE"),value:"google"},{name:BX.Landing.Loc.getMessage("LANDING_CONTENT_EDIT_IMAGE_HEADER_BUTTON_FROM_DISK"),value:"disk"}],onChange:this.onChangeView.bind(this)})},show:function(n,e,a,i){this.uploadParams=i||{};this.externalLoader=a;this.params=e;this.onChangeView(n);BX.Landing.UI.Panel.Content.prototype.show.call(this);return new Promise(function(n){this.promiseResolve=n}.bind(this))},hide:function(){this.params=null;BX.Landing.UI.Panel.Content.prototype.hide.call(this)},onChange:function(n){this.externalLoader.show();BX.Landing.Utils.urlToBlob(n.link).then((function(e){e.lastModifiedDate=new Date;e.name=(n.name+"").split("?")[0];return e})).then(this.promiseResolve.bind(this));this.hide()}}})(); //# sourceMappingURL=image_panel.map.js