Your IP : 3.138.123.215


Current Path : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/ui/textcrop/dist/
Upload File :
Current File : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/ui/textcrop/dist/bundle.min.js

this.BX=this.BX||{};(function(t,e){"use strict";var i,r;var s=function(){function t(e){babelHelpers.classCallCheck(this,t);this.target=e.target||null;this.rows=e.rows||2;this.resize=e.resize||false;this.text=null;this.rowHeight=null;this.layout={wrapper:null,basicBlock:null}}babelHelpers.createClass(t,[{key:"getText",value:function t(){if(!this.text){this.text=BX.util.htmlspecialchars(this.target?this.target.innerText:null)}return this.text}},{key:"getWrapper",value:function t(){if(!this.layout.wrapper){this.layout.wrapper=e.Tag.render(i||(i=babelHelpers.taggedTemplateLiteral(["\n\t\t\t\t<div>","</div>\n\t\t\t"])),this.getText())}return this.layout.wrapper}},{key:"getBasicBlock",value:function t(){if(!this.layout.basicBlock){this.layout.basicBlock=e.Tag.render(r||(r=babelHelpers.taggedTemplateLiteral(["\n\t\t\t\t<div>a</div>\n\t\t\t"])))}return this.layout.basicBlock}},{key:"getRowHeight",value:function t(){if(!this.rowHeight){var e=getComputedStyle(this.getWrapper());if(e.lineHeight==="normal"){var i=this.getWrapper().offsetHeight;this.layout.wrapper.appendChild(this.getBasicBlock());var r=this.getWrapper().offsetHeight;this.getBasicBlock().remove();this.rowHeight=r-i}else{this.rowHeight=e.lineHeight}}return this.rowHeight}},{key:"cropResize",value:function t(){var e=this;if(this.resize){var i;window.addEventListener("resize",(function(){if(!i){i=setTimeout((function(){e.init();clearTimeout(i)}),100)}}))}}},{key:"crop",value:function t(){this.init()}},{key:"init",value:function t(){if(!e.Type.isDomNode(this.target)){return}this.getText();this.target.innerText="";this.layout.wrapper="";this.target.appendChild(this.getWrapper());var i=this.getRowHeight();var r="";var s=this.getWrapper().offsetHeight/parseInt(i);if(s>this.rows){this.target.setAttribute("title",this.getText());while(this.getWrapper().offsetHeight/parseInt(i)>this.rows){r=this.layout.wrapper.textContent.substring(0,this.layout.wrapper.textContent.length-4);this.layout.wrapper.textContent=r+"..."}}this.cropResize()}}]);return t}();t.TextCrop=s})(this.BX.UI=this.BX.UI||{},BX);
//# sourceMappingURL=bundle.map.js