Your IP : 18.118.119.238


Current Path : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/ui/tooltip/
Upload File :
Current File : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/ui/tooltip/tooltip.min.js

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