Your IP : 3.21.104.128
(function(){"use strict";BX.namespace("BX.Landing");var t=BX.Landing.Utils.trim;var e=BX.Landing.Utils.isPlainObject;var i=BX.Landing.Utils.isString;var n=BX.Landing.Utils.textToPlaceholders;var a=BX.Landing.Utils.create;var s=BX.Landing.Utils.escapeText;var o=BX.Landing.Utils.decodeDataValue;BX.Landing.Block.Node.Link=function(t){BX.Landing.Block.Node.apply(this,arguments);if(!this.isGrouped()){this.node.addEventListener("click",this.onClick.bind(this))}if(this.isAllowInlineEdit()){this.node.setAttribute("title",BX.message("LANDING_TITLE_OF_LINK_NODE"))}};BX.Landing.Block.Node.Link.prototype={__proto__:BX.Landing.Block.Node.prototype,constructor:BX.Landing.Block.Node.Link,onContentUpdate:function(){clearTimeout(this.contentEditTimeout);this.contentEditTimeout=setTimeout(function(){BX.Landing.History.getInstance().push(new BX.Landing.History.Entry({block:this.getBlock().id,selector:this.selector,command:"editLink",undo:this.startValue,redo:this.getValue()}));this.startValue=null}.bind(this),400);this.getField().setValue(this.getValue())},onClick:function(t){t.preventDefault();t.stopPropagation();BX.Landing.UI.Button.FontAction.hideAll();BX.Landing.UI.Button.ColorAction.hideAll();if(!BX.Landing.UI.Panel.StylePanel.getInstance().isShown()){BX.Landing.UI.Panel.Link.getInstance().show(this)}},isPrevented:function(){return this.getValue().target==="_popup"},setValue:function(t,e,n){this.startValue=this.startValue||this.getValue();this.preventSave(e);if(!this.containsImage()){var a=this.getField(true).hrefInput;if(i(t.text)&&t.text.includes("{{name}}")){a.getPlaceholderData(t.href).then(function(e){this.node.innerHTML=t.text.replace(new RegExp("{{name}}"),'<span data-placeholder="name">'+e.name+"</span>")}.bind(this))}else{if(!this.getField().containsHtml()&&!this.manifest.skipContent){this.node.innerHTML=s(t.text)}}}this.node.setAttribute("href",o(t.href));this.node.setAttribute("target",s(t.target));if("attrs"in t){for(var d in t.attrs){if(t.attrs.hasOwnProperty(d)){this.node.setAttribute(d,t.attrs[d])}}}else{this.node.removeAttribute("data-url");this.node.removeAttribute("data-embed")}this.onChange();if(!n){this.onContentUpdate()}},containsImage:function(){return!!this.node.firstElementChild&&this.node.firstElementChild.tagName==="IMG"},getValue:function(){var i={text:n(t(this.node.innerHTML)),href:t(this.node.getAttribute("href")),target:t(this.node.getAttribute("target")||"_self")};if(this.node.getAttribute("data-url")){i.attrs={"data-url":t(this.node.getAttribute("data-url"))}}if(this.node.getAttribute("data-dynamic")){if(!e(i.attrs)){i.attrs={}}i.attrs["data-dynamic"]=this.node.getAttribute("data-dynamic")}if(this.manifest.skipContent){i["skipContent"]=true;delete i.text}return i},getField:function(t){var e=this.getValue();e.text=n(a("div",{html:e.text}).innerHTML);if(!this.field){var i=[BX.Landing.UI.Field.LinkURL.TYPE_BLOCK,BX.Landing.UI.Field.LinkURL.TYPE_PAGE];if(BX.Landing.Main.getInstance().options.params.type===BX.Landing.Main.TYPE_STORE){i.push(BX.Landing.UI.Field.LinkURL.TYPE_CATALOG)}this.field=new BX.Landing.UI.Field.Link({title:this.manifest.name,selector:this.selector,skipContent:this.manifest.skipContent,content:e,options:{siteId:BX.Landing.Main.getInstance().options.site_id,landingId:BX.Landing.Main.getInstance().id,filter:{"=TYPE":BX.Landing.Main.getInstance().options.params.type}},allowedTypes:i})}else{if(!t){this.field.setValue(e);this.field.content=e;this.field.hrefInput.content=e.href;this.field.hrefInput.makeDisplayedHrefValue();this.field.hrefInput.removeHrefTypeFromHrefString()}}return this.field}}})();