Current Path : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/landing/node/ |
Current File : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/landing/node/embed.min.js |
(function(){"use strict";BX.namespace("BX.Landing");var e=BX.Landing.Utils.data;BX.Landing.Block.Node.Embed=function(e){BX.Landing.Block.Node.apply(this,arguments);this.type="embed";this.attribute=["data-src","data-source","data-preview"];this.onAttributeChangeHandler=e.onAttributeChange||function(){};this.lastValue=this.getValue();this.nodeContainer=this.node.closest(BX.Landing.Block.Node.Embed.CONTAINER_SELECTOR)};BX.Landing.Block.Node.Embed.CONTAINER_SELECTOR=".embed-responsive";BX.Landing.Block.Node.Embed.RATIO_CLASSES=["embed-responsive-16by9","embed-responsive-9by16","embed-responsive-4by3","embed-responsive-3by4","embed-responsive-21by9","embed-responsive-9by21","embed-responsive-1by1"];BX.Landing.Block.Node.Embed.DEFAULT_RATIO_V="embed-responsive-9by16";BX.Landing.Block.Node.Embed.DEFAULT_RATIO_H="embed-responsive-16by9";BX.Landing.Block.Node.Embed.prototype={constructor:BX.Landing.Block.Node.Embed,__proto__:BX.Landing.Block.Node.prototype,onChange:function(e){this.lastValue=this.getValue();this.onAttributeChangeHandler(this);this.onChangeHandler(this,e)},isChanged:function(){return JSON.stringify(this.getValue())!==JSON.stringify(this.lastValue)},getValue:function(){const n=this.nodeContainer?BX.Landing.Block.Node.Embed.RATIO_CLASSES.find((e=>this.nodeContainer.classList.contains(e))):"";return{src:this.node.src?this.node.src:e(this.node,"data-src"),source:e(this.node,"data-source"),preview:e(this.node,"data-preview"),ratio:n||""}},setValue:function(n,t,i){if(this.node.src){this.node.src=n.src}else{e(this.node,"data-src",n.src)}e(this.node,"data-source",n.source);if(n.preview){e(this.node,"data-preview",n.preview);this.node.style.backgroundImage='url("'+n.preview+'")'}else{e(this.node,"data-preview",null);this.node.style.backgroundImage=""}if(n.src&&n.ratio&&this.lastValue.src!==n.src&&BX.Landing.Block.Node.Embed.RATIO_CLASSES.indexOf(n.ratio)!==-1&&this.nodeContainer){BX.Landing.Block.Node.Embed.RATIO_CLASSES.forEach((e=>{n.ratio===e?BX.Dom.addClass(this.nodeContainer,e):BX.Dom.removeClass(this.nodeContainer,e)}))}if(this.isChanged()){if(!i){BX.Landing.History.getInstance().push()}this.onChange(i)}},getField:function(){const e={title:this.manifest.name,selector:this.selector,content:this.getValue()};if(BX.Dom.hasClass(this.node.parentNode,"bg-video__inner")){return new BX.Landing.UI.Field.EmbedBg(e)}return new BX.Landing.UI.Field.Embed(e)}}})(); //# sourceMappingURL=embed.map.js