Your IP : 3.145.105.85


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

{"version":3,"file":"textcrop.bundle.js","sources":["../src/index.js"],"sourcesContent":["import { Tag, Type } from 'main.core';\n\nexport class TextCrop\n{\n\tconstructor(options)\n\t{\n\t\tthis.target = options.target || null;\n\t\tthis.rows = options.rows || 2;\n\t\tthis.resize = options.resize || false;\n\t\tthis.text = null;\n\t\tthis.rowHeight = null;\n\n\t\tthis.layout = {\n\t\t\twrapper: null,\n\t\t\tbasicBlock: null\n\t\t}\n\t}\n\n\tgetText()\n\t{\n\t\tif(!this.text)\n\t\t{\n\t\t\tthis.text = BX.util.htmlspecialchars(this.target\n\t\t\t\t? this.target.innerText\n\t\t\t\t: null);\n\t\t}\n\n\t\treturn this.text;\n\t}\n\n\tgetWrapper()\n\t{\n\t\tif(!this.layout.wrapper)\n\t\t{\n\t\t\tthis.layout.wrapper = Tag.render`\n\t\t\t\t<div>${this.getText()}</div>\n\t\t\t`;\n\t\t}\n\n\t\treturn this.layout.wrapper;\n\t}\n\n\tgetBasicBlock()\n\t{\n\t\tif(!this.layout.basicBlock)\n\t\t{\n\t\t\tthis.layout.basicBlock = Tag.render`\n\t\t\t\t<div>a</div>\n\t\t\t`;\n\t\t}\n\n\t\treturn this.layout.basicBlock;\n\t}\n\n\tgetRowHeight()\n\t{\n\t\tif(!this.rowHeight)\n\t\t{\n\t\t\tlet styleAtt = getComputedStyle(this.getWrapper());\n\n\t\t\tif (styleAtt.lineHeight  === 'normal')\n\t\t\t{\n\t\t\t\tlet firstHeight = this.getWrapper().offsetHeight;\n\t\t\t\tthis.layout.wrapper.appendChild(this.getBasicBlock());\n\t\t\t\tlet secondHeight = this.getWrapper().offsetHeight;\n\t\t\t\tthis.getBasicBlock().remove();\n\n\t\t\t\tthis.rowHeight = secondHeight - firstHeight;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tthis.rowHeight = styleAtt.lineHeight;\n\t\t\t}\n\t\t}\n\n\t\treturn this.rowHeight;\n\t}\n\n\tcropResize()\n\t{\n\t\tif(this.resize)\n\t\t{\n\t\t\tlet timer;\n\t\t\twindow.addEventListener('resize', () => {\n\t\t\t\tif (!timer)\n\t\t\t\t{\n\t\t\t\t\ttimer = setTimeout(() => {\n\t\t\t\t\t\tthis.init();\n\t\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\t}, 100);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tcrop()\n\t{\n\t\tthis.init();\n\t}\n\n\tinit()\n\t{\n\t\tif(!Type.isDomNode(this.target))\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\tthis.getText();\n\t\tthis.target.innerText = '';\n\t\tthis.layout.wrapper = '';\n\t\tthis.target.appendChild(this.getWrapper());\n\n\t\tlet rowHeight = this.getRowHeight();\n\t\tlet cropText = '';\n\t\tlet numberRows = this.getWrapper().offsetHeight / parseInt(rowHeight);\n\n\t\tif (numberRows > this.rows)\n\t\t{\n\t\t\tthis.target.setAttribute('title', this.getText());\n\n\t\t\twhile (this.getWrapper().offsetHeight / parseInt(rowHeight) > this.rows)\n\t\t\t{\n\t\t\t\tcropText = this.layout.wrapper.textContent.substring(0, this.layout.wrapper.textContent.length - 4);\n\t\t\t\tthis.layout.wrapper.textContent = cropText + '...';\n\t\t\t}\n\t\t}\n\n\t\tthis.cropResize();\n\t}\n}\n\n"],"names":["TextCrop","constructor","options","target","rows","resize","text","rowHeight","layout","wrapper","basicBlock","getText","BX","util","htmlspecialchars","innerText","getWrapper","Tag","render","getBasicBlock","getRowHeight","styleAtt","getComputedStyle","lineHeight","firstHeight","offsetHeight","appendChild","secondHeight","remove","cropResize","timer","window","addEventListener","setTimeout","init","clearTimeout","crop","Type","isDomNode","cropText","numberRows","parseInt","setAttribute","textContent","substring","length"],"mappings":";;;;;;;;AAAA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