Your IP : 18.118.7.113


Current Path : /home/bitrix/ext_www/easy-comfort.com.ua/bitrix/js/landing/node/
Upload File :
Current File : /home/bitrix/ext_www/easy-comfort.com.ua/bitrix/js/landing/node/img.min.js

(function(){"use strict";BX.namespace("BX.Landing");var e=BX.Landing.Utils.attr;var t=BX.Landing.Utils.data;var i=BX.Landing.Utils.encodeDataValue;var n=BX.Landing.Utils.decodeDataValue;BX.Landing.Block.Node.Img=function(e){BX.Landing.Block.Node.apply(this,arguments);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.message("LANDING_TITLE_OF_IMAGE_NODE"))}};function a(e){return e.node.nodeName!=="IMG"}function s(e){return e.node.nodeName==="IMG"}function d(e){return e.node.nodeName==="SPAN"||e.node.nodeName==="I"||e.node.nodeName==="EM"}function o(e){var t=e.node.getAttribute("style");var i=t.split(";")[0].match(/url\((.*)\)/);if(i&&i[1]){return i[1].replace(/["|']/g,"")}return""}function l(e){var t=e.node.getAttribute("style");var i=t.match(/1x, url\(["|'](.*)["|']\) 2x\); /);if(i&&i[1]){return i[1].replace(/["|']/g,"")}return""}function r(e){var t=parseInt(e.node.dataset.fileid);return t===t?t:-1}function u(e){var t=parseInt(e.node.dataset.fileid2x);return t===t?t:-1}function c(t){var i=e(t.node,"alt");return!!i?i:""}function h(e){var i=t(e.node,"data-pseudo-url");return!!i?i:""}function g(t){var i=e(t.node,"src");return!!i?i:""}function f(t){var i=e(t.node,"srcset");return!!i?i.replace(" 2x",""):""}function m(e,t){if(!s(e)){var i=BX.create("img",{attrs:{src:t.src,alt:t.alt,"data-fileid":t.id}});e.node.parentNode.insertBefore(i,e.node);BX.remove(e.node);e.node=i}else{e.node.src=t.src;e.node.alt=t.alt;e.node.dataset.fileid=t.id||-1;e.node.srcset=t.src2x?t.src2x+" 2x":"";e.node.dataset.fileid2x=t.fileid2x||-1}}function B(e,t){if(!a(e)){var i=BX.create("div",{attrs:{style:'background-image: url("'+t.src+'")',"data-fileid":t.id}});e.node.parentNode.insertBefore(i,e.node);BX.remove(e.node);e.node=i}else{e.node.style.backgroundImage='url("'+t.src+'")';if(t.src2x){var n=['background-image: url("'+t.src+'");','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);'].join(" ");e.node.setAttribute("style",n)}e.node.dataset.fileid=t.id||-1;e.node.dataset.fileid2x=t.id2x||-1}}BX.Landing.Block.Node.Img.prototype={__proto__:BX.Landing.Block.Node.prototype,constructor:BX.Landing.Block.Node.Img,onClick:function(e){if(this.manifest.allowInlineEdit!==false&&BX.Landing.Main.getInstance().isControlsEnabled()&&(!BX.Landing.Block.Node.Text.currentNode||!BX.Landing.Block.Node.Text.currentNode.isEditable())&&!BX.Landing.UI.Panel.StylePanel.getInstance().isShown()){e.preventDefault();e.stopPropagation();BX.Landing.UI.Button.FontAction.hideAll();BX.Landing.UI.Button.ColorAction.hideAll();if(!this.editPanel){this.editPanel=new BX.Landing.UI.Panel.Content(this.selector,{title:BX.message("LANDING_IMAGE_PANEL_TITLE"),className:"landing-ui-panel-edit-image"});this.editPanel.appendFooterButton(new BX.Landing.UI.Button.BaseButton("save_block_content",{text:BX.message("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.message("BLOCK_CANCEL"),onClick:this.editPanel.hide.bind(this.editPanel),className:"landing-ui-button-content-cancel"}));document.body.appendChild(this.editPanel.layout)}var 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();BX.Landing.UI.Panel.SmallEditorPanel.getInstance().hide()}},save:function(){var e=this.editPanel.forms[0].fields[0].getValue();if(JSON.stringify(this.getValue())!==JSON.stringify(e)){this.setValue(e)}this.editPanel.hide()},getField:function(){if(!this.field){var e="";if(this.manifest.dimensions){e=BX.message("LANDING_CONTENT_IMAGE_RECOMMENDED_SIZE")+" ";e+=this.manifest.dimensions.width+"px / ";e+=this.manifest.dimensions.height+"px"}var t=this.getValue();t.url=n(t.url);var i=!!this.node.closest("a");this.field=new BX.Landing.UI.Field.Image({selector:this.selector,title:this.manifest.name,description:e,disableLink:i,content:t,dimensions:!!this.manifest.dimensions?this.manifest.dimensions:{},disableAltField:a(this),uploadParams:this.uploadParams})}else{this.field.setValue(this.getValue());this.field.content=this.getValue();requestAnimationFrame(function(){this.field.adjustPreviewBackgroundSize()}.bind(this))}return this.field},setValue:function(t,i,n){this.lastValue=this.lastValue||this.getValue();this.preventSave(i);t.src=decodeURIComponent(t.src);if(s(this)){m(this,t)}if(a(this)){B(this,t)}if(t.url){e(this.node,"data-pseudo-url",t.url)}this.onChange();if(!n){BX.Landing.History.getInstance().push(new BX.Landing.History.Entry({block:this.getBlock().id,selector:this.selector,command:"editImage",undo:this.lastValue,redo:this.getValue()}))}this.lastValue=this.getValue()},getValue:function(){var e={type:"",src:"",src2x:"",id:-1,id2x:-1,alt:"",url:""};if(a(this)){e.type="background";e.src=o(this);e.src2x=l(this);e.id=r(this);e.id2x=u(this)}if(s(this)){e.type="image";e.src=g(this);e.src2x=f(this);e.id=r(this);e.id2x=u(this);e.alt=c(this)}e.url=i(h(this))||{text:"",href:"",target:"_self",enabled:false};return e}}})();
//# sourceMappingURL=img.map.js