var upwardsLocked = false
const orginalAlert = window.alert;
window.alert = function(message){
try {
if( typeof message === 'string'){
const parser = new DOMParser();
const doc = parser.parseFromString(message, 'text/html')
const decoded = doc.body.textContent || message
orginalAlert(decoded)
}else{
orginalAlert(message)
}
}catch(e){
orginalAlert(message)
}
}
// JQ 功能擴增
$.fn.triggerAll = function(list) {
return this.each(function() {
const $this = $(this)
$.each(list.split(' '), function(key, val) {
$this.trigger(val)
})
})
}
// 裝置判斷
function DeviceIsTouch() {
const userAgent = navigator.userAgent
const regexp = /Android|iPhone|SymbianOS|Windows Phone|iPad|iPod|Touch|Mobile|Tablet|BlackBerry/gi
return !!userAgent.match(regexp)
}
// resize 裝置判斷
;(function($) {
$(window).on('resize', function(e) {
if(DeviceIsTouch()) {
$('body').removeClass('DeviceWithHover')
} else {
$('body').addClass('DeviceWithHover')
}
})
})($)
//定義css變數 --vh 避免行動裝置vh計算異常(會被瀏覽器address bar影響)
$(function(){
function setVh(){
$('html').attr('style', `--vh: ${window.innerHeight * 0.01}px;`)
}
setVh()
$(window).on('resize', setVh)
})
// 天邊跑馬燈設定
;(function($) {
const marqueeTarget = $(".top-marquee")
if(marqueeTarget.length && marqueeTarget.children('.marquee-item').length > 1) {
marqueeTarget.owlCarousel({
items: 1,
nav: false,
dots: false,
autoplay: true,
autoplayTimeout: 5000,
autoplaySpeed: 1000,
autoplayHoverPause: true,
animateIn: 'theme-in',
animateOut: 'theme-out',
mouseDrag: false,
loop: true,
});
}
//跑馬燈倒數模式
if($('.top-marquee .countdown-box').length) {
$('.top-marquee .countdown-box').each(function(){
countDown($(this))
})
}
function leadingZero(number) {
const num = parseInt(number)
if(!isNaN(num)) {
if(Math.abs(num) < 10) {
return "0" + Math.abs(num)
} else {
return String(Math.abs(num))
}
} else {
console.error('輸入格式錯誤')
}
}
function countdownBox(number, string = null) {
const numberStr = leadingZero(number)
let returnStr = '
' + numberStr + '
'
if(string) {
return returnStr + '' + string + '
'
} else {
return returnStr
}
}
function countDown(target) {
if(!target.data("endTime")){
const totalSeconds = parseInt(target.attr('data-second'), 10)
const endTime = Date.now() + totalSeconds * 1000
target.data("endTime", endTime)
}
const diff = Math.ceil((target.data("endTime") - Date.now()) / 1000)
const leftTime = Math.max(0, diff)
if(leftTime > 0) {
const leftSec = leftTime % 60
const leftMin = Math.floor(leftTime / 60) % 60
const leftHour = Math.floor(leftTime / 60 / 60) % 24
const leftDate = Math.floor(leftTime / 60 / 60 / 24)
if(leftDate > 0) {
target.html(`
${countdownBox(leftDate, _jsLang.天)}
${countdownBox(leftHour, _jsLang.時)}
${countdownBox(leftMin, _jsLang.分)}
${countdownBox(leftSec, _jsLang.秒)}
`)
} else {
target.html(`
${countdownBox(leftHour, _jsLang.時)}
${countdownBox(leftMin, _jsLang.分)}
${countdownBox(leftSec, _jsLang.秒)}
`)
}
target.attr('data-second', leftTime)
setTimeout(countDown, 500, target)
}
else
{
$(".top-marquee").hide();
$("body").addClass("no-marquee")
}
}
})($)
// ==========================================================
// 客服開關
// ==========================================================
$(function(){
let contactBox = $("#contactbox")
$(document).on("click", ".contactbox-toggle", function(e){
contactBox.toggleClass("in-open")
})
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if(entry.isIntersecting){
contactBox.addClass("hide")
}else{
contactBox.removeClass("hide")
}
})
}, {
root: null,
threshold: 0.01
})
observer.observe($("footer")[0])
})
// 螢幕滾動
;(function($) {
let lastScrolltop = 0
$(window).on('scroll', function(e) {
let body = $("body")
let currentScrolltop = $(this).scrollTop()
if(!body.data("locked")){
if(currentScrolltop > 0){
$('.gotop').fadeIn(400)
body.addClass('is-sticky');
}else{
$('.gotop').fadeOut(400)
body.removeClass('is-sticky');
}
if(currentScrolltop > lastScrolltop){
body.removeClass('is-upwards');
}else{
body.addClass('is-upwards');
}
lastScrolltop = currentScrolltop
}else{
//頁內導轉鎖住header不要讓顯示跳動
body.removeClass('is-upwards').addClass('is-sticky');
}
})
})($)
// 主選單
;(function($) {
let navbarStep = ''
checkMenuBanner()
$(window).on('resize', function(e) {
checkMenuBanner()
if($(this).width() >= 1200 && navbarStep !== "desktop") {
navbarStep = "desktop"
$('body').removeClass('menu-open overflow-hidden');
$('body').off('click.menu', '.navbar-toggle,.navbar-wrapper')
$(document).off("click.mainmenu", ".main-item > .main-link .link-anchor")
$('.navbar-main').off('click', '.main-menu .navbar-arrow')
.find('.with-children').removeClass('in-active')
} else if($(this).width() < 1200 && navbarStep !== "mobile") {
navbarStep = "mobile"
$('body').on('click.menu', '.navbar-toggle,.navbar-wrapper', function(e) {
if($(e.target).closest(".navbar-toggle,.navbar-closer").length || $(e.target).hasClass("navbar-wrapper")){
e.preventDefault()
$('body').toggleClass('menu-open overflow-hidden');
$('.aside-panel, .function-item').removeClass('in-active');
}
})
$('.navbar-main').on('click', '.main-menu .navbar-arrow', function(e) {
$(this).closest('.with-children').toggleClass('in-active')
.siblings('.with-children').removeClass('in-active')
})
$(document).on("click.mainmenu", ".main-item.with-children > .main-link .link-anchor", function(e){
e.preventDefault()
$(this).siblings(".navbar-arrow").click()
})
}
})
//選單內banner輪播
function checkMenuBanner(){
$(".navbar-banner-box").each(function(){
let box = $(this)
let carouselFlag = false
if($(window).width() > 1200){
if(box.find(".navbar-banner").length > 2){
carouselFlag = true
}
}else{
if(box.find(".navbar-banner").length > 1){
carouselFlag = true
}
}
if(carouselFlag){
box.owlCarousel({
nav : true,
navText : ['', ''],
dots:false,
responsive: {
0: {
items : 1,
margin: 12
},
1200: {
items : 2,
margin: 20
}
}
})
box.trigger("refresh.owl.carousel")
}else{
box.trigger("destroy.owl.carousel")
}
})
}
})($)
// gotop
;(function($) {
$('.gotop').on('click', function(e){
e.preventDefault()
$("html, body").animate({scrollTop: 0},800);
});
})($)
// 切換國別
;(function($) {
$(document).on("click", ".ship-btn", function(){
let _this = $(this)
$.ajax({
type:"POST",
url:"/ajax/ajax_change_country.php",
dataType:"JSON",
data:{
Type:"update",
ID: _this.data("id")
},
success: function(res){
location.reload()
}
})
})
})($)
// 右上購物車愛心
;(function($) {
$(document).on("click",".favorite-btn",function(){
const _this = $(this)
const SID = _this.attr('sid')
let icon = _this.find(".icon")
let type = 'del'
if(!_this.hasClass('in-favorite')){
type = 'add';
}
$.ajax({
url: Project_Country+'products/ajax/common/ajax_add_wish_list.php',
type:"POST",
cache:false,
async:false,
data:{Type:type,SID:SID},
dataType: 'json',
error:function(d){
alert('網路連線過慢,網頁請重新整理');
},
success:function(d){
if(d.Msg =='OK'){
if(type == 'add'){
try{
if(d.DataLayer){eval(d.DataLayer)}
}catch(e){}
_this.addClass("in-favorite");
icon.removeClass("icon-heart-o").addClass("icon-heart")
}else{
_this.removeClass("in-favorite");
icon.removeClass("icon-heart").addClass("icon-heart-o")
}
}else if(d.Msg == 'NO_MEMBER'){
alert(_jsLang.請先登入會員);
}else{
alert(_jsLang.資料庫忙線中);
}
}
});
});
})($)
//單獨更新購物車紅點
function updateCartTotal(){
$.ajax({
url: Project_Country + "shopcart/ajax/ajax_update_cart_total.php",
type:"POST",
cache:false,
dataType:'json',
}).done(function(res){
if(res.TotalNum){
$(".cart-total").text(res.TotalNum)
}
}).fail(function(d){
alert('網路連線過慢,網頁請重新整理');
})
}
// ==========================================================
// owl carousel 樣式校正
// ==========================================================
;(function($) {
function dotsCheck(jqElement) {
const thisTarget = jqElement
const checkTarget = thisTarget.find('.owl-dots')
if(!checkTarget.hasClass('disabled')) {
thisTarget.addClass('with-dots')
} else {
thisTarget.removeClass('with-dots')
}
}
$('body').on('refreshed.owl.carousel', '.owl-carousel.with-dots', function(e) {
dotsCheck($(this))
})
})($)
// ==========================================================
// footer menu toggle
// ==========================================================
;(function($) {
$(document).on("click", ".footer-menu .menu-title", function(){
$(this).parents(".menu-item").toggleClass("in-open")
})
})($)
// ==========================================================
// 通用跳窗功能
// ==========================================================
;(function($) {
$(document).on("click", ".popup-trigger", function(){
let _this = $(this)
let target = _this.data("target")
$(".popupBox-wrapper[data-index=" + target + "]").removeClass("hide")
})
$('body').on('click', '.popupBox-wrapper:not(.close-disabled)', function(e) {
let _this = $(this)
if(e.currentTarget === e.target || $(e.target).hasClass('closer') || $(e.target).parent().hasClass('closer') || $(e.target).hasClass('js-popupBox-closer')) {
e.preventDefault()
if($(e.target).closest(".popupBox-wrapper").hasClass("popupBox-constant")){
$(e.target).closest(".popupBox-wrapper").addClass("hide")
}else{
PopupCloseAnimate($(e.currentTarget))
}
_this.trigger("popupClose")
}
})
})($)
// ==========================================================
// 再買一次
// ==========================================================
;(function($) {
//再買一次
$(document).on("click",".Order_Again",function(){
const order_num = $(this).data("order");
$.ajax({
url:Project_Country+"member/ajax/ajax_order_again.php",
type:"POST",
data:{order_num:order_num,},
dataType:'json',
error:function(d){
alert('網路連線過慢,網頁請重新整理');
},
success:function(d)
{
if(d.status != 'ok')
{
alert(d.msg);
}
else
{
if(d.dataLayer)eval(d.dataLayer);
window.location.href = d.url;
}
}
});
});
})($)
// ==========================================================
// 置中判斷
// ==========================================================
function checkBlockScroll() {
let block = $('.check-scroll-block')
if(block.length){
if (block[0].scrollWidth > block.innerWidth()) {
block.addClass("theme-overwidth")
} else {
block.removeClass("theme-overwidth")
}
}
}
;(function($) {
$(window).on("resize", function () {
checkBlockScroll()
})
})($)
// ==========================================================
// 檢查點擊元素一次性關閉
// ==========================================================
function checkClickToggle(target, className){
$(document).one("click.checkClickToggle", function(e){
if(!$(e.target).parents(target).length){
$(target).removeClass(className)
}
})
}
// ==========================================================
// 頁首操作
// ==========================================================
;(function($) {
//搜尋展開
$(document).on("click", ".func-search .func-link", function() {
$(".header-search-wrapper").toggleClass("in-open")
$(document).on("click.searchClose", function(e){
if($(e.target).closest(".header-search-wrapper").length <= 0){
$(".header-search-wrapper").removeClass("in-open")
$(document).off("click.searchClose")
}
})
})
//會員展開
$(document).on("click", ".js-member-toggle", function(){
$(".header-member-wrapper").toggleClass("in-open")
if($(".header-member-wrapper").hasClass("in-open")){
$("body").addClass("header-func-open")
}else{
$("body").removeClass("header-func-open")
}
$(document).on("click.memberClose", function(e){
if($(e.target).closest(".header-member-wrapper").length <= 0 || $(e.target).closest(".member-closer").length){
$(".header-member-wrapper").removeClass("in-open")
$("body").removeClass("header-func-open")
$(document).off("click.memberClose")
}
})
})
})($)
// ==========================================================
// 快速購物跳窗
// ==========================================================
;(function($) {
let commonShopcartStep = false
$('body').on('click', '.QuickShop:not(.js-quick-add)', function(e) {
e.preventDefault()
if(!commonShopcartStep) {
commonShopcartStep = true
jQuery.ajax({
url: Project_Country + 'ajax/ajax_popup_shopbox.php',
type: 'POST',
dataType: 'html',
data: {
SID: $(this).attr('SID'),
Serial: $(this).attr('serial'),
Amount: $(this).parent().find('.amountBox').val(),
preview: $(this).data("preview")
},
}).done(function(res){
if(res.indexOf('window.location.href=') == 0)
{
eval(res);
}
else
{
$('body').addClass('overflow-hidden').append(res)
const slideTarget = $('.quickShop-box .preview-slide')
if(slideTarget.length && slideTarget.children('.slide-item').length > 1) {
slideTarget.addClass('with-dots').owlCarousel({
nav: true,
navText: ['', ''],
dots: true,
margin: 10,
items: 1,
})
}
}
checkBlockScroll()
}).fail(function(x, y, z) {
console.log(x)
}).always(function() {
commonShopcartStep = false
})
}
})
$('body').on('click', '.add_need_login:not(.js-quick-add)', function(e) {
AlertPop({
icon: '',
string: _jsLang.請先登入會員 || '請先登入會員',
})
})
$('body').on('click', '.vip_can_not_add:not(.js-quick-add)', function(e) {
AlertPop({
icon: '',
string: _jsLang.您不符合此商品的購買資格 || '您不符合此商品的購買資格',
})
})
})($)
// ==========================================================
// 開關上方商品介紹
// ==========================================================
;(function($) {
$(document).on('click', '.detail-title', function(e) {
let _this = $(this)
let box = _this.parents(".detail-wrap")
box.toggleClass("in-open")
})
})($)
// ==========================================================
// 展開活動
// ==========================================================
;(function($) {
$(document).on('click', '.sale-view-more', function(e) {
let _this = $(this)
let box = _this.parents(".detail-collapse-box").find(".sale-list")
box.toggleClass("in-open")
})
})($)
// ==========================================================
// 跳窗內說明切換
// ==========================================================
;(function($) {
$(document).on('click', '.detail-tag', function(e) {
let _this = $(this)
let target = _this.data("target")
$(".detail-wrapper .detail-tag").removeClass("in-active")
_this.addClass("in-active")
$(".detail-wrapper .detail-content").removeClass("in-active")
$(".detail-wrapper .detail-content[data-index='" + target + "']").addClass("in-active")
})
})($)
// 列表更多資訊開關
;(function($) {
$('main').on('click', '.toggle-expand', function(e) {
e.preventDefault();
let parent = $(this).parents('.table-row')
if(parent.hasClass("in-expand")){
$(".table-row").removeClass('in-expand')
}else{
$(".table-row").removeClass('in-expand')
parent.addClass('in-expand')
parent.prev(".table-row-normal").addClass('in-expand')
parent.next(".table-notebook").addClass('in-expand')
}
})
})($)
// ==========================================================
// 側欄選單開關
// ==========================================================
;(function($) {
/*$('.aside-panel').on('click', 'a', function(e) {
if($(this).parent().hasClass('with-children')) {
e.preventDefault()
$(this).parent('.with-children').toggleClass('in-active')
.siblings('.with-children').removeClass('in-active')
}
})*/
$('.menu-switch').on('click', function(e){
e.preventDefault()
$(this).parents('.with-children').eq(0).toggleClass('in-active')
.siblings('.with-children').removeClass('in-active')
})
$('.aside-panel').on('click', '.collapse-title', function(e) {
e.preventDefault()
$(this).parent('.item').toggleClass('in-active')
.siblings('.item').removeClass('in-active')
})
$(document).on("click", ".mobile-aside-closer", function(){
$(this).parents(".select-dropdown").toggleClass("in-open")
})
$(document).on('click', '.panel-title:not(.theme-link)', function(e){
e.preventDefault()
let panel = $(this).parents(".aside-panel")
panel.find('.panel-body').slideToggle(200, function(){
panel.toggleClass("in-collapse")
})
})
})($)
// ==========================================================
// footer 訂閱電子報功能
// ==========================================================
;(function($) {
if($('#EpaperForm').length) {
$("body").on('submit', '#EpaperForm', function(e){
e.preventDefault()
const enter_str = check_tools.checkEmailNull($("#Epaper_Email"));
if( enter_str == "NULL" ){
alert(_jsLang.請輸入Email);
return false;
}else if( enter_str == "ERROR" ){
alert(_jsLang.您輸入的Email格式錯誤);
return false;
}else if( enter_str == "PASS" ){
$.ajax({
url: Project_Country + 'include/ajax/ajax_epaper-p.php',
type: 'POST',
dataType: 'JSON',
data: {
Epaper_Email: $("#Epaper_Email").val()
},
})
.done(function(res) {
const status = res.status
if(status === "ORDER") {
alert(_jsLang.訂閱電子報成功);
} else if (status === "CANCEL") {
alert(_jsLang.取消訂閱電子報成功);
} else if (status === "Usable") {
alert(_jsLang.訂閱電子報成功抵用券序號已寄送至您的信箱);
} else if(status === "ERROR") {
alert(_jsLang.取消訂閱電子報失敗);
}
})
.fail(function(x, y, z) {
console.log(x);
})
.always(function() {
$("#Epaper_Email").val('');
});
}
});
}
})($)
// ==========================================================
// 購物車簡易浮動跳窗
// ==========================================================
function FloatShopcart(res) {
const returnDOM = `
${res}
`
return returnDOM
}
;(function($) {
const shopcartTarget = $('#Shop_Cart_Total')
let CanShowShopcart = true
function getTopCart(type = '1'){
if(CanShowShopcart) {
CanShowShopcart = false
$.ajax({
url: Project_Country + "ajax/ajax_get_cart.php",
data:{
Cart_Type : type
},
type: 'POST',
dataType: 'HTML',
})
.done(function(res) {
if(shopcartTarget.find(".float-shopcart").length > 0){
shopcartTarget.find(".float-shopcart").empty().html(res)
}else{
shopcartTarget.append(FloatShopcart(res))
}
checkClickToggle(".float-shopcart", "in-open")
})
.fail(function(x, y, z) {
console.log(x);
})
.always(function() {
CanShowShopcart = true
});
}
}
let enterFlag = false
$(document).on('click', ".shopcart-item.func-link, .fixed-menu-shopcart", function(e) {
getTopCart()
$(".float-shopcart").addClass("in-open")
$("body").addClass("header-func-open")
})
// .on('mouseleave', function(e) {
// shopcartTarget.children('.float-shopcart').remove()
// enterFlag = false
// })
$(document).on("click", ".float-shopcart .switch-btn", function(){
getTopCart($(this).data("type"))
})
$(document).on("click", ".float-shopcart .cart-closer", function(){
$(".float-shopcart").removeClass("in-open")
$("body").removeClass("header-func-open")
})
//右上購物加減
$(document).on('click', '.floatcart-amount-btn', function(e) {
let _this = $(this)
let amountBox = _this.parents(".floatcart-amount-box")
let input = amountBox.find(".floatcart-amount-input")
let plus = amountBox.find(".floatcart-amount-plus")
let minus = amountBox.find(".floatcart-amount-minus")
let max = parseInt(input.attr("max"))
let min = parseInt(input.attr("min"))
let val = parseInt(input.val())
if(_this.hasClass("floatcart-amount-plus")){
if(val < max){
input.val(val + 1)
input.trigger("change")
}else{
let msg = (_jsLang['最多可購買數量'] ??'最多可購買數量') + max;
if(input.data("one-page-msg"))
{
msg = input.data("one-page-msg");
}
alert(msg)
}
}else{
if(val > min){
input.val(val - 1)
input.trigger("change")
}
}
if(parseInt(input.val()) == max){
plus.addClass("in-disabled")
}else{
plus.removeClass("in-disabled")
}
})
//右上購物數量
$(document).on("change", ".floatcart-amount-input", function(e){
let input = $(this)
let amountBox = input.parents(".floatcart-amount-box")
let plus = amountBox.find(".floatcart-amount-plus")
let minus = amountBox.find(".floatcart-amount-minus")
let max = parseInt(input.attr("max"))
let min = parseInt(input.attr("min"))
let val = parseInt(input.val())
if(!val && val !== 0){
input.val(min)
}
if(val > max){
let msg = (_jsLang['最多可購買數量'] ??'最多可購買數量') + max;
if(input.data("one-page-msg"))
{
msg = input.data("one-page-msg");
}
input.val(max)
alert(msg);
}
if(val < min){
input.val(min)
}
if(parseInt(input.val()) == max){
plus.addClass("in-disabled")
}else{
plus.removeClass("in-disabled")
}
updateCartAmount(amountBox)
})
//右上購物數量變化
function updateCartAmount(amountBox){
amountBox.find(".floatcart-amount-input,.floatcart-amount-btn").addClass("in-forzen")
let amountInput = amountBox.find(".floatcart-amount-input")
$.ajax({
url: Project_Country + "shopcart/ajax/ajax_update_num.php",
type:"POST",
cache:false,
dataType:'json',
data:$.extend({}, amountInput.data(), {
value: amountInput.val()
})
}).done(function(d){
if(d.Status && d.Status.includes('RET_SUCCESS')){
amountInput.data("before-change", amountInput.val())
if(d.TotalNum >=0){
$(".cart-total").text(d.TotalNum)
}
if(d.Alert){
alert(d.Alert);
}
if(d.DataLayer)eval(d.DataLayer);
getTopCart()
}else{
if(amountInput.data("before-change")){
if(d.Status != 'RET_SUCCESS_OVER_ACT9'){
amountInput.val(amountInput.data("before-change"))
}
}else{
amountInput.val(0)
}
if(d.Alert){
alert(d.Alert);
}else{
alert("發生錯誤");
}
}
}).fail(function(d){
if(amountInput.data("before-change")){
amountInput.val(amountInput.data("before-change"))
}else{
amountInput.val(0)
}
alert('網路連線過慢,網頁請重新整理');
})
}
// 浮動窗中商品刪除
$('body').on('click', '.Left_Top_Del', function(e) {
e.preventDefault()
// if(confirm(_jsLang.確定刪除嗎+"?")){
$.ajax({
url: Project_Country + "shopcart/ajax/ajax_cart_del.php",
type:"POST",
cache:false,
dataType:'json',
data:{ID:$(this).attr("sid"),Type:$(this).data("type"),GroupID: $(this).data("group_id")},
}).done(function(d){
if(d.Status == 'RET_SUCCESS'){
// alert(_jsLang.刪除成功);
//window.location.reload();
if (d.DataLayer) { eval(d.DataLayer) }
getTopCart()
updateCartTotal()
}else{
alert(_jsLang.資料庫忙線中);
}
}).fail(function(d){
alert('網路連線過慢,網頁請重新整理');
})
// }
})
})($)
function FloatCartPopup(dataObj) {
const shopcartTarget = $('#Shop_Cart_Total')
$.ajax({
url : Project_Country + "ajax/ajax_get_cart.php",
type : "POST",
async : true,
cache : false,
data : dataObj,
}).done(function(res) {
shopcartTarget.append(FloatShopcart(res))
// setTimeout(function(){
// shopcartTarget.children('.float-shopcart').removeClass("in-open")
// },3000);
}).fail(function(x, y, z) {
console.log(x)
})
}
//===========================================================
// 直接加入購物車
//===========================================================
function addToCart(sid, amount = 1) {
$.ajax({
url: Project_Country + "shopcart/ajax/ajax_cart_add.php",
type: "POST",
cache: false,
data: { "ID": sid, "Amount": amount },
dataType: 'json',
error: function (d) {
alert('網路連線過慢,網頁請重新整理');
},
success: function (d) {
switch (d.Status) {
case "RET_SUCCESS":
if (d.DataLayer) { eval(d.DataLayer) }
alert(_jsLang.加入購物車成功);
updateCartTotal();
break;
case "RET_NO_MEMBER_NO":
alert(_jsLang.欲購買紅利兌換商品請先登入會員並完成會員認證);
break;
case "RET_RBONUS_OUT":
alert(_jsLang.紅利不足);
break;
case "RET_ERROR":
alert(_jsLang.資料庫忙線中);
break;
case "RET_PROD_ERROR":
alert(_jsLang.商品已下架);
break;
case "RET_NO_PROD":
alert(_jsLang.請選擇商品);
break;
case "RET_STOCK_ERROR":
alert(_jsLang.商品庫存不足);
break;
case "RET_LIMIT_ERROR":
alert(_jsLang.數量超過限購量)
break;
case "RET_OVER_SIT_MAX":
alert(_jsLang.數量超過定期購限購量);
break;
case "RET_PROD_IN_ONESHOPPAGE_ERROR":
alert(_jsLang.此商品於一頁式購物推廣中 + ',' + _jsLang.暫無法加入購物車);
break;
case "GAME_PLAYED":
alert(_jsLang.購物車內有遊戲未結商品無法修改購物車);
break;
default:
alert(_jsLang.資料庫忙線中);
break;
};
}
});
}
;(function($) {
//直加按鈕
$(document).on("click", ".js-quick-add", function(){
let _this = $(this)
let sid = _this.attr("sid")
if(sid){
addToCart(sid, amount = 1)
}
})
})($)
// ==========================================================
// 影片預設圖 to iframe 撥放器
// ==========================================================
;(function($) {
$(document).on('click', '.StaticVideo', function(e) {
e.preventDefault()
const targetVID = $(this).attr('data-vid')
let iframe = $('