Your IP : 3.142.42.247


Current Path : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/landing/node/img/dist/
Upload File :
Current File : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/landing/node/img/dist/img.bundle.min.js

this.BX=this.BX||{};this.BX.Landing=this.BX.Landing||{};(function(e,t,i){"use strict";const n=BX.Landing.Utils.attr;const s=BX.Landing.Utils.data;const a=BX.Landing.Utils.encodeDataValue;const l=BX.Landing.Utils.decodeDataValue;class o extends t.Base{constructor(e){super(e);this.type="img";this.editPanel=null;this.lastValue=null;this.field=null;this.uploadParams=e.uploadParams;if(!this.isGrouped()){this.node.addEventListener("click",this.onClick.bind(this))}if(this.isAllowInlineEdit()){this.node.setAttribute("title",BX.Landing.Loc.getMessage("LANDING_TITLE_OF_IMAGE_NODE"))}}onClick(e){BX.Event.EventEmitter.emit("BX.Landing.Node.Img:onClick");if(this.manifest.allowInlineEdit!==false&&BX.Landing.Main.getInstance().isControlsEnabled()&&(!BX.Landing.Node.Text.currentNode||!BX.Landing.Node.Text.currentNode.isEditable())&&!BX.Landing.UI.Panel.StylePanel.getInstance().isShown()){e.preventDefault();e.stopPropagation();BX.Landing.UI.Button.ColorAction.hideAll();if(!this.editPanel){this.editPanel=new BX.Landing.UI.Panel.Content(this.selector,{title:BX.Landing.Loc.getMessage("LANDING_IMAGE_PANEL_TITLE"),className:"landing-ui-panel-edit-image"});this.editPanel.appendFooterButton(new BX.Landing.UI.Button.BaseButton("save_block_content",{text:BX.Landing.Loc.getMessage("BLOCK_SAVE"),onClick:this.save.bind(this),className:"landing-ui-button-content-save"}));this.editPanel.appendFooterButton(new BX.Landing.UI.Button.BaseButton("cancel_block_content",{text:BX.Landing.Loc.getMessage("BLOCK_CANCEL"),onClick:this.editPanel.hide.bind(this.editPanel),className:"landing-ui-button-content-cancel"}));window.parent.document.body.appendChild(this.editPanel.layout)}const t=new BX.Landing.UI.Form.BaseForm({title:this.manifest.name});t.addField(this.getField());this.editPanel.clear();this.editPanel.appendForm(t);this.editPanel.show();BX.Landing.UI.Panel.EditorPanel.getInstance().hide()}}save(){const e=this.editPanel.forms[0].fields[0].getValue();if(JSON.stringify(this.getValue())!==JSON.stringify(e)){this.setValue(e)}this.editPanel.hide()}getField(){if(this.field){this.field.setValue(this.getValue());this.field.content=this.getValue();requestAnimationFrame((()=>{this.field.adjustPreviewBackgroundSize()}))}else{let t="";if(this.manifest.dimensions){const e=this.manifest.dimensions;const i=e.width||e.maxWidth||e.minWidth;const n=e.height||e.maxHeight||e.minHeight;if(i&&!n){t=`${BX.Landing.Loc.getMessage("LANDING_CONTENT_IMAGE_RECOMMENDED_WIDTH")} `;t+=`${i}px`}else if(n&&!i){t=`${BX.Landing.Loc.getMessage("LANDING_CONTENT_IMAGE_RECOMMENDED_HEIGHT")} `;t+=`${n}px`}else if(i&&n){t=`${BX.Landing.Loc.getMessage("LANDING_CONTENT_IMAGE_RECOMMENDED_SIZE")} `;t+=`${i}px / `;t+=`${n}px`}}const n=this.getValue();if(n.url){n.url=l(n.url)}const s=!!this.node.closest("a")||!!this.manifest.disableLink;if(this.manifest.editInStyle!==true){var e;this.field=new BX.Landing.UI.Field.Image({selector:this.selector,title:this.manifest.name,description:t,disableLink:s,isAiImageAvailable:i.Env.getInstance().getOptions()["ai_image_available"],isAiImageActive:i.Env.getInstance().getOptions()["ai_image_active"],aiUnactiveInfoCode:i.Env.getInstance().getOptions()["ai_unactive_info_code"],content:n,dimensions:(e=this.manifest.dimensions)!=null?e:{},create2xByDefault:this.manifest.create2xByDefault,disableAltField:d(this.node),uploadParams:this.uploadParams})}}return this.field}setValue(e,t,i){this.lastValue=this.lastValue||this.getValue();this.preventSave(t);if(e&&e.src){e.src=decodeURIComponent(e.src)}if(r(this.node)){B(this.node,e)}if(d(this.node)){p(this.node,e)}if(e.url){const t=this.preparePseudoUrl(e.url);if(t!==null){n(this.node,"data-pseudo-url",t)}}this.onChange(i);if(!i){BX.Landing.History.getInstance().push()}this.lastValue=this.getValue()}getValue(){const e={type:"",src:"",alt:"",url:""};const t=parseInt(this.node.dataset.fileid,10);if(t>0){e.id=t}const i=parseInt(this.node.dataset.fileid2x,10);if(i>0){e.id2x=i}if(d(this.node)){e.type="background";e.src=c(this.node);const t=u(this.node);if(t){e.src2x=t}}if(r(this.node)){e.type="image";e.alt=g(this);e.src=f(this.node);const t=m(this.node);if(t){e.src2x=t}}e.url=a(h(this))||{text:"",href:"",target:"_self",enabled:false};return e}preparePseudoUrl(e){let t=false;if(!(e.href==="#"&&e.target==="")){t=true}if(e.href==="selectActions:"){e.href="";e.enabled=false;t=true}if(e.href.startsWith("product:")){e.target="_self";t=true}if(e.enabled!==false&&(e.href===""||e.href==="#")){e.enabled=false;t=true}if(e.target===""){e.target="_blank";t=true}if(t===true){return e}return null}}BX.Landing.Node.Img=o;function d(e){return e.nodeName!=="IMG"}function r(e){return e.nodeName==="IMG"}function c(e){const t=e.style.getPropertyValue("background-image");if(t){const e=t.match(/url\((.*?)\)/);if(e&&e[1]){return e[1].replace(/["'|]/g,"")}}return""}function u(e){const t=e.style.getPropertyValue("background-image");if(t){const e=t.match(/1x, url\(["'|](.*)["'|]\) 2x\)/);if(e&&e[1]){return e[1].replace(/["'|]/g,"")}}return""}function g(e){const t=n(e.node,"alt");return t||""}function h(e){const t=s(e.node,"data-pseudo-url");return t||""}function f(e){const t=n(e,"src");return t||""}function m(e){const t=n(e,"srcset");return t?t.replace(" 2x",""):""}function B(e,t){if(r(e)){e.src=t.src;e.alt=t.alt||"";e.dataset.fileid=t.id||-1;e.srcset=t.src2x?`${t.src2x} 2x`:"";e.dataset.fileid2x=t.id2x||-1}else{const i=BX.create("img",{attrs:{src:t.src,alt:t.alt,"data-fileid":t.id}});BX.Dom.insertBefore(i,e);BX.remove(e)}}function p(e,t){if(d(e)){if(t.src){const i=[`background-image: url("${t.src}");`];if(t.src2x){i.push(`background-image: -webkit-image-set(url("${t.src}") 1x, url("${t.src2x}") 2x);`,`background-image: image-set(url("${t.src}") 1x, url("${t.src2x}") 2x);`)}const n=e.style;const s={};[...n].forEach((e=>{s[e]=n.getPropertyValue(e)}));e.setAttribute("style",i.join(" "));for(const t in s){if(t!=="background-image"){BX.Dom.style(e,t,s[t])}}}else if(e.style){BX.Dom.style(e,"background-image",null)}e.dataset.fileid=t.id||-1;e.dataset.fileid2x=t.id2x||-1}else{const i=BX.create("div",{attrs:{style:`background-image: url("${t.src}")`,"data-fileid":t.id}});BX.Dom.insertBefore(i,e);BX.Dom.remove(e)}}e.Img=o})(this.BX.Landing.Node=this.BX.Landing.Node||{},BX.Landing.Node,BX.Landing);
//# sourceMappingURL=img.bundle.map.js