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