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