class AlertElement extends HTMLElement { constructor() { super(); this.close = this.close.bind(this); this.destroyCloseButton = this.destroyCloseButton.bind(this); this.createCloseButton = this.createCloseButton.bind(this); this.onMutation = this.onMutation.bind(this); this.observer = new MutationObserver(this.onMutation); this.observer.observe(this, { attributes: false, childList: true, subtree: true }); this.addEventListener('animationend', (event) => { if (event.animationName === 'ecoui-alert-fade-in' && event.target === this) { this.dispatchEvent(new CustomEvent('ecoui.alert.shown')); this.style.removeProperty('animationName'); } }); this.addEventListener('animationend', (event) => { if (event.animationName === 'ecoui-alert-fade-out' && event.target === this) { this.dispatchEvent(new CustomEvent('ecoui.alert.closed')); this.remove(); } }); } static get observedAttributes() { return ['type', 'role', 'dismiss', 'auto-dismiss', 'close-text']; } get type() { return this.getAttribute('type'); } set type(value) { this.setAttribute('type', value); } get role() { return this.getAttribute('role'); } set role(value) { this.setAttribute('role', value); } get closeText() { return this.getAttribute('close-text'); } set closeText(value) { this.setAttribute('close-text', value); } get dismiss() { return this.getAttribute('dismiss'); } set dismiss(value) { this.setAttribute('dismiss', value); } get autodismiss() { return this.getAttribute('auto-dismiss'); } set autodismiss(value) { this.setAttribute('auto-dismiss', value); } connectedCallback() { this.dispatchEvent(new CustomEvent('ecoui.alert.show')); this.style.animationName = 'ecoui-alert-fade-in'; if (!this.type || !['info', 'warning', 'danger', 'success'].includes(this.type)) { this.setAttribute('type', 'info'); } if (!this.role || !['alert', 'alertdialog'].includes(this.role)) { this.setAttribute('role', 'alert'); } if (this.firstElementChild && this.firstElementChild.tagName === 'BUTTON') { this.button = this.firstElementChild; if (this.button.classList.contains('ecoui-alert--close')) { this.button.classList.add('ecoui-alert--close'); } if (this.button.innerHTML === '') { this.button.innerHTML = ''; } if (!this.button.hasAttribute('aria-label')) { this.button.setAttribute('aria-label', this.closeText); } } if (this.hasAttribute('dismiss') && !this.button) { this.createCloseButton(); } if (this.hasAttribute('auto-dismiss')) { this.autoDismiss(); } } disconnectedCallback() { if (this.button) { this.button.removeEventListener('click', this.close); } this.observer.disconnect(); } attributeChangedCallback(attr, oldValue, newValue) { switch (attr) { case 'type': if (!newValue || (newValue && ['info', 'warning', 'danger', 'success'].indexOf(newValue) === -1)) { this.type = 'info'; } break; case 'role': if (!newValue || (newValue && ['alert', 'alertdialog'].indexOf(newValue) === -1)) { this.role = 'alert'; } break; case 'dismiss': if ((!newValue || newValue === '') && (!oldValue || oldValue === '')) { if (this.button && !this.hasAttribute('dismiss')) { this.destroyCloseButton(); } else if (!this.button && this.hasAttribute('dismiss')) { this.createCloseButton(); } } else if (this.button && newValue === 'false') { this.destroyCloseButton(); } else if (!this.button && newValue !== 'false') { this.createCloseButton(); } break; case 'close-text': if (!newValue || newValue !== oldValue) { if (this.button) { this.button.setAttribute('aria-label', newValue); } } break; case 'auto-dismiss': this.autoDismiss(); break; } } onMutation(mutationsList) { for (const mutation of mutationsList) { if (mutation.type === 'childList') { if (mutation.addedNodes.length) { if (this.button && this.firstElementChild !== this.button) { this.prepend(this.button); } } } } } close() { this.dispatchEvent(new CustomEvent('ecoui.alert.close')); this.style.animationName = 'ecoui-alert-fade-out'; } createCloseButton() { this.button = document.createElement('button'); this.button.setAttribute('type', 'button'); this.button.classList.add('ecoui-alert--close'); this.button.innerHTML = ''; this.button.setAttribute('aria-label', this.closeText); this.insertAdjacentElement('afterbegin', this.button); this.button.addEventListener('click', this.close); } destroyCloseButton() { if (this.button) { this.button.removeEventListener('click', this.close); this.button.parentNode.removeChild(this.button); this.button = null; } } autoDismiss() { const timer = parseInt(this.getAttribute('auto-dismiss'), 10); setTimeout(this.close, timer >= 10 ? timer : 3000); } } if (!customElements.get('ecoui-alert')) { customElements.define('ecoui-alert', AlertElement); } function detailShow(a){$(".shop-product-spec").length&&show_spec(0,a);var t=a.find(".image-video .images-list");$(".image-video .slider-for").find(".slick-slide").click(function(){imgremove(a)}),t.on("beforeChange",function(){imgremove(a,500)}),a.find(".spec-list .selectspec").click(function(){$(this).toggleClass("btn-danger").parent(".spec-li").siblings().find("a").removeClass("btn-danger"),$(this).addClass("btn-danger"),show_spec(1,a)}),$(".detail-shop .lr-boxs").unbind("click").click(function(){var a=$(this).parents(".shop-detail");show_spec(1,a),a.find(".shop-product-detail").slideDown(300),a.find(".masks").show(),$("html").css({overflow:"hidden",height:"100%"})}),$(".shop-product-detail .close").unbind("click").click(function(){var a=$(this).parents(".shop-detail");a.find(".shop-product-detail").slideUp(300),a.find(".masks").hide(),$("html").css({overflow:"",height:""})}),$(".masks").on("click",function(){var a=$(this).parents(".shop-detail");a.find(".masks").hide(),$("html").css({overflow:"",height:""}),a.find(".pd-para-div").slideUp(300),a.find(".shop-product-detail").slideUp(300),a.find(".ecproduct-address").slideUp(300)}),$(document).on("click",".product-pimg img",function(a){$(this);var t=$(this).attr("src"),e=$(this).parents(".shop-detail");if(e.find(".shop-product-spec.fngallery").length){e.find(".shop-product-spec.fngallery").find('[data-med="'+t+'"]').trigger("click")}});var e=a.find(".shop-product-spec.fngallery");if(e.length){var i=e.find(".lg-item-box");if(i.length){var s=!0;i.each(function(){$(this).one("click",function(){s&&($.initPhotoSwipeFromDOM(".fngallery",".lg-item-box[data-med]"),s=!1)})})}}}function currentChange(){var a=$(".detail-shop").data("currency"),t=$(".detail-shop").data("jgfh"),e=$(".detail-shop").data("jgfhy");e||(Currency.format="money_format");var i=a;Currency.moneyFormats[i].money_with_currency_format=t+"{{amount}} "+e,Currency.moneyFormats[i].money_format=t+"{{amount}}";var s=Currency.cookie.read();$("span.shopmoney span.shopmoney").each(function(){$(this).parents("span.shopmoney").removeClass("shopmoney")}),$("span.shopmoney").each(function(){$(this).attr("data-currency-"+i,$(this).html())});var l=$(".currency li");s===i||null==s?(l.removeClass("active"),$(".currency li[data-currency="+i+"]").addClass("active"),Currency.currentCurrency=i,$(".current-currency").text(i)):($("span.shopmoney").each(function(){$(this).attr("data-currency-"+s,"")}),Currency.convertAll(i,s),Config.money=Currency.moneyFormats[s].money_format,l.removeClass("active"),$(".currency li[data-currency="+s+"]").addClass("active"),$(".current-currency").text(s))}function show_spec(a,t){var e="",i=new Array;t.find(".spec-list .selectspec").each(function(){$(this).hasClass("btn-danger")&&(e=e+$(this).attr("title")+" ",i.push($(this).data("id")))});var s="_"+i.join("_");t.find(".spec_key").val(s),t.find(".spec_key_name").val(e);var l=$(".detail-shop").data("jgfh"),o=$(".detail-shop").data("jgfhy"),c=$(".detail-shop").data("currency");if(shopskusymboljsonlist[s]){var d=shopskusymboljsonlist[s].price,n=shopskusymboljsonlist[s].original_price;if(d=(d/1).toFixed(2),n=(n/1).toFixed(2),t.find(".m_price").html(l+d+o).attr("data-currency",c),t.find(".m_stock").html(shopskusymboljsonlist[s].stock),t.find(".product-price").find(".shop-name").html(e),t.find(".m_total").attr("data-max",shopskusymboljsonlist[s].stock),t.find(".m_original_price").html(l+n+o).attr("data-currency",c),t.find(".m_total").trigger("touchspin.updatesettings",{min:1,max:shopskusymboljsonlist[s].stock}),a){currentChange();var r=shopskusymboljsonlist[s].img;if("mobile"==Config.userAgent||Breakpoints.is("xs")||Breakpoints.is("sm")||Breakpoints.is("md"))t.find(".product-pimg img").attr({src:r});else{var u=t.find(".images-list"),p=u.find(".slick-current a").length?u.find(".slick-current a"):u.find(".slick-slide a");p.attr("href"),p.data("src");r?(p.find("img").attr({src:r}).parents(".slick-slide"),p.attr("href",r)):imgremove(t,300)}}shopskusymboljsonlist[s].stock}else t.find(".m_price").html(l+$(".shop-price").data("price")+o).attr("data-currency",c),t.find(".m_stock").html(t.find(".m_total").data("value")),t.find(".m_total").attr("data-max",t.find(".m_total").data("value")),t.find(".m_original_price").html(l+$(".shop-original-price").data("price")+o).attr("data-currency",c),t.find(".m_total").trigger("touchspin.updatesettings",{min:1,max:t.find(".m_total").data("value")})}function imgremove(a,t){var e=a.find(".image-video .images-list");a.find(".image-video .slider-for");e.find(".slick-slide a").each(function(){var a=$(this),t=$(this).attr("href"),e=$(this).data("src"),i=i||0;setTimeout(function(){t!=e&&(a.find("img").attr({src:e}),a.attr("href",e))},i)})}function fontsizeChange(){var a=$(window).width();if(a<=750){var t=a/38;t<=14&&(t=14),$("html").css("font-size",t)}else $("html").css("font-size","")}function tabSwiper(a){var t=function(){if(sonWidthSum(a+">li")+$(".caret",a).length>$(a).parent().width())if($(a).hasClass("swiper-wrapper"))$(a).hasClass("flex-start")||$(a).addClass("flex-start");else{$(a).addClass("swiper-wrapper flex-start").wrap('
').after('
').find(">li").addClass("swiper-slide");new Swiper(".swiper-navtab",{scrollbar:{el:".swiper-scrollbar",draggable:!0},slidesPerView:"auto"})}else $(a).hasClass("flex-start")&&$(a).removeClass("flex-start")};t(),$(window).resize(function(){t()}),$(a).removeClass("invisible-xs")}function sonWidthSum(a,t){var e=$(a),i=e.length,s=0;(t>i||!t)&&(t=i);for(var l=0;l