(function() {
var __sections__ = {};
(function() {
for(var i = 0, s = document.getElementById('sections-script').getAttribute('data-sections').split(','); i < s.length; i++)
__sections__[s[i]] = true;
})();
(function() {
if (!__sections__["firework-embed"] && !window.DesignMode) return;
try {
/* This function is required for the floating player and floating button.
Shopify's page-builder places these DOM nodes in a weird way that blocks
the static positioning from working properly. Moving the node to be a
direct child of
makes it work properly. */
var element = document.getElementById('move-to-body');
if (element) {
document.querySelector('body').appendChild(element);
}
} catch(e) { console.error(e); }
})();
(function() {
if (!__sections__["index-slideshow"] && !window.DesignMode) return;
try {
class SliderShow extends HTMLElement {
constructor() {
super();
this.init = this.init.bind(this);
this.config = JSON.parse(this.querySelector('[data-config]').dataset.config);
this.init();
window.addEventListener('resize', Shopify.debounce(this.init, 1000));
}
init() {
const {offsetWidth} = document.documentElement;
const {ratioMobile, ratioPc, ratioTable} = this.config;
if (offsetWidth <= 760) {
UIkit.slideshow(this, Object.assign(this.config, {ratio: ratioMobile}));
} else if (offsetWidth <= 1440) {
UIkit.slideshow(this, Object.assign(this.config, {ratio: ratioTable}));
} else {
UIkit.slideshow(this, Object.assign(this.config, {ratio: ratioPc}));
}
}
}
customElements.define('slider-show', SliderShow)
} catch(e) { console.error(e); }
})();
(function() {
if (!__sections__["main-article"]) return;
try {
const iframes = document.querySelector('[data-content]').querySelectorAll('iframe');
const images = document.querySelector('[data-content]').querySelectorAll('img');
if (iframes.length > 0) {
iframes.forEach(iframe => {
let width = Number(iframe.width) || 0;
let height = Number(iframe.height) || 0;
const proportion = width / height;
if (!width || !height) return;
if (width <= 960) {
width = 960;
height = height * proportion;
iframe.setAttribute('width', width.toString());
iframe.setAttribute('height', height.toString());
iframe.setAttribute('uk-responsive', '');
}
});
}
if (images.length > 0) {
images.forEach(iframe => iframe.classList.add('uk-border-rounded'));
}
} catch(e) { console.error(e); }
})();
(function() {
if (!__sections__["main-cart"]) return;
try {
class CartNote extends HTMLElement {
constructor() {
super();
this.addEventListener('change', debounce((event) => {
const body = JSON.stringify({ note: event.target.value });
fetch(`${routes.cart_update_url}`, {...fetchConfig(), ...{ body }});
}, 300))
}
}
customElements.define('cart-note', CartNote);
} catch(e) { console.error(e); }
})();
(function() {
if (!__sections__["main-search"]) return;
try {
const itemBtn = document.querySelectorAll('[data-grid-item]');
let nowProductUrl = '';
if(itemBtn.length > 0) {
itemBtn.forEach(element => {
element.addEventListener('click', async event => {
event.preventDefault();
const { target } = event;
const url = `${target.href}`;
if(url === nowProductUrl) {
UIkit.modal('#js-product-modal').show();
return;
} else {
document.querySelector('[data-quick-container]').innerHTML = `
`;
}
UIkit.modal('#js-product-modal').show();
nowProductUrl = url;
const source = await fetch(url)
.then((response) => response.text())
.then((responseText) => {
const html = new DOMParser().parseFromString(responseText, 'text/html')
return html.querySelector('[data-main-product]')
});
if (source) {
document.querySelector('[data-quick-container]').innerHTML = source.innerHTML;
Shopify.PaymentButton.init();
}
})
})
}
} catch(e) { console.error(e); }
})();
(function() {
if (!__sections__["main-user-guides"]) return;
try {
class videoComponent extends HTMLElement{
constructor() {
super();
this.isShowMore = false;
this.showString = {
show: "Show More",
close: "Close"
}
this.playsBtns = this.querySelectorAll('[data-code]');
this.init();
}
init() {
if(this.playsBtns.length >= 1) {
this.playsBtns.forEach((btn) => {
btn.addEventListener('click', (e) => {
e.target.blur();
const videoUrl = e.target.dataset.code;
const videoElement = ` `
UIkit.modal.dialog(`${videoElement}
`);
});
});
}
if(this.playsBtns.length > 4) {
this.querySelector('[data-more]').addEventListener('click', (e) => {
this.isShowMore = !this.isShowMore;
e.target.innerHTML = this.isShowMore ? this.showString.close : this.showString.show;
this.classList.toggle('show', this.isShowMore);
});
}
}
}
customElements.define('video-component', videoComponent);
} catch(e) { console.error(e); }
})();
(function() {
if (!__sections__["product-recommendations"] && !window.DesignMode) return;
try {
const handleIntersection = (entries, observer) => {
if (!entries[0].isIntersecting) return;
observer.unobserve(productRecommendationsSection);
window.fetch(productRecommendationsSection.dataset.url).then(response => response.text()).then(text => {
const html = document.createElement('div');
html.innerHTML = text;
const recommendations = html.querySelector('.product-recommendations');
if (recommendations && recommendations.innerHTML.trim().length) {
productRecommendationsSection.innerHTML = recommendations.innerHTML;
}
}).catch(e => {
console.error(e);
productRecommendationsSection.classList.add('uk-hidden');
});
};
const productRecommendationsSection = document.querySelector('.product-recommendations');
const observer = new IntersectionObserver(handleIntersection, {rootMargin: '0px 0px 200px 0px'});
observer.observe(productRecommendationsSection);
} catch(e) { console.error(e); }
})();
(function() {
if (!__sections__["product-tech-specs"] && !window.DesignMode) return;
try {
const nullState = `Null
`;
class tabs {
constructor(container) {
this.state = {
cacheData: {},
}
this.selectors = {
tabButtons: container.querySelectorAll('[data-tech-handle]'),
tabContent: container.querySelector('[data-tech-content]')
}
if (this.selectors.tabButtons.length) { this.init() }
}
init() {
const { state, selectors } = this;
const { cacheData } = state;
const { tabButtons, tabContent } = selectors;
const key = `TAB0`;
const fistTabHandle = tabButtons[0].dataset.techHandle;
if (location.href.indexOf(fistTabHandle) !== -1) {
cacheData[key] = tabContent.innerHTML;
} else {
this.updateSections(0, tabButtons[0].dataset.techHandle);
}
tabButtons.forEach((element, index) => {
element.addEventListener('click', (event) => {
event.target.closest('ul').querySelectorAll('li').forEach(e => e.classList.remove('tm-active'))
event.target.closest('li').classList.add('tm-active');
this.updateSections(index, event.target.dataset.techHandle);
}, false);
})
}
async updateSections(index, url) {
const key = `TAB${index}`
const { state, selectors } = this;
const { cacheData } = state;
const { tabContent } = selectors;
if (!cacheData[key]) {
const data = await this.requestData(url);
tabContent.innerHTML = cacheData[key] = data ? data : nullState;
} else {
tabContent.innerHTML = cacheData[key];
}
}
async requestData(url) {
return await fetch(url).then((response) => response.text()).then((responseText) => {
const html = new DOMParser().parseFromString(responseText, 'text/html');
return html.querySelector('[data-tech-content]').innerHTML;
});
}
}
new tabs(document.querySelector('[data-section-type="product-tech-specs"]'));
} catch(e) { console.error(e); }
})();
(function() {
if (!__sections__["product-videos"] && !window.DesignMode) return;
try {
class videoComponent extends HTMLElement{
constructor() {
super();
this.isShowMore = false;
this.showString = {
show: "See More",
close: "Close"
}
this.heroBtn = this.querySelector('[data-hero]');
this.playsBtns = this.querySelectorAll('[data-code]');
this.init();
}
play (code) {
if(!code) {
return;
}
const videoUrl = `//www.youtube-nocookie.com/embed/${code}?autoplay=0&showinfo=0&rel=0&modestbranding=1&playsinline=1`;
const videoElement = ` `
UIkit.modal.dialog(`${videoElement}
`);
}
init() {
const playLength = this.playsBtns.length;
if(this.heroBtn) {
this.heroBtn.addEventListener('click', (e) => {
e.target.blur();
this.play(e.target.dataset.hero);
});
}
if(playLength >= 1) {
this.playsBtns.forEach((btn) => {
btn.addEventListener('click', (e) => {
e.target.blur();
this.play(e.target.dataset.code);
});
});
}
if(playLength > 3) {
this.querySelector('[data-more]').addEventListener('click', (e) => {
this.isShowMore = !this.isShowMore;
e.target.innerHTML = this.isShowMore ? this.showString.close : this.showString.show;
this.classList.toggle('show', this.isShowMore);
});
}
}
}
customElements.define('video-component', videoComponent);
} catch(e) { console.error(e); }
})();
(function() {
if (!__sections__["products-list"] && !window.DesignMode) return;
try {
let isShow = false;
const showString = {
show: "View More",
close: "Close"
}
document.querySelector('[data-more]')?.addEventListener('click', (e) => {
isShow = !isShow;
e.target.innerHTML = isShow ? showString.close : showString.show;
document.querySelector('[data-list-container]').classList.toggle('show', isShow);
})
} catch(e) { console.error(e); }
})();
(function() {
if (!__sections__["publicToast"] && !window.DesignMode) return;
try {
function showToast() {
if(document.querySelector("#modal-center")){
UIkit.modal("#modal-center").show();
}
}
var publicToast = sessionStorage.getItem("publicToast") || false;
if (! publicToast) {
sessionStorage.setItem("publicToast", true);
setTimeout(function() {
showToast();
}, 1000)
}
} catch(e) { console.error(e); }
})();
(function() {
if (!__sections__["slideshow"] && !window.DesignMode) return;
try {
class Slideshow {
constructor(container) {
this.container = container;
this.firstType = this.container.querySelector('[uk-slideshow].js-enable-top li').classList.contains('uk-light');
this.initSlideshow(this.firstType);
this.init();
}
initSlideshow(flag) {
document.querySelector('.tm-header').classList.toggle('uk-light', flag);
}
init() {
this.container.querySelector('[uk-slideshow].js-enable-top')?.addEventListener('beforeitemshow', (e) => {
const is_light = e.target.classList.contains('uk-light');
this.initSlideshow(is_light);
});
}
}
new Slideshow(document.querySelector('[data-section-type="slideshow"]'));
} catch(e) { console.error(e); }
})();
(function() {
if (!__sections__["support-faqs"] && !window.DesignMode) return;
try {
let flag = false;
const showString = {
show: "Show More",
close: "Close"
}
document.querySelectorAll('[data-group]').forEach(element => {
const oBtn = element.querySelector('button');
if (oBtn) {
oBtn.addEventListener('click', (e) => {
flag = !flag;
e.target.innerHTML = flag ? showString.close : showString.show;
element.querySelector('[uk-accordion]').classList.toggle('open', flag)
});
}
})
} catch(e) { console.error(e); }
})();
(function() {
if (!__sections__["video-list"] && !window.DesignMode) return;
try {
class videoComponent extends HTMLElement{
constructor() {
super();
this.isShowMore = false;
this.showString = {
show: "See More",
close: "Close"
}
this.heroBtn = this.querySelector('[data-hero]');
this.playsBtns = this.querySelectorAll('[data-code]');
this.init();
}
play (code) {
console.log(code);
if(!code) {return;}
const videoUrl = `//www.youtube-nocookie.com/embed/${code}?autoplay=0&showinfo=0&rel=0&modestbranding=1&playsinline=1`;
const videoElement = ` `
UIkit.modal.dialog(`${videoElement}
`);
}
init() {
const playLength = this.playsBtns.length;
if(this.heroBtn) {
this.heroBtn.addEventListener('click', (e) => {
e.target.blur();
this.play(e.target.dataset.hero);
});
}
if(playLength >= 1) {
this.playsBtns.forEach((btn) => {
btn.addEventListener('click', (e) => {
e.target.blur();
this.play(e.target.dataset.code);
});
});
}
if(playLength > 3) {
this.querySelector('[data-more]').addEventListener('click', (e) => {
this.isShowMore = !this.isShowMore;
e.target.innerHTML = this.isShowMore ? this.showString.close : this.showString.show;
this.classList.toggle('show', this.isShowMore);
});
}
}
}
customElements.define('video-component', videoComponent);
} catch(e) { console.error(e); }
})();
})();