document.addEventListener("DOMContentLoaded",function () {// \5012\8ba1\65f6  function getRandomNum(min,max) {return Math.floor(Math.random() * (max - min)) + min} let endTimeG function cutDownTime() {let nowTime = new Date() let endTime = new Date(endTimeG) let leftTime = endTime.getTime() - nowTime.getTime() if (leftTime < 0) {setupNewCountdown() leftTime = 0} let leftH = Math.floor((leftTime / (1000 * 60 * 60)) % 24),leftM = Math.floor((leftTime / (1000 * 60)) % 60),leftS = Math.floor((leftTime / 1000) % 60) leftH = leftH >= 10 ? leftH : "0" + leftH leftM = leftM >= 10 ? leftM : "0" + leftM leftS = leftS >= 10 ? leftS : "0" + leftS return {hour: leftH,minute: leftM,second: leftS,}} function setupNewCountdown() {const randomHour = getRandomNum(1,9) const currentTime = new Date() endTimeG = currentTime.setHours(currentTime.getHours() + randomHour)} let intervalId function getCutDownTime() {setupNewCountdown() if (intervalId) clearInterval(intervalId) intervalId = setInterval(function () {let cutDownTimeText = cutDownTime() $(".sp_top_cut_down .sp_left_view .sp_hour").html(cutDownTimeText.hour) $(".sp_top_cut_down .sp_left_view .sp_minute").html(cutDownTimeText.minute) $(".sp_top_cut_down .sp_left_view .sp_second").html(cutDownTimeText.second)},1000)} getCutDownTime() jQuery(".sp-scroll").slide({mainCell: ".nav-imgs",autoPlay: true,effect: "leftMarquee",interTime: 12,vis: 1,scroll: 1,}) let spImgList = ["https://cdn.shopify.com/s/files/1/0628/8700/2264/files/20250210-p1.png","https://cdn.shopify.com/s/files/1/0628/8700/2264/files/20250210-p2.png",] let swiper = new Swiper("#swiper-p1",{speed: 1,}) function mainRender() {$(function () {$("#root").css("zoom","normal") let scale = document.body.clientWidth / 1080 $("#root").css("zoom",scale) window.addEventListener("resize",(function () {var timer return function () {if (timer) clearTimeout(timer) timer = setTimeout(function () {$("#root").css("zoom","normal") let scale = document.body.clientWidth / 1080 $("#root").css("zoom",scale)},100)}})())}) function lazyLoadImages() {// \61d2\52a0\8f7d  const images = document.querySelectorAll(".lazy-load") // \83b7\53d6\6240\6709\9700\8981\61d2\52a0\8f7d\7684\56fe\7247  const config = {rootMargin: "0px 0px 1300px 0px",threshold: 0,} const lazyLoadObserver = new IntersectionObserver(function (entries,observer) {entries.forEach(function (entry) {if (entry.isIntersecting) {// \5f53\56fe\7247\8fdb\5165\89c6\53e3\65f6  const image = entry.target const dataSrc = image.getAttribute("data-src") image.src = dataSrc // \5c06 data-src\5c5e\6027\7684\503c\8bbe\7f6e\4e3a\56fe\7247\7684\5b9e\9645\5730\5740  lazyLoadObserver.unobserve(image) // \505c\6b62\89c2\5bdf\8be5\56fe\7247}})},config) images.forEach(function (image) {lazyLoadObserver.observe(image) // \5f00\59cb\89c2\5bdf\6bcf\4e2a\56fe\7247})} function preloadImages(imageArray) {// \9884\52a0\8f7d  // \68c0\67e5\6570\7ec4\6570\636e\7ed3\6784  if (Array.isArray(imageArray[0])) {// \5904\7406\4e8c\7ef4\6570\7ec4  imageArray.forEach(subArray => {subArray.forEach(url => {const img = new Image() img.src = url})})} else {// \5904\7406\4e00\7ef4\6570\7ec4  imageArray.forEach(url => {const img = new Image() img.src = url})}} lazyLoadImages() preloadImages(spImgList) // \627e\5230\6240\6709\8df3\8f6c\5957\9910\7684\951a\70b9\94fe\63a5  var links = document.querySelectorAll('a[href^="#shopping"]') links.forEach(function (link) {link.addEventListener("click",function (event) {event.preventDefault() // \963b\6b62\9ed8\8ba4\7684\8df3\8f6c\884c\4e3a  // var targetElement = document.getElementById("shopping"); // if (targetElement) {// targetElement.scrollIntoView({behavior: "smooth"}); //} // \65b9\5f0f\4e00  const targetElement = document.getElementById("shopping") // \83b7\53d6\8df3\8f6c\76ee\6807\8282\70b9  const offsetTop = targetElement.offsetTop let _topHeight = $(".time-part").height() + $(".sp-header-top").height() + $(".sp-scroll").height() window.scroll({top: offsetTop * $("div#root").css("zoom") - _topHeight * $("div#root").css("zoom"),behavior: "smooth",// \4f7f\7528  smooth \5b9e\73b0\5e73\6ed1\6eda\52a8}) // \65b9\5f0f\4e8c})}) // IOS\5b57\4f53\591a\4e86\95f4\8ddd\7684\5904\7406  \7ed9\8282\70b9\6dfb\52a0  sp_system \7c7b\540d  // \5224\65ad\5f53\524d\7528\6237\662f\5b89\5353\7aef\8fd8\662fiOS\7aef  var userAgent = navigator.userAgent || navigator.vendor || window.opera var isAndroid = /android/i.test(userAgent) var isIOS = /iPad|iPhone|iPod/.test(userAgent) && !window.MSStream var isPC = !isAndroid && !isIOS && !/Iron/.test(userAgent) // \6dfb\52a0\4e86\5bf9  "Iron" \5173\952e\8bcd\7684\5224\65ad  if (isAndroid) {console.log("Android")} else if (isIOS) {console.log("iOS")} else if (isPC) {console.log("PC")} else {$(".sp_system").css("letter-spacing","-4px")}} mainRender() let sp_price1 = 19.99 let sp_price2 = 39.99 function calcTotal(price,num) {let result = Number(price) * Number(num) return result.toFixed(2)} let prods = window.product function getCur() {let color = $("#sp-color div.active").attr("data-val") let num = $("#sp-num div.active").attr("data-val") return prods.filter(item => item.option1 == color && item.option2 == num)[0]} function changePrice() {let num = $("#calcNumber").val() let price = ((getCur().price * num) / 100).toFixed(2) let compare = ((getCur().compare_at_price * num) / 100).toFixed(2) // price = (price + "").replace(".",",") // compare = (compare + "").replace(".",",") $("#sp_price1").html(price) $("#sp_price2").html(compare) let off_price = ((getCur().compare_at_price - getCur().price) / 100).toFixed(2) // off_price = (off_price + "").replace(".",",") $(".product-part .price-group .price3 span").html(off_price)} // \5f39\7a97  start var main_id = "" $(".emitCheckout").click(function () {console.log("1111") main_id = getCur().id // main_id = $(this).siblings(".select_span").find("span.on").data("id") // window.location.href = "/cart/" + id + ":1"}) function getPopProdId() {let selectVals = [] $(".overbuy_wrap .sp-subopt.active").each(function () {selectVals.push($(this).data("val"))}) let cur = popProduct.filter(item => {let option1 = selectVals[0] let option2 = null let option3 = null if (selectVals[1]) {option2 = selectVals[1]} if (selectVals[2]) {option3 = selectVals[2]} return (item.option1 == option1 && item.option2 == option2 && item.option3 == option3)}) return cur[0]} $(".overbuy-select div").click(function () {$(this).siblings().removeClass("active") $(this).addClass("active") let cur = getPopProdId() if (cur) {$(".main-btn").text("GET 10% oFF").removeClass("overbuy_disabled") let _price = parseFloat(cur.price / 100).toFixed(2) let _compare_at_price = parseFloat(cur.compare_at_price / 100).toFixed(2) $(".overbuy_price span") .eq(0) .html("$" + _price) $(".overbuy_price span") .eq(1) .html("$" + _compare_at_price)} else {$(".main-btn").text("Unavailable").addClass("overbuy_disabled")}}) window.emitSubmit = function (_type) {let num = $("#calcNumber").val() if (_type == "all") {// var bundle_sku = data[$('input[name="overbuy1"]:checked').val()][$('input[name="overbuy2"]:checked').val()] let _id = getPopProdId()?.id if (!_id) return console.log(_id) window.location.href = `/cart/${main_id}:${num},${_id}:1`} else {window.location.href = `/cart/${main_id}:${num}`}} // \5f39\7a97  end $(".sp-btn-style").click(function () {let num = $("#calcNumber").val() // window.location.href = "/cart/" + getCur().id + ":" + num}) $(".sp-reduce").click(function () {let input = $(this).siblings("input")[0] let num = Number(input.value) - 1 if (num > 0) {input.value = num} changePrice()}) $(".sp-add").click(function () {let input = $(this).siblings("input")[0] let num = Number(input.value) + 1 input.value = num changePrice()}) $(function () {$(".sp-option").click(function () {$(this).siblings().removeClass("active") $(this).addClass("active") // style\9009\9879  let colorOptions = $("#sp-color .sp-option.active").index() let _index = colorOptions swiper.slideTo(_index) changePrice()}) // style\9009\9879  // // \5904\7406\52a0\5165\8d2d\7269\8f66\4e8b\4ef6  // function handleAddToCart(num) {// if (num > 0) {// $("#cardNum").html(num).show(); // $(".sp-top-btn").addClass("sp-high"); // $(".sp-top-btn span").html("Check out"); // $(".sp-header-top .sp-cart").addClass("on"); //} else {// $("#cardNum").html(0).hide(); // $(".sp-top-btn").removeClass("sp-high"); // $(".sp-top-btn span").html("Buy now"); // $(".sp-header-top .sp-cart").removeClass("on"); //} //} // handleAddToCart(0); if (window.cartCount > 0) {$("#cardNum").removeClass("sp-gray")} // \8d2d\7269\8f66\52a0\8d2d\52a8\6548  $(".cart-btn").click(function () {$(this).children("img").addClass("on") $(".sp-header-top .sp-cart .num").show() setTimeout(function () {$(".cart-btn").children("img").removeClass("on")},500) $(".sp-header-top .sp-cart").addClass("on") setTimeout(function () {$(".sp-header-top .sp-cart").removeClass("on")},500)}) let initNum = 0 $(".product-part .cart-btn").click(function () {var data = {id: getCur().id,quantity: $("#calcNumber").val(),} $.ajax({type: "POST",url: "/cart/add.js",data: data,success: function () {$.getJSON(window.Shopify.routes.root + "cart.js",function (result) {$("#cardNum").html(result.item_count) $("#cardNum").removeClass("sp-gray")})},dataType: "json",}) // handleAddToCart(initNum); // var img = $(".product-part .p-img"); var img = $(".product-part .swiper-slide-active .sp-img") var flyer = img[0].cloneNode(true) flyer.classList.add("sp_clone") $(".product-part").append(flyer) $(".sp_clone").css({width: img[0].width,height: img[0].height,position: "fixed",top: img[0].offsetTop,left: img.offset().left,"z-index": "99",}) let finish = $(".sp-cart") $(".sp_clone").animate({top: finish[0].offsetTop + finish.height() / 2 + $(".time-part").height(),left: finish[0].offsetLeft + finish.width() / 2,width: 50,// \7ed3\675f\65f6\7684\5927\5c0f\ff0c\6839\636e\9700\8981\8c03\6574  height: 50,// \7ed3\675f\65f6\7684\5927\5c0f\ff0c\6839\636e\9700\8981\8c03\6574  opacity: .4,},500,"linear",function () {$(this).animate({width: 0,height: 0,opacity: 0,},0,function () {$(this).detach()})})})})}){}
/*# sourceMappingURL=/cdn/shop/t/28/assets/begsses.css.map */
