PageSourceSearch

http://malyar.kz/bitrix/js/aspro.max/notice.js?171135981428186

js malyar.kz collected 2026-09-28 22:56:34 UTC 28,186 bytes, 971 lines download raw bytes

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

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.