Current Path : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/ui/tooltip/dist/ |
Current File : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/ui/tooltip/dist/tooltip.bundle.min.js |
this.BX=this.BX||{};(function(exports,main_core,main_core_events){"use strict";class Tooltip{static disable(){this.disabled=true}static enable(){this.disabled=false}static getDisabledStatus(){return this.disabled}static getLoader(){return"/bitrix/tools/tooltip.php"}static getIdPrefix(){return"bx-ui-tooltip-"}}Tooltip.disabled=false;Tooltip.tooltipsList={};class TooltipBalloon{constructor(t){this.node=null;this.userId=null;this.loader=null;this.version=null;this.tracking=false;this.active=false;this.width=364;this.height=215;this.realAnchor=null;this.coordsLeft=0;this.coordsTop=0;this.anchorRight=0;this.anchorTop=0;this.hMirror=false;this.vMirror=false;this.rootClassName="";this.INFO=null;this.DIV=null;this.ROOT_DIV=null;this.params={};this.trackMouseHandle=this.trackMouse.bind(this);this.init(t);this.create();return this}init(t){this.node=t.node;this.userId=t.userId;this.loader=main_core.Type.isStringFilled(t.loader)?t.loader:"";this.version=!main_core.Type.isUndefined(t.version)&&parseInt(t.version)>0?parseInt(t.version):main_core.Type.isStringFilled(this.loader)?2:3;this.rootClassName=this.node.getAttribute("bx-tooltip-classname");const i=this.node.getAttribute("bx-tooltip-params");let e={};if(main_core.Type.isStringFilled(i)){e=JSON.parse(i);if(!main_core.Type.isPlainObject(e)){e={}}}this.params=e}create(){if(!Tooltip.getDisabledStatus()){this.startTrackMouse()}this.node.addEventListener("mouseout",this.stopTrackMouse.bind(this));main_core_events.EventEmitter.subscribe("SidePanel.Slider:onOpen",this.onSliderOpen.bind(this))}onSliderOpen(){if(this.tracking){this.stopTrackMouse()}else{this.hideTooltip()}}startTrackMouse(){if(this.tracking){return}const t=BX.pos(this.node);this.realAnchor=this.node;this.coordsLeft=t.width<40?t.left-35:t.left+0;this.coordsTop=t.top-245;this.anchorRight=t.right;this.anchorTop=t.top;this.tracking=true;document.addEventListener("mousemove",this.trackMouseHandle);setTimeout((()=>{this.tickTimer()}),500);this.node.addEventListener("mouseout",this.stopTrackMouse.bind(this))}stopTrackMouse(){if(!this.tracking){return}document.removeEventListener("mousemove",this.trackMouseHandle);this.active=false;setTimeout((()=>{this.hideTooltip()}),500);this.tracking=false}trackMouse(t){if(!this.tracking){return}const i=t&&t.pageX?{x:t.pageX,y:t.pageY}:{x:t.clientX+document.body.scrollLeft,y:t.clientY+document.body.scrollTop};if(i.x<0){i.x=0}if(i.y<0){i.y=0}i.time=this.tracking;if(!this.active){this.active=i}else{if(this.active.x>=i.x-1&&this.active.x<=i.x+1&&this.active.y>=i.y-1&&this.active.y<=i.y+1){if(this.active.time+20<=i.time){this.showTooltip()}}else{this.active=i}}}tickTimer(){if(!this.tracking){return}this.tracking++;if(this.active){if(this.active.time+5<=this.tracking){this.showTooltip()}}setTimeout((()=>{this.tickTimer()}),100)}hideTooltip(){if(this.tracking){return}this.showOpacityEffect(1)}showOpacityEffect(t){const i=3;const e=1;const s=1/i;let o=0;const a=setInterval((()=>{o++;if(o>i){clearInterval(a);return}const e=t?1-o*s:o*s;if(this.DIV!=null){try{this.DIV.style.opacity=e}catch(t){}finally{if(!t&&o==1){this.DIV.classList.add("ui-tooltip-info-shadow-show");this.DIV.style.display="block"}if(t&&o==i&&this.DIV){this.DIV.classList.remove("ui-tooltip-info-shadow-show");this.DIV.classList.add("ui-tooltip-info-shadow-hide");setTimeout((()=>{this.DIV.style.display="none"}),500)}if(t){main_core_events.EventEmitter.emit("onTooltipHide",new main_core_events.BaseEvent({compatData:[this]}))}}}}),e)}showTooltip(){const t=document.getElementById(`${Tooltip.getIdPrefix()}${this.userId}`);if(Tooltip.getDisabledStatus()||t&&t.classList.contains("ui-tooltip-info-shadow-show")){return}if(null==this.DIV&&null==this.ROOT_DIV){this.ROOT_DIV=document.body.appendChild(document.createElement("DIV"));this.ROOT_DIV.style.position="absolute";BX.ZIndexManager.register(this.ROOT_DIV);this.DIV=this.ROOT_DIV.appendChild(document.createElement("DIV"));this.DIV.className="bx-ui-tooltip-info-shadow";this.DIV.style.width=`${this.width}px`}let i=this.coordsLeft;const e=this.coordsTop+30;const s=BX.GetWindowScrollPos();const o=document.body;this.hMirror=false;this.vMirror=e-s.scrollTop-50<0;if(o.clientWidth+s.scrollLeft<i+this.width){i=this.anchorRight-this.width;this.hMirror=true}this.ROOT_DIV.style.left=`${parseInt(i)}px`;this.ROOT_DIV.style.top=`${parseInt(e)}px`;BX.ZIndexManager.bringToFront(this.ROOT_DIV);this.ROOT_DIV.addEventListener("click",(t=>{t.stopPropagation()}));if(main_core.Type.isStringFilled(this.rootClassName)){this.ROOT_DIV.className=this.rootClassName}const a=main_core.Type.isStringFilled(this.loader)?this.loader:Tooltip.getLoader();let n=false;if(""==this.DIV.innerHTML){n=true;if(this.version>=3){main_core.ajax.runComponentAction("bitrix:ui.tooltip","getData",{mode:"ajax",data:{userId:this.userId,params:!main_core.Type.isUndefined(this.params)?this.params:{}}}).then((t=>{const i=main_core.Type.isStringFilled(t.data.user.detailUrl)?t.data.user.detailUrl:"";let e="";if(main_core.Type.isStringFilled(t.data.user.nameFormatted)){const{nameFormatted:s=""}=t.data.user;if(main_core.Type.isStringFilled(i)){e=`\n\t\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\t\tclass="bx-ui-tooltip-user-name"\n\t\t\t\t\t\t\t\t\t\t\t\ttitle="${s}"\n\t\t\t\t\t\t\t\t\t\t\t\thref="${i}"\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t${t.data.user.nameFormatted}\n\t\t\t\t\t\t\t\t\t\t\t</a>`}else{e=`\n\t\t\t\t\t\t\t\t\t\t\t<span \n\t\t\t\t\t\t\t\t\t\t\t\tclass="bx-ui-tooltip-user-name"\n\t\t\t\t\t\t\t\t\t\t\t\ttitle="${s}"\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\tresponse.data.user.nameFormatted\n\t\t\t\t\t\t\t\t\t\t\t</span>`}}let s='<div class="bx-ui-tooltip-info-data-info">';Object.keys(t.data.user.cardFields).forEach((i=>{s+=`<span class="bx-ui-tooltip-field-row bx-ui-tooltip-field-row-${i.toLowerCase()}"><span class="bx-ui-tooltip-field-name">${t.data.user.cardFields[i].name}</span>: <span class="bx-ui-tooltip-field-value">${t.data.user.cardFields[i].value}</span></span>`}));s+="</div>";const o=parseInt(main_core.Loc.getMessage("USER_ID"))>0&&t.data.currentUserPerms.operations.videocall?"bx-ui-tooltip-info-data-cont-video":"bx-ui-tooltip-info-data-cont";s=`<div id="bx_user_info_data_cont_${t.data.user.id}" class="${o}">${s}</div>`;let a="";let n="bx-ui-tooltip-info-data-photo no-photo";if(main_core.Type.isStringFilled(t.data.user.photo)){a=t.data.user.photo;n="bx-ui-tooltip-info-data-photo"}a=main_core.Type.isStringFilled(i)?`<a href="${i}" class="${n}">${a}</a>`:`<span class="${n}">${a}</span>`;let r="";let l="";if(parseInt(main_core.Loc.getMessage("USER_ID"))>0&&t.data.user.active&&t.data.user.id!=main_core.Loc.getMessage("USER_ID")&&t.data.currentUserPerms.operations.message){l+=`<li class="bx-icon bx-icon-message"><span onclick="return BX.tooltip.openIM(${t.data.user.id});">${main_core.Loc.getMessage("MAIN_UL_TOOLBAR_MESSAGES_CHAT")}</span></li>`;l+=`<li id="im-video-call-button${t.data.user.id}" class="bx-icon bx-icon-video"><span onclick="return BX.tooltip.openCallTo(${t.data.user.id});">${main_core.Loc.getMessage("MAIN_UL_TOOLBAR_VIDEO_CALL")}</span></li>`;l+=`<script>Event.ready(() => { BX.tooltip.checkCallTo("im-video-call-button${t.data.user.id}"); };<\/script>`}l=main_core.Type.isStringFilled(l)?`<div class="bx-ui-tooltip-info-data-separator"></div><ul>${l}</ul>`:"";if(t.data.user.hasBirthday){r+=`<li class="bx-icon bx-icon-birth">${main_core.Loc.getMessage("MAIN_UL_TOOLBAR_BIRTHDAY")}</li>`}if(t.data.user.hasHonour){r+=`<li class="bx-icon bx-icon-featured">${main_core.Loc.getMessage("MAIN_UL_TOOLBAR_HONORED")}</li>`}if(t.data.user.hasAbsence){r+=`<li class="bx-icon bx-icon-away">${main_core.Loc.getMessage("MAIN_UL_TOOLBAR_ABSENT")}</li>`}r=main_core.Type.isStringFilled(r)?`<ul>${r}</ul>`:"";this.insertData({RESULT:{Name:e,Position:main_core.Type.isStringFilled(t.data.user.position)?t.data.user.position:"",Card:s,Photo:a,Toolbar:r,Toolbar2:l}});this.adjustPosition()}),(()=>{}))}else{const t=a+(a.indexOf("?")>=0?"&":"?")+`MODE=UI&MUL_MODE=INFO&USER_ID=${this.userId}`+`&site=${main_core.Loc.getMessage("SITE_ID")||""}`+`&version=${this.version}`+(!main_core.Type.isUndefined(this.params)&&!main_core.Type.isUndefined(this.params.entityType)&&main_core.Type.isStringFilled(this.params.entityType)?`&entityType=${this.params.entityType}`:"")+(!main_core.Type.isUndefined(this.params)&&!main_core.Type.isUndefined(this.params.entityId)&&parseInt(this.params.entityId)>0?`&entityId=${parseInt(this.params.entityId)}`:"");main_core.ajax.get(t,(t=>{this.insertData(t);this.adjustPosition()}))}this.DIV.id=`${Tooltip.getIdPrefix()}${this.userId}`;this.DIV.innerHTML='<div class="bx-ui-tooltip-info-wrap">'+'<div class="bx-ui-tooltip-info-leftcolumn">'+`<div class="bx-ui-tooltip-photo" id="${Tooltip.getIdPrefix()}photo-${this.userId}"><div class="bx-ui-tooltip-info-data-loading">${main_core.Loc.getMessage("JS_CORE_LOADING")}</div></div>`+"</div>"+'<div class="bx-ui-tooltip-info-data">'+`<div id="${Tooltip.getIdPrefix()}data-card-${this.userId}"></div>`+'<div class="bx-ui-tooltip-info-data-tools">'+`<div class="bx-ui-tooltip-tb-control bx-ui-tooltip-tb-control-left" id="${Tooltip.getIdPrefix()}toolbar-${this.userId}"></div>`+`<div class="bx-ui-tooltip-tb-control bx-ui-tooltip-tb-control-right" id="${Tooltip.getIdPrefix()}toolbar2-${this.userId}"></div>`+'<div class="bx-ui-tooltip-info-data-clear"></div>'+"</div>"+"</div>"+'</div><div class="bx-ui-tooltip-info-bottomarea"></div>'}this.DIV.className="bx-ui-tooltip-info-shadow";this.classNameAnim="bx-ui-tooltip-info-shadow-anim";this.classNameFixed="bx-ui-tooltip-info-shadow";if(this.hMirror&&this.vMirror){this.DIV.className="bx-ui-tooltip-info-shadow-hv";this.classNameAnim="bx-ui-tooltip-info-shadow-hv-anim";this.classNameFixed="bx-ui-tooltip-info-shadow-hv"}else{if(this.hMirror){this.DIV.className="bx-ui-tooltip-info-shadow-h";this.classNameAnim="bx-ui-tooltip-info-shadow-h-anim";this.classNameFixed="bx-ui-tooltip-info-shadow-h"}if(this.vMirror){this.DIV.className="bx-ui-tooltip-info-shadow-v";this.classNameAnim="bx-ui-tooltip-info-shadow-v-anim";this.classNameFixed="bx-ui-tooltip-info-shadow-v"}}this.DIV.style.display="block";if(!n){this.adjustPosition()}this.showOpacityEffect(0);document.getElementById(`${Tooltip.getIdPrefix()}${this.userId}`).onmouseover=()=>{this.startTrackMouse(this)};document.getElementById(`${Tooltip.getIdPrefix()}${this.userId}`).onmouseout=()=>{this.stopTrackMouse(this)};main_core_events.EventEmitter.emit("onTooltipShow",new main_core_events.BaseEvent({compatData:[this]}))}adjustPosition(){const t=BX.pos(this.DIV);if(this.vMirror){this.ROOT_DIV.style.top=`${parseInt(this.anchorTop+13)}px`}else{this.ROOT_DIV.style.top=`${parseInt(this.anchorTop-t.height-13+12)}px`}}insertData(data){if(null!=data&&(this.version>=3||data.length>0)){if(this.version>=3){this.INFO=data}else{eval(`this.INFO = ${data}`)}const cardEl=document.getElementById(`${Tooltip.getIdPrefix()}data-card-${this.userId}`);cardEl.innerHTML="";if(main_core.Type.isStringFilled(this.INFO.RESULT.Name)){cardEl.innerHTML+=`<div class="bx-ui-tooltip-user-name-block">${this.INFO.RESULT.Name}</div>`}if(main_core.Type.isStringFilled(this.INFO.RESULT.Position)){cardEl.innerHTML+=`<div class="bx-ui-tooltip-user-position">${this.INFO.RESULT.Position}</div>`}cardEl.innerHTML+=this.INFO.RESULT.Card;const photoEl=document.getElementById(`${Tooltip.getIdPrefix()}photo-${this.userId}`);photoEl.innerHTML=this.INFO.RESULT.Photo;const toolbarEl=document.getElementById(`${Tooltip.getIdPrefix()}toolbar-${this.userId}`);toolbarEl.innerHTML=this.INFO.RESULT.Toolbar;const toolbar2El=document.getElementById(`${Tooltip.getIdPrefix()}toolbar2-${this.userId}`);toolbar2El.innerHTML=this.INFO.RESULT.Toolbar2;if(main_core.Type.isArray(this.INFO.RESULT.Scripts)){this.INFO.RESULT.Scripts.forEach((script=>{eval(script)}))}main_core_events.EventEmitter.emit("onTooltipInsertData",new main_core_events.BaseEvent({compatData:[this]}))}}}main_core.Event.ready((()=>{if(main_core.Browser.isAndroid()||main_core.Browser.isIOS()){return}document.addEventListener("mouseover",(t=>{const i=t.target;const e=i.getAttribute("bx-tooltip-user-id");const s=i.getAttribute("bx-tooltip-loader");let o=e;if(main_core.Type.isStringFilled(s)){let t=0;[...s].forEach(((i,e)=>{t=31*t+s.charCodeAt(e)<<0}));o=t+e}if(main_core.Type.isStringFilled(e)){if(null==Tooltip.tooltipsList[o]){Tooltip.tooltipsList[o]=new TooltipBalloon({userId:e,node:i,loader:s})}else{Tooltip.tooltipsList[o].node=i;Tooltip.tooltipsList[o].create()}t.preventDefault()}}))}));exports.Tooltip=Tooltip;exports.TooltipBalloon=TooltipBalloon})(this.BX.UI=this.BX.UI||{},BX,BX.Event); //# sourceMappingURL=tooltip.bundle.map.js