1if (typeof window.JNotice === "undefined") { 2 let svgError = `<svg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"> 3 <path d="M40.7071 19.2929C41.0976 19.6834 41.0976 20.3166 40.7071 20.7071L31.4142 30L40.7071 39.2929C41.0976 39.6834 41.0976 40.3166 40.7071 40.7071C40.3166 41.0976 39.6834 41.0976 39.2929 40.7071L30 31.4142L20.7071 40.7071C20.3166 41.0976 19.6834 41.0976 19.2929 40.7071C18.9024 40.3166 18.9024 39.6834 19.2929 39.2929L28.5858 30L19.2929 20.7071C18.9024 20.3166 18.9024 19.6834 19.2929 19.2929C19.6834 18.9024 20.3166 18.9024 20.7071 19.2929L30 28.5858L39.2929 19.2929C39.6834 18.9024 40.3166 18.9024 40.7071 19.2929Z"/> 4 <path fill-rule="evenodd" clip-rule="evenodd" d="M0 30C0 13.4315 13.4315 0 30 0C46.5685 0 60 13.4315 60 30C60 46.5685 46.5685 60 30 60C13.4315 60 0 46.5685 0 30ZM30 2C14.536 2 2 14.536 2 30C2 45.464 14.536 58 30 58C45.464 58 58 45.464 58 30C58 14.536 45.464 2 30 2Z"/> 5 </svg>`; 6 7 let svgAuth = `<svg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"> 8 <path fill-rule="evenodd" clip-rule="evenodd" d="M30 14C22.8203 14 17 19.8203 17 27C17 34.1797 22.8203 40 30 40C37.1797 40 43 34.1797 43 27C43 19.8203 37.1797 14 30 14ZM19 27C19 20.9249 23.9249 16 30 16C36.0751 16 41 20.9249 41 27C41 33.0751 36.0751 38 30 38C23.9249 38 19 33.0751 19 27Z"/> 9 <path fill-rule="evenodd" clip-rule="evenodd" d="M0 30C0 13.4315 13.4315 0 30 0C46.5685 0 60 13.4315 60 30C60 46.5685 46.5685 60 30 60C13.4315 60 0 46.5685 0 30ZM30 2C14.536 2 2 14.536 2 30C2 38.8944 6.14718 46.8202 12.6133 51.9492C17.5183 48.4552 23.5206 46.4 30 46.4C36.4794 46.4 42.4817 48.4552 47.3866 51.9492C53.8528 46.8202 58 38.8944 58 30C58 14.536 45.464 2 30 2ZM30 58C24.1894 58 18.7922 56.2301 14.3182 53.1999C18.792 50.1697 24.188 48.4 30 48.4C35.812 48.4 41.208 50.1698 45.6818 53.1999C41.2077 56.2301 35.8106 58 30 58Z"/> 10 <g opacity="0.1"> 11 <path d="M31.5 39C36.7467 39 41 34.9706 41 30C41 25.0294 36.7467 21 31.5 21C26.2533 21 22 25.0294 22 30C22 34.9706 26.2533 39 31.5 39Z"/> 12 <path d="M18 55.8C19.9882 54.4667 25.3811 51 32.5385 51C39.6959 51 43.6154 52.6 45 53.4C42.9231 55.8 38.1834 59 32.2189 59C26.2544 59 20.7692 57.4 18 55.8Z"/> 13 </g> 14 </svg>`; 15 16 window.JNoticeSurface = function (config) { 17 var _private = { 18 inited: false, 19 }; 20 21 Object.defineProperties(this, { 22 inited: { 23 get: function () { 24 return _private.inited; 25 }, 26 set: function (value) { 27 if (value) { 28 _private.inited = true; 29 } 30 }, 31 }, 32 }); 33 34 this.config = function (key) { 35 if (typeof config === "object") { 36 if (typeof key !== "undefined") { 37 if (Object.keys(config).indexOf(key) > -1) { 38 return config[key]; 39 } 40 } 41 } 42 43 return undefined; 44 }; 45 46 this.init(); 47 }; 48 49 window.JNoticeSurface.prototype = { 50 node: null, 51 inner: null, 52 notices: [], 53 54 get side() { 55 var side = this.config("side"); 56 return side === "left" ? "left" : "right"; 57 }, 58 get reverse() { 59 return Boolean(this.config("reverse")); 60 }, 61 get classname() { 62 return "notice-surface--" + this.side + (this.reverse ? " notice-surface--reverse" : ""); 63 }, 64 65 init: function () { 66 if (!this.inited) { 67 this.inited = true; 68 69 this.node = BX.create({ 70 tag: "div", 71 attrs: { 72 class: "notice-surface " + this.classname, 73 }, 74 html: '<div class="notice-surface__inner"></div>', 75 }); 76 77 this.node.noticeSurface = this; 78 this.inner = this.node.querySelector(".notice-surface__inner"); 79 80 BX.ready( 81 BX.delegate(function () { 82 BX.append(this.node, document.body); 83 }, this) 84 ); 85 } 86 }, 87 88 search: function (notice) { 89 if (typeof notice !== "undefined" && notice instanceof window.JNotice) { 90 for (var i in this.notices) { 91 if (this.notices[i] === notice) { 92 return i; 93 } 94 } 95 } 96 97 return false;
98 }, 99 100 create: function (config) { 101 var notice = new JNotice(config); 102 notice.appendTo(this); 103 104 return notice; 105 }, 106 107 append: function (notice) { 108 if (typeof notice !== "undefined" && notice instanceof window.JNotice) { 109 if (notice.removed || (notice.inserted && notice.surface !== this)) { 110 return false; 111 } 112 113 var index = this.search(notice); 114 115 if (!index) { 116 this.notices.push(notice); 117 index = this.notices.length - 1; 118 BX.prepend(notice.node, this.inner); 119 } 120 121 if (!notice.inserted) { 122 notice.appendTo(this); 123 } 124 125 return index; 126 } 127 128 return false; 129 }, 130 131 remove: function (index) { 132 if (typeof index !== "undefined") { 133 if (typeof this.notices[index] !== "undefined") { 134 var notice = this.notices[index]; 135 136 delete this.notices[index]; 137 this.notices.splice(index, 1); 138 139 BX.remove(notice.node); 140 141 notice.remove(); 142 } 143 } 144 }, 145 146 clear: function () { 147 for (i in this.notices) { 148 if (typeof this.notices[i] !== "undefined") { 149 this.notices[i].remove(); 150 } 151 } 152 153 this.notices = []; 154 }, 155 156 getItemName: function (item) { 157 var bJquery = typeof jQuery === "function"; 158 159 var name = ""; 160 var itemTitle = item.querySelector(".js-notice-block__title"); 161 if (itemTitle) { 162 name = itemTitle.textContent; 163 } 164 var bCatalogDetail = item.getAttribute("class").indexOf("catalog_detail") !== -1; 165 var data; 166 if (bCatalogDetail) { 167 data = item.querySelector(".item_main_info [data-js-item-name]"); 168 } else { 169 data = item.querySelector("[data-js-item-name]"); 170 } 171 172 if (data) { 173 data = bJquery ? jQuery(data).data("js-item-name") : BX.data(data, "js-item-name"); 174 175 if (data) { 176 name = data; 177 } 178 179 /*if (data) { 180 if (!bJquery) { 181 try { 182 data = JSON.parse(data.toString()); 183 if (typeof data !== "object" || !data) { 184 data = {}; 185 } 186 } catch (e) { 187 data = {}; 188 } 189 } 190 191 if (data) { 192 name = data.NAME; 193 } 194 }*/ 195 } 196 197 return name; 198 }, 199 200 getItemImage: function (item) { 201 var bJquery = typeof jQuery === "function"; 202 var src = ""; 203 var image = item.querySelector(".js-notice-block__image img"); 204 205 if (image) { 206 src = image.getAttribute("src"); 207 var dataSrc = bJquery ? jQuery(image).data("src") : BX.data(image, "src"); 208 if (dataSrc && !BX.hasClass(image, "lazyloaded")) { 209 src = dataSrc; 210 } 211 } else if ((image = item.querySelector("meta[itemprop=image]"))) { 212 src = image.getAttribute("content"); 213 } else if ((image = item.querySelector(".image-list__link link[itemprop=image]"))) { 214 src = image.getAttribute("href"); 215 } else if ((image = item.querySelector(".image-list-wrapper img"))) { 216 src = image.getAttribute("src"); 217 var dataSrc = bJquery ? jQuery(image).data("src") : BX.data(image, "src"); 218 if (dataSrc && !BX.hasClass(image, "lazyloaded")) { 219 src = dataSrc; 220 } 221 } 222 return src; 223 }, 224 225 onRequestError: function(xhr) { 226 var content = { 227 title: BX.message("NOTICE_REQUEST_ERROR"), 228 detail: xhr.status + ' ' + xhr.statusText, 229 image: svgError, 230 }; 231 232 return this.create({ 233 closeable: true, 234 autoclose: 3000, 235 type: "requesterror", 236 content: content, 237 }); 238 }, 239 240 onResultError: function(response) { 241 var content = { 242 title: BX.message("NOTICE_ERROR"), 243 detail: response.error, 244 image: svgError, 245 }; 246 247 return this.create({ 248 closeable: true, 249 autoclose: 3000, 250 type: "resulterror", 251 content: content, 252 }); 253 }, 254 255 onAuth: function(user) { 256 if ( 257 typeof user === "object" && 258 user && 259 BX.message('USER_ID') 260 ) { 261 var content = { 262 title: BX.message("NOTICE_AUTHORIZED"), 263 detail: user.login ? user.login : user.fullname, 264 image: user.image ? user.image : svgAuth, 265 }; 266 267 return this.create({ 268 closeable: true, 269 autoclose: 3000, 270 type: "auth", 271 content: content, 272 link: arNextOptions.THEME.PERSONAL_PAGE_URL 273 }); 274 } 275 }, 276 277 onAdd2cart: function (items) { 278 if (typeof items === "object" && items.length) { 279 for (i in items) { 280 var item = items[i]; 281 282 if (item instanceof Node) {
283 if ((item = item.closest(".js-notice-block"))) { 284 var bJquery = typeof jQuery === "function"; 285 286 var name = this.getItemName(item); 287 var src = this.getItemImage(item); 288 289 var content = { 290 title: BX.message("NOTICE_ADDED2CART"), 291 detail: name, 292 image: src, 293 }; 294 295 if (items.length > 1) { 296 var cntMore = items.length - 1; 297 var titles = [ 298 BX.message("NOTICE_PRODUCT1"), 299 BX.message("NOTICE_PRODUCT2"), 300 BX.message("NOTICE_PRODUCT0"), 301 ]; 302 var cases = [2, 0, 1, 1, 1, 2]; 303 content.detail += 304 '<div class="notice__detail__more font-bold">' + 305 BX.message("NOTICE_MORE") 306 .replace("#COUNT#", cntMore) 307 .replace( 308 "#PRODUCTS#", 309 titles[cntMore % 100 > 4 && cntMore % 100 < 20 ? 2 : cases[Math.min(cntMore % 10, 5)]] 310 ) + 311 "</div>"; 312 } 313 314 return this.create({ 315 closeable: true, 316 autoclose: 3000, 317 type: "add2cart", 318 link: arNextOptions.PAGES.BASKET_PAGE_URL, 319 content: content, 320 }); 321 } 322 } 323 } 324 } 325 }, 326 onAdd2Delay: function (items) { 327 if (typeof items === "object" && items.length) { 328 for (i in items) { 329 var item = items[i]; 330 331 if (item instanceof Node) { 332 if ((item = item.closest(".js-notice-block"))) { 333 var bJquery = typeof jQuery === "function"; 334 335 var name = this.getItemName(item); 336 var src = this.getItemImage(item); 337 338 var content = { 339 title: BX.message("NOTICE_ADDED2DELAY"), 340 detail: name, 341 image: src, 342 }; 343 344 if (items.length > 1) { 345 var cntMore = items.length - 1; 346 var titles = [ 347 BX.message("NOTICE_PRODUCT1"), 348 BX.message("NOTICE_PRODUCT2"), 349 BX.message("NOTICE_PRODUCT0"), 350 ]; 351 var cases = [2, 0, 1, 1, 1, 2]; 352 content.detail += 353 '<div class="notice__detail__more font-bold">' + 354 BX.message("NOTICE_MORE") 355 .replace("#COUNT#", cntMore) 356 .replace( 357 "#PRODUCTS#", 358 titles[cntMore % 100 > 4 && cntMore % 100 < 20 ? 2 : cases[Math.min(cntMore % 10, 5)]] 359 ) + 360 "</div>"; 361 } 362 363 return this.create({ 364 closeable: true, 365 autoclose: 3000, 366 type: "add2delay", 367 link: arNextOptions.PAGES.BASKET_PAGE_URL + "#delayed", 368 content: content, 369 }); 370 } 371 } 372 } 373 } 374 }, 375 onAdd2Compare: function (items, state = true) { 376 if (typeof items === "object" && items.length) { 377 for (i in items) { 378 var item = items[i]; 379 380 if (item instanceof Node) { 381 if ((item = item.closest(".js-notice-block"))) { 382 var bJquery = typeof jQuery === "function"; 383 384 var name = this.getItemName(item); 385 var src = this.getItemImage(item); 386 387 var content = { 388 title: state ? BX.message("NOTICE_ADDED2COMPARE") : BX.message("NOTICE_REMOVED_FROM_COMPARE"), 389 detail: name, 390 image: src, 391 }; 392 393 if (items.length > 1) { 394 var cntMore = items.length - 1; 395 var titles = [ 396 BX.message("NOTICE_PRODUCT1"), 397 BX.message("NOTICE_PRODUCT2"), 398 BX.message("NOTICE_PRODUCT0"), 399 ]; 400 var cases = [2, 0, 1, 1, 1, 2]; 401 content.detail += 402 '<div class="notice__detail__more font-bold">' + 403 BX.message("NOTICE_MORE") 404 .replace("#COUNT#", cntMore) 405 .replace( 406 "#PRODUCTS#", 407 titles[cntMore % 100 > 4 && cntMore % 100 < 20 ? 2 : cases[Math.min(cntMore % 10, 5)]] 408 ) + 409 "</div>"; 410 } 411 412 const obConfig = { 413 closeable: true, 414 autoclose: 3000, 415 type: "add2compare", 416 content: content, 417 }; 418 if (state) { 419 obConfig.link = arNextOptions.PAGES.COMPARE_PAGE_URL; 420 } 421 422 return this.create(obConfig); 423 } 424 } 425 } 426 } 427 }, 428 }; 429 430 window.JNoticeSurface.get = function (config) { 431 config = typeof config === "object" ? config : {}; 432 var side = config.side === "left" ? "left" : "right"; 433 var reverse = Boolean(config.reverse); 434 var classname = 435 ".notice-surface.notice-surface--" + 436 side + 437 (reverse ? ".notice-surface--reverse" : ":not(.notice-surface--reverse)"); 438 var surface = document.querySelector(classname); 439 if (surface) { 440 surface = surface.noticeSurface; 441 } else { 442 surface = new window.JNoticeSurface(config); 443 } 444 445 return surface; 446 }; 447 448 window.JNotice = function (config) { 449 var _private = { 450 surface: false, 451 inited: false, 452 removed: false, 453 }; 454 455 Object.defineProperties(this, { 456 surface: { 457 get: function () { 458 return _private.surface; 459 }, 460 set: function (value) { 461 if ( 462 typeof value !== "undefined" && 463 value instanceof window.JNoticeSurface && 464 !this.inserted && 465 !this.removed 466 ) { 467 _private.surface = value; 468 value.append(this); 469 470 this.show(); 471 472 BX.onCustomEvent("onAppendNotice", { notice: this }); 473 } 474 }, 475 }, 476 inserted: { 477 get: function () { 478 return _private.surface instanceof window.JNoticeSurface; 479 }, 480 }, 481 inited: { 482 get: function () { 483 return _private.inited; 484 }, 485 set: function (value) { 486 if (value) { 487 _private.inited = true; 488 } 489 }, 490 }, 491 removed: { 492 get: function () { 493 return _private.removed; 494 }, 495 set: function (value) { 496 if (value) { 497 _private.removed = true; 498 } 499 }, 500 }, 501 }); 502 503 this.config = function (key) { 504 if (typeof config === "object") { 505 if (typeof key !== "undefined") { 506 if (Object.keys(config).indexOf(key) > -1) { 507 return config[key]; 508 } 509 } 510 } 511 512 return undefined; 513 }; 514 515 this.init(); 516 }; 517 518 window.JNotice.prototype = { 519 node: null, 520 inner: null, 521 closer: null, 522 handlers: { 523 onClickNode: function (event) { 524 if (!event) { 525 event = window.event; 526 } 527 528 var target = event.target || event.srcElement; 529 530 if (typeof target !== "undefined" && target) { 531 if (!target.closest("a")) {
532 if (!target.closest(".notice__closer")) { 533 BX.PreventDefault(event); 534 535 var notice = target.closest(".notice"); 536 if (notice) { 537 notice = notice.notice; 538 539 if (notice.link.length) { 540 location.href = notice.link; 541 } 542 } 543 } 544 } 545 } 546 }, 547 onMouseEnterNode: function (event) { 548 if (!event) { 549 event = window.event; 550 } 551 552 var target = event.target || event.srcElement; 553 554 if (typeof target !== "undefined" && target) { 555 var notice = target.closest(".notice"); 556 if (notice) { 557 notice = notice.notice; 558 559 if (notice.autoclose) { 560 if (!notice.closed) { 561 notice.stopAutoClose(); 562 } 563 } 564 } 565 } 566 }, 567 onMouseLeaveNode: function (event) { 568 if (!event) { 569 event = window.event; 570 } 571 572 var target = event.target || event.srcElement; 573 574 if (typeof target !== "undefined" && target) { 575 var notice = target.closest(".notice"); 576 if (notice) { 577 notice = notice.notice; 578 579 BX.removeClass(notice.node, "animate--notice-click"); 580 581 if (!notice.closed) { 582 notice.startAutoClose(); 583 } 584 } 585 } 586 }, 587 onMouseDownNode: function (event) { 588 if (!event) { 589 event = window.event; 590 } 591 592 var target = event.target || event.srcElement; 593 594 if (typeof target !== "undefined" && target) { 595 var notice = target.closest(".notice"); 596 if (notice) { 597 notice = notice.notice; 598 599 BX.addClass(notice.node, "animate--notice-click"); 600 } 601 } 602 }, 603 onMouseUpNode: function (event) { 604 if (!event) { 605 event = window.event; 606 } 607 608 var target = event.target || event.srcElement; 609 610 if (typeof target !== "undefined" && target) { 611 var notice = target.closest(".notice"); 612 if (notice) { 613 notice = notice.notice; 614 615 BX.removeClass(notice.node, "animate--notice-click"); 616 } 617 } 618 }, 619 onClickCloser: function (event) { 620 if (!event) { 621 event = window.event; 622 } 623 624 var target = event.target || event.srcElement; 625 626 if (typeof target !== "undefined" && target) { 627 // there is need IE hack for svg target here 628 // var notice = target.closest('.notice'); 629 630 var notice = null; 631 var parent = target; 632 while (parent) { 633 if (parent.matches(".notice")) { 634 notice = parent; 635 break; 636 } else { 637 parent = parent.parentElement || parent.parentNode; 638 } 639 } 640 641 if (notice) { 642 notice = notice.notice; 643 644 BX.addClass(notice.node, "notice--closed"); 645 notice.remove(); 646 } 647 } 648 }, 649 }, 650 651 get visible() { 652 return !BX.hasClass(this.node, "notice--hidden") && this.inserted; 653 }, 654 get closed() { 655 return BX.hasClass(this.node, "notice--closed"); 656 }, 657 get closeable() { 658 return Boolean(this.config("closeable")); 659 }, 660 get autoclose() { 661 var autoclose = parseInt(this.config("autoclose")); 662 return autoclose ? autoclose : 0; 663 }, 664 get classname() { 665 var classname = this.config("classname"); 666 return typeof classname === "string" ? classname : ""; 667 }, 668 get type() { 669 var type = this.config("type"); 670 return typeof type === "string" ? type : ""; 671 }, 672 get link() { 673 var link = this.config("link"); 674 return typeof link === "string" ? link : ""; 675 }, 676 get content() { 677 var content = this.config("content"); 678 679 if (typeof content === "function") { 680 content = content(); 681 } 682 683 if (typeof content === "object") { 684 var title = 685 typeof content.title !== "undefined" && content.title 686 ? typeof content.title === "function" 687 ? content.title() 688 : content.title.toString() 689 : ""; 690 var detail = 691 typeof content.detail !== "undefined" && content.detail 692 ? typeof content.detail === "function" 693 ? content.detail() 694 : content.detail.toString() 695 : ""; 696 var image = 697 typeof content.image !== "undefined" && content.image 698 ? typeof content.image === "function" 699 ? content.image() 700 : content.image.toString() 701 : ""; 702 var image_link = 703 typeof content.image_link !== "undefined" && content.image_link 704 ? typeof content.image_link === "function" 705 ? content.image_link() 706 : content.image_link.toString() 707 : ""; 708 709 var bSvgImage = image.match(/^<svg[\s>]/); 710 711 if (title.length || detail.length || image.length) { 712 content = '<div class="notice__info-wrap">'; 713 714 if (image) { 715 content += 716 '<div class="line-block__item"><div class="notice__image' + (bSvgImage ? ' notice__image--svg' : '') + '">' + 717 (image_link ? '<a href="' + image_link + '">' : "") + 718 (
719 bSvgImage ? 720 '<i class="svg inline colored" aria-hidden="true">' + image + '</i>': 721 '<img src="' + image + '" />' 722 ) + 723 (image_link ? "</a>" : "") + 724 "</div></div>"; 725 } 726 727 if (title || detail) { 728 content += '<div class="notice__text-wrap">'; 729 if (title) { 730 content += '<div class="notice__title switcher-title bold">' + title + "</div>"; 731 } 732 if (detail) { 733 content += '<div class="notice__detail">' + detail + "</div>"; 734 } 735 content += "</div>"; 736 } 737 738 content += "</div>"; 739 } 740 } 741 742 if (typeof content === "undefined") { 743 return ""; 744 } else { 745 return content.toString(); 746 } 747 }, 748 749 init: function () { 750 if (!this.inited) { 751 this.inited = true; 752 753 var closer = this.closeable 754 ? '<span class="notice__closer stroke-theme-hover" title="' + 755 BX.message("NOTICE_CLOSE") + 756 '"><i class="svg inline svg-inline-" aria-hidden="true"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 1L1 13M1 1L13 13" stroke="#999999" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg></i></span>' 757 : ""; 758 759 this.node = BX.create({ 760 tag: "div", 761 attrs: { 762 class: 763 "notice notice--hidden" + 764 (this.classname.length ? " " + this.classname : "") + 765 (this.link.length ? " notice--link" : ""), 766 }, 767 dataset: { 768 type: this.type, 769 }, 770 html: closer + '<div class="notice__inner">' + this.content + "</div>", 771 }); 772 773 this.node.notice = this; 774 this.inner = this.node.querySelector(".notice__inner"); 775 if (this.closeable) { 776 this.closer = this.node.querySelector(".notice__closer"); 777 } 778 779 this.bindEvents(); 780 781 BX.onCustomEvent("onInitNotice", { notice: this }); 782 } 783 }, 784 785 bindEvents: function () { 786 if (this.node) { 787 if (typeof this.handlers.onClickNode === "function") { 788 this.node.addEventListener("click", this.handlers.onClickNode); 789 } 790 791 if (typeof this.handlers.onMouseEnterNode === "function") { 792 this.node.addEventListener("mouseenter", this.handlers.onMouseEnterNode); 793 } 794 795 if (typeof this.handlers.onMouseLeaveNode === "function") { 796 this.node.addEventListener("mouseleave", this.handlers.onMouseLeaveNode); 797 } 798 799 if (typeof this.handlers.onMouseEnterNode === "function") { 800 this.node.addEventListener("mousedown", this.handlers.onMouseDownNode); 801 } 802 803 if (typeof this.handlers.onMouseLeaveNode === "function") { 804 this.node.addEventListener("mouseup", this.handlers.onMouseUpNode); 805 } 806 } 807 808 if (this.closeable) { 809 if (this.closer && typeof this.handlers.onClickCloser === "function") { 810 this.closer.addEventListener("click", this.handlers.onClickCloser); 811 } 812 } 813 }, 814 815 unbindEvents: function () { 816 if (this.node) { 817 if (typeof this.handlers.onClickNode === "function") { 818 this.node.removeEventListener("click", this.handlers.onClickNode); 819 } 820 821 if (typeof this.handlers.onMouseEnterNode === "function") { 822 this.node.removeEventListener("mouseenter", this.handlers.onMouseEnterNode); 823 } 824 825 if (typeof this.handlers.onMouseLeaveNode === "function") { 826 this.node.removeEventListener("mouseleave", this.handlers.onMouseLeaveNode); 827 } 828 829 if (typeof this.handlers.onMouseEnterNode === "function") { 830 this.node.removeEventListener("mousedown", this.handlers.onMouseDownNode); 831 } 832 833 if (typeof this.handlers.onMouseLeaveNode === "function") { 834 this.node.removeEventListener("mouseup", this.handlers.onMouseUpNode); 835 } 836 } 837 838 if (this.closer && typeof this.handlers.onClickCloser === "function") { 839 this.closer.removeEventListener("click", this.handlers.onClickCloser); 840 } 841 }, 842 843 callback: function (callback) { 844 if (typeof callback === "function") { 845 callback(); 846 } 847 }, 848 849 appendTo: function (surface) { 850 this.surface = surface; 851 }, 852 853 show: function (callback) { 854 if (!this.visible) { 855 BX.addClass(this.node, "animate--notice-show"); 856 BX.removeClass(this.node, "notice--hidden"); 857 858 setTimeout( 859 BX.delegate(function () { 860 BX.removeClass(this.node, "animate--notice-show"); 861 this.startAutoClose(); 862 863 this.callback(callback); 864 }, this), 865 600 866 ); 867 868 BX.onCustomEvent("onShowNotice", { notice: this }); 869 } else { 870 this.callback(callback); 871 } 872 }, 873 874 hide: function (callback) { 875 if (this.visible) { 876 var that = this; 877 878 setTimeout(function () { 879 that.node.style.height = that.node.getBoundingClientRect().height + "px"; 880 that.node.style.opacity = 1; 881 882 setTimeout(function () { 883 BX.addClass(that.node, "animate--notice-hide"); 884 885 setTimeout(function () { 886 BX.addClass(that.node, "notice--hidden"); 887 BX.removeClass(that.node, "animate--notice-hide"); 888 889 that.callback(callback); 890 }, 700); 891 }, 25); 892 893 BX.onCustomEvent("onHideNotice", { notice: that }); 894 }, 100); 895 } else { 896 this.callback(callback); 897 } 898 }, 899 900 remove: function () { 901 if (!this.removed) { 902 this.removed = true; 903 904 this.hide( 905 BX.delegate(function () { 906 this.unbindEvents(); 907 908 if (this.inserted) { 909 this.surface.remove(this.surface.search(this)); 910 } 911 912 BX.onCustomEvent("onRemoveNotice", { notice: this }); 913 }, this) 914 ); 915 } 916 }, 917 918 startAutoClose: function () { 919 this.stopAutoClose(); 920 921 if (this.autoclose) { 922 this.autocloseTimer = setTimeout( 923 BX.delegate(function () { 924 this.remove(); 925 }, this), 926 this.autoclose 927 ); 928 } 929 }, 930 931 stopAutoClose: function () { 932 if (typeof this.autocloseTimer !== "undefined" && this.autocloseTimer) { 933 clearTimeout(this.autocloseTimer); 934 this.autocloseTimer = false;
935 } 936 }, 937 }; 938}
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.