1(function(window) { 2if (BX.tooltip) return; 3 4var arTooltipIndex = {}, 5 bDisable = false; 6 7BX.tooltip = function(user_id, anchor_name, loader, rootClassName, bForceUseLoader, params) 8{ 9 if (BX.message('TOOLTIP_ENABLED') != "Y") 10 { 11 return; 12 } 13 14 if ( 15 BX.browser.IsAndroid() 16 || BX.browser.IsIOS() 17 ) 18 { 19 return; 20 } 21 22 BX.ready(function() { 23 var anchor = BX(anchor_name); 24 if (null == anchor) 25 { 26 return; 27 } 28 29 var tooltipId = user_id; 30 if(bForceUseLoader && BX.type.isNotEmptyString(loader)) 31 { 32 // prepare tooltip ID from custom loader 33 var loaderHash = 0; 34 for(var i = 0, len = loader.length; i < len; i++) 35 { 36 loaderHash = (31 * loaderHash + loader.charCodeAt(i)) << 0; 37 } 38 39 tooltipId = loaderHash + user_id; 40 } 41 42 if (null == arTooltipIndex[tooltipId]) 43 { 44 arTooltipIndex[tooltipId] = new BX.CTooltip(user_id, anchor, loader, rootClassName, bForceUseLoader, params); 45 } 46 else 47 { 48 arTooltipIndex[tooltipId].ANCHOR = anchor; 49 arTooltipIndex[tooltipId].rootClassName = rootClassName; 50 arTooltipIndex[tooltipId].LOADER = ( 51 bForceUseLoader 52 && BX.type.isNotEmptyString(loader) 53 ? loader 54 : '/bitrix/tools/tooltip.php' 55 ); 56 arTooltipIndex[tooltipId].params = params; 57 arTooltipIndex[tooltipId].Create(); 58 } 59 }); 60}; 61 62BX.tooltip.disable = function(){ bDisable = true; }; 63BX.tooltip.enable = function(){ bDisable = false; }; 64 65BX.tooltip.hide = function(userId) { 66 if (BX('user_info_' + userId)) 67 { 68 BX('user_info_' + userId).style.display = 'none'; 69 } 70}; 71 72BX.tooltip.openIM = function(userId) { 73 74 const namespace = top.BX.Reflection.namespace('BX.Messenger.Public'); 75 if (namespace) 76 { 77 namespace.openChat(userId); 78 BX.tooltip.hide(userId); 79 } 80 else if (BX('MULSonetMessageChatTemplate')) 81 { 82 window.open(BX('MULSonetMessageChatTemplate').replace('#user_id#', userId).replace('#USER_ID#', userId).replace('#ID#', userId), '', 'location=yes,status=no,scrollbars=yes,resizable=yes,width=700,height=550,top='+Math.floor((screen.height - 550)/2-14)+',left='+Math.floor((screen.width - 700)/2-5)); 83 BX.tooltip.hide(userId); 84 } 85 return false; 86}; 87 88 89BX.tooltip.openCallTo = function(userId) { 90 91 const namespace = top.BX.Reflection.namespace('BX.Messenger.Public'); 92 if (namespace) 93 { 94 namespace.startVideoCall(userId); 95 } 96 return false; 97}; 98 99BX.tooltip.checkCallTo = function(nodeId) { 100}; 101 102BX.tooltip.openVideoCall = function(userId) { 103 const namespace = top.BX.Reflection.namespace('BX.Messenger.Public'); 104 if (namespace) 105 { 106 namespace.startVideoCall(userId); 107 } 108 else if (BX('MULVideoCallTemplate')) 109 { 110 window.open(BX('MULVideoCallTemplate').replace('#user_id#', userId).replace('#USER_ID#', userId).replace('#ID#', userId), '', 'location=yes,status=no,scrollbars=yes,resizable=yes,width=1000,height=600,top='+Math.floor((screen.height - 600)/2-14)+',left='+Math.floor((screen.width - 1000)/2-5)); 111 BX.tooltip.hide(userId); 112 } 113 return false; 114}; 115 116BX.CTooltip = function(user_id, anchor, loader, rootClassName, bForceUseLoader, params) 117{ 118 this.LOADER = ( 119 bForceUseLoader 120 && BX.type.isNotEmptyString(loader) 121 ? loader 122 : '/bitrix/tools/tooltip.php' 123 ); 124 this.USER_ID = user_id; 125 this.ANCHOR = anchor; 126 this.rootClassName = ''; 127 this.params = (typeof params != 'undefined' ? params : {}); 128 129 if ( 130 rootClassName != 'undefined' 131 && rootClassName != null 132 && rootClassName.length > 0 133 ) 134 { 135 this.rootClassName = rootClassName; 136 } 137 138 var old = document.getElementById('user_info_' + this.USER_ID); 139 if (null != old) 140 { 141 if (null != old.parentNode) 142 old.parentNode.removeChild(old); 143 144 old = null; 145 } 146 147 var _this = this; 148 149 this.INFO = null; 150 151 this.width = 393; 152 this.height = 302; 153 154 this.RealAnchor = null; 155 this.CoordsLeft = 0; 156 this.CoordsTop = 0; 157 this.AnchorRight = 0; 158 this.AnchorBottom = 0; 159 160 this.DIV = null; 161 this.ROOT_DIV = null; 162 163 if (BX.browser.IsIE()) 164 { 165 this.IFRAME = null; 166 } 167 168 this.v_delta = 0; 169 this.classNameAnim = false; 170 this.classNameFixed = false; 171 172 this.left = 0; 173 this.top = 0; 174 175 this.tracking = false; 176 this.active = false; 177 this.showed = false; 178 179 this.Create = function() 180 { 181 _this.ANCHOR.onmouseover = function() { 182 if (!bDisable) 183 { 184 _this.StartTrackMouse(this); 185 } 186 }; 187 188 _this.ANCHOR.onmouseout = function() { 189 _this.StopTrackMouse(this); 190 } 191 }; 192 193 this.Create(); 194 195 this.TrackMouse = function(e) 196 { 197 if(!_this.tracking) 198 return; 199 200 var current; 201 if(e && e.pageX) 202 current = {x: e.pageX, y: e.pageY}; 203 else 204 current = {x: e.clientX + document.body.scrollLeft, y: e.clientY + document.body.scrollTop}; 205 206 if(current.x < 0) 207 current.x = 0; 208 if(current.y < 0) 209 current.y = 0; 210 211 current.time = _this.tracking; 212 213 if(!_this.active) 214 _this.active = current; 215 else 216 { 217 if( 218 _this.active.x >= (current.x - 1) && _this.active.x <= (current.x + 1) 219 && _this.active.y >= (current.y - 1) && _this.active.y <= (current.y + 1) 220 ) 221 { 222 if((_this.active.time + 20/*2sec*/) <= current.time) 223 _this.ShowTooltip(); 224 } 225 else 226 _this.active = current; 227 } 228 }; 229 230 this.ShowTooltip = function() 231 { 232 var old = document.getElementById('user_info_' + _this.USER_ID); 233 if(bDisable || old && old.style.display == 'block') 234 return; 235 236 var bIE = (BX.browser.IsIE() && !BX.browser.IsIE10()); 237 238 if (!BX.type.isPlainObject(this.params)) 239 { 240 this.params = {}; 241 } 242 243 if (null == _this.DIV && null == _this.ROOT_DIV) 244 { 245 _this.ROOT_DIV = document.body.appendChild(document.createElement('DIV')); 246 _this.ROOT_DIV.style.position = 'absolute'; 247 248 BX.ZIndexManager.register(_this.ROOT_DIV); 249 250 _this.DIV = _this.ROOT_DIV.appendChild(document.createElement('DIV')); 251 if (bIE) 252 _this.DIV.className = 'bx-user-info-shadow-ie'; 253 else 254 _this.DIV.className = 'bx-user-info-shadow'; 255 256 _this.DIV.style.width = _this.width + 'px'; 257 _this.DIV.style.height = _this.height + 'px'; 258 } 259 260 var left = _this.CoordsLeft; 261 var top = _this.CoordsTop + 30; 262 var arScroll = BX.GetWindowScrollPos(); 263 var body = document.body; 264 265 var h_mirror = false;
266 var v_mirror = false; 267 268 if((body.clientWidth + arScroll.scrollLeft) < (left + _this.width)) 269 { 270 left = _this.AnchorRight - _this.width; 271 h_mirror = true; 272 } 273 274 if((top - arScroll.scrollTop) < 0) 275 { 276 top = _this.AnchorBottom - 5; 277 v_mirror = true; 278 _this.v_delta = 40; 279 } 280 else 281 _this.v_delta = 0; 282 283 _this.ROOT_DIV.style.left = parseInt(left) + "px"; 284 _this.ROOT_DIV.style.top = parseInt(top) + "px"; 285 286 BX.ZIndexManager.bringToFront(_this.ROOT_DIV); 287 288 BX.bind(BX(_this.ROOT_DIV), "click", BX.eventCancelBubble); 289 290 if ( 291 this.rootClassName != 'undefined' 292 && this.rootClassName != null 293 && this.rootClassName.length > 0 294 ) 295 _this.ROOT_DIV.className = this.rootClassName; 296 297 if ('' == _this.DIV.innerHTML) 298 { 299 var url = _this.LOADER + 300 (_this.LOADER.indexOf('?') >= 0 ? '&' : '?') + 301 'MUL_MODE=INFO&USER_ID=' + _this.USER_ID + 302 '&site=' + (BX.message('SITE_ID') || '') + 303 ( 304 typeof _this.params != 'undefined' 305 && typeof _this.params.entityType != 'undefined' 306 && _this.params.entityType.length > 0 307 ? '&entityType=' + _this.params.entityType 308 : '' 309 ) + 310 ( 311 typeof _this.params != 'undefined' 312 && typeof _this.params.entityId != 'undefined' 313 && parseInt(_this.params.entityId) > 0 314 ? '&entityId=' + parseInt(_this.params.entityId) 315 : '' 316 ); 317 318 BX.ajax.get(url, _this.InsertData); 319 _this.DIV.id = 'user_info_' + _this.USER_ID; 320 321 _this.DIV.innerHTML = '<div class="bx-user-info-wrap">' 322 + '<div class="bx-user-info-leftcolumn">' 323 + '<div class="bx-user-photo" id="user-info-photo-' + _this.USER_ID + '"><div class="bx-user-info-data-loading">' + BX.message('JS_CORE_LOADING') + '</div></div>' 324 + '<div class="bx-user-tb-control bx-user-tb-control-left" id="user-info-toolbar-' + _this.USER_ID + '"></div>' 325 + '</div>' 326 + '<div class="bx-user-info-data">' 327 + '<div id="user-info-data-card-' + _this.USER_ID + '"></div>' 328 + '<div class="bx-user-info-data-tools">' 329 + '<div class="bx-user-tb-control bx-user-tb-control-right" id="user-info-toolbar2-' + _this.USER_ID + '"></div>' 330 + '<div class="bx-user-info-data-clear"></div>' 331 + '</div>' 332 + '</div>' 333 + '</div><div class="bx-user-info-bottomarea"></div>'; 334 } 335 336 if (bIE) 337 { 338 _this.DIV.className = 'bx-user-info-shadow-ie'; 339 _this.classNameAnim = 'bx-user-info-shadow-anim-ie'; 340 _this.classNameFixed = 'bx-user-info-shadow-ie'; 341 } 342 else 343 { 344 _this.DIV.className = 'bx-user-info-shadow'; 345 _this.classNameAnim = 'bx-user-info-shadow-anim'; 346 _this.classNameFixed = 'bx-user-info-shadow'; 347 } 348 349 _this.filterFixed = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/bitrix/components/bitrix/main.user.link/templates/.default/images/cloud-left-top.png', sizingMethod = 'crop' );"; 350 351 if (h_mirror && v_mirror) 352 { 353 if (BX.browser.IsIE6()) 354 { 355 _this.DIV.className = 'bx-user-info-shadow-hv-ie6'; 356 _this.classNameAnim = 'bx-user-info-shadow-hv-anim-ie6'; 357 _this.classNameFixed = 'bx-user-info-shadow-hv-ie6'; 358 } 359 else if (bIE) 360 { 361 _this.DIV.className = 'bx-user-info-shadow-hv-ie'; 362 _this.classNameAnim = 'bx-user-info-shadow-hv-anim-ie'; 363 _this.classNameFixed = 'bx-user-info-shadow-hv-ie'; 364 } 365 else 366 { 367 _this.DIV.className = 'bx-user-info-shadow-hv'; 368 _this.classNameAnim = 'bx-user-info-shadow-hv-anim'; 369 _this.classNameFixed = 'bx-user-info-shadow-hv'; 370 } 371 372 _this.filterFixed = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/bitrix/components/bitrix/main.user.link/templates/.default/images/cloud-right-bottom.png', sizingMethod = 'crop' );"; 373 } 374 else 375 { 376 if (h_mirror) 377 { 378 if (bIE) 379 { 380 _this.DIV.className = 'bx-user-info-shadow-h-ie'; 381 _this.classNameAnim = 'bx-user-info-shadow-h-anim-ie'; 382 _this.classNameFixed = 'bx-user-info-shadow-h-ie'; 383 } 384 else 385 { 386 _this.DIV.className = 'bx-user-info-shadow-h'; 387 _this.classNameAnim = 'bx-user-info-shadow-h-anim'; 388 _this.classNameFixed = 'bx-user-info-shadow-h'; 389 } 390 391 _this.filterFixed = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/bitr
391ix/components/bitrix/main.user.link/templates/.default/images/cloud-right-top.png', sizingMethod = 'crop' );"; 392 } 393 394 if (v_mirror) 395 { 396 if (BX.browser.IsIE6()) 397 { 398 _this.DIV.className = 'bx-user-info-shadow-v-ie6'; 399 _this.classNameAnim = 'bx-user-info-shadow-v-anim-ie6'; 400 _this.classNameFixed = 'bx-user-info-shadow-v-ie6'; 401 } 402 else if (bIE) 403 { 404 _this.DIV.className = 'bx-user-info-shadow-v-ie'; 405 _this.classNameAnim = 'bx-user-info-shadow-v-anim-ie'; 406 _this.classNameFixed = 'bx-user-info-shadow-v-ie'; 407 } 408 else 409 { 410 _this.DIV.className = 'bx-user-info-shadow-v'; 411 _this.classNameAnim = 'bx-user-info-shadow-v-anim'; 412 _this.classNameFixed = 'bx-user-info-shadow-v'; 413 } 414 415 _this.filterFixed = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/bitrix/components/bitrix/main.user.link/templates/.default/images/cloud-left-bottom.png', sizingMethod = 'crop' );"; 416 } 417 } 418 419 420 if (BX.browser.IsIE() && null == _this.IFRAME) 421 { 422 _this.IFRAME = document.body.appendChild(document.createElement('IFRAME')); 423 _this.IFRAME.id = _this.DIV.id + "_frame"; 424 _this.IFRAME.style.position = 'absolute'; 425 _this.IFRAME.style.width = (_this.width - 60) + 'px'; 426 _this.IFRAME.style.height = (_this.height - 100) + 'px'; 427 _this.IFRAME.style.borderStyle = 'solid'; 428 _this.IFRAME.style.borderWidth = '0px'; 429 _this.IFRAME.style.zIndex = 550; 430 _this.IFRAME.style.display = 'none'; 431 } 432 if (BX.browser.IsIE()) 433 { 434 _this.IFRAME.style.left = (parseInt(left) + 25) + "px"; 435 _this.IFRAME.style.top = (parseInt(top) + 30 + _this.v_delta) + "px"; 436 } 437 438 _this.DIV.style.display = 'none'; 439 _this.ShowOpacityEffect({func: _this.SetVisible, obj: _this.DIV, arParams: []}, 0); 440 441 document.getElementById('user_info_' + _this.USER_ID).onmouseover = function() { 442 _this.StartTrackMouse(this); 443 }; 444 445 document.getElementById('user_info_' + _this.USER_ID).onmouseout = function() { 446 _this.StopTrackMouse(this); 447 }; 448 449 BX.onCustomEvent('onTooltipShow', [this]); 450 }; 451 452 this.InsertData = function(data) 453 { 454 if (null != data && data.length > 0) 455 { 456 eval('_this.INFO = ' + data); 457 458 var cardEl = document.getElementById('user-info-data-card-' + _this.USER_ID); 459 cardEl.innerHTML = _this.INFO.RESULT.Card; 460 461 var photoEl = document.getElementById('user-info-photo-' + _this.USER_ID); 462 photoEl.innerHTML = _this.INFO.RESULT.Photo; 463 464 var toolbarEl = document.getElementById('user-info-toolbar-' + _this.USER_ID); 465 toolbarEl.innerHTML = _this.INFO.RESULT.Toolbar; 466 467 var toolbar2El = document.getElementById('user-info-toolbar2-' + _this.USER_ID); 468 toolbar2El.innerHTML = _this.INFO.RESULT.Toolbar2; 469 470 if(BX.type.isArray(_this.INFO.RESULT.Scripts)) 471 { 472 for(var i = 0; i < _this.INFO.RESULT.Scripts.length; i++) 473 { 474 eval(_this.INFO.RESULT.Scripts[i]); 475 } 476 } 477 478 BX.onCustomEvent('onTooltipInsertData', [_this]); 479 } 480 } 481 482}; 483BX.CTooltip.prototype.StartTrackMouse = function(ob) 484{ 485 var _this = this; 486 487 if(!this.tracking) 488 { 489 var elCoords = BX.pos(ob); 490 this.RealAnchor = ob; 491 this.CoordsLeft = elCoords.left + 0; 492 this.CoordsTop = elCoords.top - 325; 493 this.AnchorRight = elCoords.right; 494 this.AnchorBottom = elCoords.bottom; 495 496 this.tracking = 1; 497 BX.bind(document, "mousemove", _this.TrackMouse); 498 499 setTimeout(function() {_this.tickTimer()}, 500); 500 } 501}; 502 503BX.CTooltip.prototype.StopTrackMouse = function() 504{ 505 var _this = this; 506 if(this.tracking) 507 { 508 BX.unbind(document, "mousemove", _this.TrackMouse); 509 this.active = false; 510 setTimeout(function() {_this.HideTooltip()}, 500); 511 this.tracking = false; 512 } 513}; 514 515BX.CTooltip.prototype.tickTimer = function() 516{ 517 var _this = this; 518 519 if(this.tracking) 520 { 521 this.tracking++; 522 if(this.active) 523 { 524 if( (this.active.time + 5/*0.5sec*/) <= this.tracking) 525 this.ShowTooltip(); 526 } 527 setTimeout(function() {_this.tickTimer()}, 100); 528 } 529}; 530 531BX.CTooltip.prototype.HideTooltip = function() 532{ 533 if(!this.tracking) 534 this.ShowOpacityEffect({func: this.SetInVisible, obj: this.DIV, arParams: []}, 1); 535}; 536 537BX.CTooltip.prototype.ShowOpacityEffect = function(oCallback, bFade) 538{ 539 var steps = 3; 540 var period = 1; 541 var delta = 1 / steps; 542 var i = 0, op, _this = this; 543 544 if(BX.browser.IsIE() && _this.DIV) 545 _this.DIV.className = _this.classNameAnim; 546 547 var show = function() 548 { 549 i++; 550 if (i > steps) 551 { 552 clearInterval(intId); 553 if (!oCallback.arParams) 554 oCallback.arParams = []; 555 if (oCallback.func && oCallback.obj) 556 oCallback.func.apply(oCallback.obj, oCallback.arParams); 557 return; 558 } 559 op = bFade ? 1 - i * delta : i * delta; 560 561 if (_this.DIV != null) 562 { 563 try{ 564 _this.DIV.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + (op * 100) + ')'; 565 _this.DIV.style.opacity = op; 566 _this.DIV.style.MozOpacity = op; 567 _this.DIV.style.KhtmlOpacity = op; 568 } 569 catch(e){ 570 } 571 finally{ 572 if (!bFade && i == 1) 573 _this.DIV.style.display = 'block'; 574 575 if (bFade && i == steps && _this.DIV) 576 _this.DIV.style.display = 'none'; 577 578 579 if (BX.browser.IsIE() && i == 1 && bFade && _this.IFRAME) 580 _this.IFRAME.style.display = 'none'; 581 582 583 if (BX.browser.IsIE() && i == steps && _this.DIV) 584 { 585 if (!bFade) 586 _this.IFRAME.style.display = 'block'; 587 588 _this.DIV.style.filter = _this.filterFixed; 589 _this.DIV.className = _this.classNameFixed; 590 _this.DIV.innerHTML = ''+_this.DIV.innerHTML; 591 } 592 593 if(bFade) 594 { 595 BX.onCustomEvent('onTooltipHide', [_this]); 596 } 597 } 598 } 599 600 }; 601 var intId = setInterval(show, period); 602 603} 604 605})(window);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.