!function () { const e = "beforeend", n = "hidden", t = (n, t, i = e) => { t.insertAdjacentHTML(i, n) }, i = e => 1 === String(e).length ? `0${e}` : e; class a { #e = null; #n = null; #t = null; #i = null; #a = null; #r = null; #o = null; #l = null; #s = null; #m = null; #c = null; #p = null; #h = localStorage; constructor(e) { this.#e = e.outerHTML, this.#m = document.querySelector(".gc-main-content") } get templateStyle() { return "\n " } get template() { return `\n \n \n ${this.#e}\n
\n\n \n ` } get element() { return this.#n || (this.#n = this.template), this.#n } init() { if (t(this.templateStyle, this.#m), t(this.element, this.#m), this.#d(), this.#i = document.querySelector(".ip-banner"), this.#a = this.#i.querySelector(".ip-banner__close"), this.#r = this.#i.querySelector(".ip-banner__content"), this.#o = this.#r.querySelector(".lite-page.block-set"), this.#o.classList.add("ip-banner__content-frame"), this.#o.classList.remove("lite-page"), this.#o.classList.remove("block-set"), this.#l = this.#i.querySelector(".ip-banner-item"), this.#p = this.#i.querySelectorAll(".image-box img"), this.#l ? (this.#s = this.#l.querySelector(".countdown-el"), this.#t = this.#s.dataset.time, this.#c = this.#l.className.split("ip-banner-item-")[1], this.#s && this.#u(this.#t)) : this.#i.classList.add(n), this.#p.length) for (let e of this.#p) e.src = e.dataset.src; this.#a.addEventListener("click", this.#g); const e = this.#h.getItem(`ipBannerStateId-${this.#c}`); if (console.log(`ipBannerStateId-${this.#c}`), e) { const t = JSON.parse(e), i = JSON.parse(e).id, a = JSON.parse(e).count; if (moment((new Date).valueOf()) - moment(t.timeCloseClick).valueOf() >= 6e5 && a < 3) console.log("прошло более 6 часов"); else { document.querySelector(`.ip-banner-item-${i}`).classList.add(n); document.querySelectorAll(".ip-banner-item")[0].classList.contains("hidden") && this.#i.classList.add(n), console.log("прошло менее 6 часов") } } } #b(e) { let n = document.createElement("script"); n.setAttribute("src", e), document.body.appendChild(n) } #d() { const e = document.querySelectorAll(".ip-banner-item"); if (e.length) { for (const n of e) n.style = "display: none !important"; e[0].style = "display: block !important" } } #u(e) { let n = e.split(" "), t = n[0], a = n[1], r = moment(`${t}T${a}:00Z`), o = moment(new Date), l = r.valueOf() - o.valueOf(), s = 1e3, m = document.querySelector(`.ip-banner-item-${this.#c} .countdown-el`); setInterval((function () { l = moment.duration(l - s, "milliseconds"), m.textContent = l - s > 0 ? `\n ${i(l.days())}Д : ${i(l.hours())}Ч : ${i(l.minutes())}М : ${i(l.seconds())}С\n ` : "00Д : 00Ч : 00М : 00С" }), s) } #g = () => { this.#i.classList.add(n), this.#f() }; #f = () => { const e = this.#c; if (e >= 1) { const n = moment(new Date), t = this.#h.getItem(`ipBannerStateId-${e}`); let i; t && (i = JSON.parse(t).count), this.#h.setItem(`ipBannerStateId-${e}`, JSON.stringify({ id: e, count: i ? ++i : 1, timeCloseClick: n })) } } } const r = (() => { const e = location.pathname; return ["/teach/control/stream", "/pl/teach/control/lesson", "/sales/control", "/profile", "/src-main", "/src-library/cases"].some((n => -1 !== e.indexOf(n))) })(), o = localStorage.getItem("DeleteCSTBanner"); fetch("/cst-banner").then((e => e.text())).then((e => (new DOMParser).parseFromString(e, "text/html").querySelector(".lite-page.block-set"))).then((e => { if (r && !o) { new a(e).init() } })).catch((e => console.log("Failed to fetch page: ", e))) }();