File: /www/wwwroot//www.xxlht.com/sh/033/aa_files/other.js
/*
=====================================================
檔案名稱:CO-Medical様js共通ファイル
檔案用途:カスタマイズのjs、タグなどは既にここに書いてある
檔案建立日:2018.06.13
檔案建立人:Sam.Chang
**ps.增加或修改請一定要備註寫清楚做何用途,感謝**
=====================================================
*/
jQuery(function ($) {
var time = new Date().getTime();
var API_script_LINK = 'https://www.cros.tw/lp/development/LP_API/API.js?time' + time;
var API_script_TAG = $('<script>').prop('src', API_script_LINK);
$('head').append(API_script_TAG);
});
// 2020 01 07 移出 window.addEnventListener("load")
// 依據lock.json將商品上鎖
DisableSize();
window.addEventListener("load", function () {
var pathArray = location.pathname.split('/');
if (pathArray[1] == "RBLP05_set" && pathArray[2] == "0501" ||
pathArray[1] == "RBLP08CP_set" || pathArray[1] == "RBLP08CP_set_test") {
// addPairErrorMsg();
addPairErrorMsg2();
}
if (pathArray[1] == "RBLP07_test" || pathArray[1] == "RBLP08BAG" || pathArray[1] == "RBLP08setBAG" || pathArray[1] == "RBLP08N" || pathArray[1] == "RBLP07N"
|| pathArray[1] == "MD2020" ) {
// addPairErrorMsg();
addQuestionnaire();
orderDisable();
window.addEventListener("click", function () {
orderDisable();
});
}
if (pathArray[1] == "SN2020_test" || pathArray[1] == "SN2020" || pathArray[1] == "RBLP07" || pathArray[1] == "RBLP08") {
addQuestionnaire2();
orderDisable();
window.addEventListener("click", function () {
orderDisable();
});
}
if(pathArray[1] == "RBLP09set" || pathArray[1] == "RBLP09set_test"){
addPairErrorMsg2();
addQuestionnaire();
orderDisable2();
window.addEventListener("click", function () {
orderDisable2();
});
}
if(pathArray[1] == "CA2001" || pathArray[1] == "CA2002"){
addPairErrorMsg2();
orderDisable2();
window.addEventListener("click", function () {
orderDisable2();
});
}
addPersonalPolicy();
// addNewYearMemo();
hidePantiesAndBra_21323();
if( pathArray[1] == "CA2001" || pathArray[1] == "CA2002") {
addSetMemo();
}
});
DisappearPanties();
/* ----------------------------------------------- 共通ポリシーテキスト ----------------------------------------------- */
var policyText =
"【注意事項】\n\
依照消保法規範,本產品屬個人衛生用品,商品拆封後無7天猶豫期,\n\
因此僅受理全新狀態之退貨,敬請見諒。\n\
【商品退換貨說明】\n\
① 未開封開品提供7天的鑑賞期。\n\
在7天內若要辦理退換貨,請務必致電通知客服中心。※請注意!鑑賞期並非試用期。若欲進行退貨,商品必須為未開封狀態。\n\
\n\
② 退貨時,請您將商品連同出貨明細表、發票寄回。\n\
退貨時,商品必須保持商品本體,商品內外包裝、贈品等,必須為您收到商品時尚未損壞的狀態,收到商品後,會立即為您辦理。\n\
\n\
※ 指回復至您收到商品時的原始狀態。\n\
③ 請您以送貨使用之原包裝紙箱將退貨商品包裝妥當寄回。\n\
但若原紙箱已遺失,可另使用其他紙箱包覆商品,切勿直接於商品上黏貼紙張或書寫文字。\n\
\n\
④ 若欲退貨的商品,是參加活動而組套出售的促銷商品,不可單品退貨,需將套組商品一起退回。\n\
⑤ 如客戶訂購後若大量退換貨,由於已造成作業上之困擾,可能會視情況對該客戶採取拒絕交易辦理。\n\
⑥ 目前辦理換貨僅能針對同一項商品更換,無法將商品A換為商品B。\n\
請留意,鑑賞期非試用期,若您收到商品經檢視後有任何不合意之處,請勿拆開使用,並立即依照退貨規定辦理退貨。";
var personalpolicyText =
"•對於購買所需填寫的個人資料,本公司將遵守個人資料保護相關法令規定,完成購買即表示同意本公司依個人資料保護相關法令處理、利用你的個人資料。\n\
•為了完成交易,包括且不限於完成付款及交付等,你必須擔保在訂購過程中所留存的所有資料均為完整、正確、與當時情況相符的資料,如果事後有變更,你應該即時通知本公司客服人員。\n\
•對於你所留存的資料,本公司除了採用安全交易模式外,並承諾負擔保密義務,除了為完成交易、提供顧客服務或在符合相關法令之規範下而提供給相關商品或服務之配合廠商以外,不會任意洩漏或提供給第三人。\n\
•為了完成交易與提供服務(包含商品、發票或贈品之運送以及服務滿意度調查),本公司需將你的個人資訊提供給運送服務廠商及服務滿意度調查廠商,並由廠商與你聯繫安排商品之運送與服務滿意度調查;你的個人資訊包含姓名、地址、電話等,也可能因運送之需求而需要揭露於商品之外包裝上。";
/* ----------------------------------------------- 共通ポリシーテキスト ----------------------------------------------- */
function addPolicy() {
if (document.getElementById("policy") == null) {
setTimeout(addPolicy, 1000);
return;
}
policyTitle = document.getElementById("policyTitle");
policyTitle.innerText = "▼己詳閱並同意以下事項、確認訂購▼";
policyContact = document.getElementById("policyText");
policyContact.innerHTML = policyText;
policyContact.style.display = "";
}
function addNewYearMemo() {
if (!(document.querySelector('#tr_timeId > .rightContents') && document.querySelector('#tr_receivingMethod > .rightContents'))) {
return void setTimeout(addNewYearMemo, 500);
}
const receiveNewYearMemo = document.createElement('div');
// set style
receiveNewYearMemo.style.color = 'red';
// set content
receiveNewYearMemo.textContent = '過年期間超商無法指定配送日期,敬請見諒!';
const timeNewYearMemo = receiveNewYearMemo.cloneNode(true);
document.querySelector('#tr_receivingMethod > .rightContents').append(receiveNewYearMemo);
document.querySelector('#tr_timeId > .rightContents').append(timeNewYearMemo);
}
/**
* 新增個人資訊相關事項#7894
*/
function addPersonalPolicy() {
if (document.getElementById("policy") == null) {
setTimeout(addPersonalPolicy, 1000);
return;
}
policyTitle = document.getElementById("policyTitle");
policyTitle.innerText = "※個人資料暨隱私權保護政策聲明※";
policyContact = document.getElementById("policyText");
policyContact.innerHTML = personalpolicyText;
policyContact.style.display = "";
}
function addQuestionnaire() {
if (document.getElementById("tr_note") == null) {
setTimeout(addQuestionnaire, 1000);
return;
}
var node = document.getElementById("tr_note");
var ele = document.createElement("div");
ele.className = "orderItem";
ele.id = "tr_questionnaire";
ele.style.display = "block";
let eleInnerhtml =
'<div class="leftContents"><label id="langQuestionnaireTitle" class="titlefont">您在哪裡認識夜間3D美胸內衣?<span class="redIcon">必填</span></label></div>\n\
<div class="rightContents">\n\
<div id="tr_questionnaireNetworkad" class="orderItem" style="display: block;">\n\
<input type="radio" name="questionType" id="type_TVperson_wei" value="f_t1wei"><label for="type_TVperson_wei" class="checkStyle">電視廣告(李維維代言)</label>\n\
</div>\n\
<div id="tr_questionnaireNetworkad" class="orderItem" style="display: block;">\n\
<input type="radio" name="questionType" id="type_TVperson" value="f_t2"><label for="type_TVperson" class="checkStyle">電視節目藝人推薦</label>\n\
</div>\n\
<div id="tr_questionnaireNetworkad" class="orderItem" style="display: block;">\n\
<input type="radio" name="questionType" id="type_Networkad" value="f_w"><label for="type_Networkad" class="checkStyle">網路廣告</label>\n\
</div>\n\
<div id="tr_questionnaireSNS" class="orderItem" style="display: block;">\n\
<input type="radio" name="questionType" id="type_SNS" value="f_sns"><label for="type_SNS" class="checkStyle">部落客、社群</label>\n\
</div>\n\
<div id="tr_questionnaireElse" class="orderItem" style="display: block;">\n\
<input type="radio" name="questionType" id="type_Else" value="f_x"><label for="type_Else" class="checkStyle">其他</label>\n\
</div>\n\
<div class="error_msg"><p><span id="err_question">請完成所有「必填」項目後進行結帳<br></span></p></div>\n\
</div>';
ele.innerHTML = eleInnerhtml.replace("", '') // 移除討人厭的錯誤​
node.parentNode.insertBefore(ele, node.nextSibling);
lp_param_ga3 = document.getElementById("lp_param_ga3").value;
// document.getElementById("submitBtn").onclick = changeParameter;
}
function addQuestionnaire2() {
if (document.getElementById("tr_note") == null) {
setTimeout(addQuestionnaire2, 1000);
return;
}
var node = document.getElementById("tr_note");
var ele = document.createElement("div");
ele.className = "orderItem";
ele.id = "tr_questionnaire";
ele.style.display = "block";
let eleInnerhtml =
'<div class="leftContents"><label id="langQuestionnaireTitle" class="titlefont">您在哪裡認識夜間3D美胸內衣?<span class="redIcon">必填</span></label></div>\n\
<div class="rightContents">\n\
<div id="tr_questionnaireNetworkad" class="orderItem" style="display: block;">\n\
<input type="radio" name="questionType" id="type_TVad_LWW" value="f_t1wei"><label for="type_TVad_LWW" class="checkStyle">電視廣告(李維維代言)</label>\n\
</div>\n\
<div id="tr_questionnaireNetworkad" class="orderItem" style="display: block;">\n\
<input type="radio" name="questionType" id="type_TVperson" value="f_t2"><label for="type_TVperson" class="checkStyle">電視節目藝人推薦</label>\n\
</div>\n\
<div id="tr_questionnaireNetworkad" class="orderItem" style="display: block;">\n\
<input type="radio" name="questionType" id="type_T3dwei" value="f_t3dwei"><label for="type_T3dwei" class="checkStyle">偶像劇美味滿閣介紹</label>\n\
</div>\n\
<div id="tr_questionnaireNetworkad" class="orderItem" style="display: block;">\n\
<input type="radio" name="questionType" id="type_Networkad" value="f_w"><label for="type_Networkad" class="checkStyle">網路廣告</label>\n\
</div>\n\
<div id="tr_questionnaireSNS" class="orderItem" style="display: block;">\n\
<input type="radio" name="questionType" id="type_SNS" value="f_sns"><label for="type_SNS" class="checkStyle">部落客、社群</label>\n\
</div>\n\
<div id="tr_questionnaireElse" class="orderItem" style="display: block;">\n\
<input type="radio" name="questionType" id="type_Else" value="f_x"><label for="type_Else" class="checkStyle">其他</label>\n\
</div>\n\
<div class="error_msg"><p><span id="err_question">請完成所有「必填」項目後進行結帳<br></span></p></div>\n\
</div>';
ele.innerHTML = eleInnerhtml.replace("", '') // 移除討人厭的錯誤​
node.parentNode.insertBefore(ele, node.nextSibling);
lp_param_ga3 = document.getElementById("lp_param_ga3").value;
// document.getElementById("submitBtn").onclick = changeParameter;
}
function orderDisable() {
jQuery(function ($) {
if (document.getElementById("err_question") == null) {
setTimeout(orderDisable, 1000);
return;
}
var error = document.getElementById("err_question");
var text = document.getElementById("langSubmitBtnText");
if ($("input:radio[name='questionType']:checked").val()) {
error.style.display = "none";
text.style.pointerEvents = "auto";
text.style.backgroundColor = "";
document.getElementById("lp_param_ga3").value =
lp_param_ga3 +
"_" +
$("input:radio[name='questionType']:checked").val();
} else {
error.style.display = "block";
text.style.pointerEvents = "none";
text.style.backgroundColor = "#f79cb6";
}
});
}
function orderDisable2() {
jQuery(function ($) {
if (document.getElementById("err_question") == null) {
setTimeout(orderDisable, 1000);
return;
}
var error = document.getElementById("err_question");
var text = document.getElementById("langSubmitBtnText");
if ($("input:radio[name='questionType']:checked").val() && document.getElementById('pairJudge').value == '1') {
error.style.display = "none";
text.style.pointerEvents = "auto";
text.style.backgroundColor = "";
document.getElementById("lp_param_ga3").value =
lp_param_ga3 +
"_" +
$("input:radio[name='questionType']:checked").val();
} else {
error.style.display = "block";
text.style.pointerEvents = "none";
text.style.backgroundColor = "#f79cb6";
if(document.getElementById('pairJudge')){
if(document.getElementById('pairJudge').value == '0' && $("input:radio[name='questionType']:checked").val()){
error.style.display = "none";
}
}
}
});
}
function addPairErrorMsg() {
if (document.getElementById('productSelection_A') == null || document.getElementById('productSelection_B') == null) {
setTimeout(addPairErrorMsg, 1000);
return;
}
$ = jQuery;
function valid() {
var A_total = 0;
//抓productSelection_A 區塊的所有select值增加到A_total
$('#productSelection_A select').each(function (i, item) {
A_total += Number($(item).val());
});
var B_total = 0;
//抓productSelection_B 區塊的所有select值增加到B_total
$('#productSelection_B select').each(function (i, item) {
B_total += Number($(item).val());
});
//當沒有配對時 按鈕變色不能按 並新增一段提示消費者的文字
if (A_total != B_total) {
$('#langSubmitBtnText').css({
'pointer-events': 'none',
'background-color': 'rgb(247, 156, 182)'
});
$('#pairError').text('內衣褲必須配對');
} else {
$('#langSubmitBtnText').removeAttr('style');
// $('#pairError').text('');
}
}
//產生錯誤訊息element
// var pairErrorMsg = $('<div>', {
// 'class': 'error_msg'
// }).append('<p id="pairError"></p>');
// pairErrorMsg.insertBefore('#submitBtn');
//當數量改變時觸發valid function去計算是否配對數量
$('#productSelection_A, #productSelection_B').find(':input').change(valid);
$('#productSelection_A, #productSelection_B').find('.quantity-change').click(valid);
$('#resetSelectedProductBtn').click(valid);
}
//因為內衣內褲沒有分兩塊來放
function addPairErrorMsg2() {
if (document.getElementById('productSelection_A') == null) {
setTimeout(addPairErrorMsg2, 1000);
return;
}
$ = jQuery;
function valid() {
var A_total = 0; //內衣數量
var B_total = 0; //內褲數量
//把.row增加索引屬性 奇數內衣 偶數內褲
$('#productSelection_A .row').each(function (index) {
$(this).attr('valid', index += 1);
});
$('#productSelection_A select').each(function (index) {
if ($(this).parents('.row').attr('valid') % 2 == 1) {
A_total += Number($(this).val())
} else {
B_total += Number($(this).val())
}
});
//當沒有配對時 按鈕變色不能按 並新增一段提示消費者的文字
if (A_total != B_total) {
$('#langSubmitBtnText').css({
'pointer-events': 'none',
'background-color': 'rgb(247, 156, 182)'
});
$('#pairError').text('內衣褲必須配對');
if(document.getElementById('pairJudge')){
document.getElementById('pairJudge').value = '0';
}
} else {
$('#langSubmitBtnText').removeAttr('style');
if(document.getElementById('pairJudge')){
document.getElementById('pairJudge').value = '1';
}
// $('#pairError').text('');
}
setTimeout(changePrdShortName, 800);
}
// 遇到有問卷的LP 判斷用element
var judge = $('<input>',{
'value': '1',
'id': 'pairJudge'
});
judge.css({
'display': 'none',
'pointer-events': 'none'
});
judge.insertBefore('#submitBtn');
//產生錯誤訊息element
// var pairErrorMsg = $('<div>', {
// 'class': 'error_msg'
// }).append('<p id="pairError"></p>');
// pairErrorMsg.insertBefore('#submitBtn');
//當數量改變時觸發valid function去計算是否配對數量
$('#productSelection_A').find(':input').change(valid);
$('#productSelection_A').find('.quantity-change').click(valid);
$('#resetSelectedProductBtn').click(valid);
}
function changePrdShortName() {
var whiteSpace = ' ';
var prdList = $('input#products').val();
if (prdList === "") {
return;
}
var elementIndex = [];
prdList = JSON.parse(prdList);
var prdLength = prdList.length;
for (let i = 0; i < prdLength; i++) {
elementIndex.push(i * 4);
}
for (let x = 0; x < prdLength; x++) {
if (prdList[x].product_code.charAt(1) === 'B') {
$('#selectedProductInfo span').eq(elementIndex[x]).text('內衣');
$('#tr_selected_productInfo_list li').eq(x).html(`內衣${whiteSpace}
${prdList[x].category_name_1}${whiteSpace}
${prdList[x].category_name_2}${whiteSpace}
${prdList[x].quantity}件`);
} else {
$('#selectedProductInfo span').eq(elementIndex[x]).text('內褲');
$('#tr_selected_productInfo_list li').eq(x).html(`內褲${whiteSpace}
${prdList[x].category_name_1}${whiteSpace}
${prdList[x].category_name_2}${whiteSpace}
${prdList[x].quantity}件`);
}
}
}
// setLocation with Query String (GoogleAnalytics Parameter and so on)
function setLocationWithQS(path, hash) {
var url = path;
var parameter = window.location.href.split("?")[1];
if (typeof parameter != "undefined" && parameter.length > 0) {
url += '?' + parameter.split("#")[0];
}
if (typeof hash != "undefined" && hash.length > 0) {
url += hash;
}
location.href = url;
}
// 須以套組購入的提醒文字
function addSetMemo() {
if (document.getElementById('productSelection_A') == null) {
setTimeout(addSetMemo, 1000)
return;
}
// let node = document.createElement('div');
// node.setAttribute('style', 'color: red; text-align: center;')
// node.innerHTML= '【此活動網頁須以套組購入(內衣+內褲)】';
// $('#tr_productCode .rightContents').prepend(node);
$("<div style='color: red; text-align: center;'>【此活動網頁須以套組購入(內衣+內褲)】</div>").insertBefore($('#productSelection_A'));
}
function DisableSize() {
if (document.getElementById("productSelection_A") == null) {
setTimeout(DisableSize, 1000);
return;
}
let allLockData = GetJsonData();
var pathArray = location.pathname.split('/');
while (pathArray.includes("")) {
pathArray.splice(pathArray.indexOf(""), 1)
}
for (let urlIndex = 0; urlIndex < Object.keys(allLockData).length; urlIndex++) { // 判斷JSON中有多少URL需要設定,並跑迴圈個別調整。
if (pathArray.includes(Object.keys(allLockData)[urlIndex])) { // 判斷使用者所在的頁面是否需要設定
let allLockProductInURL = allLockData[Object.keys(allLockData)[urlIndex]];
for (let productIndex = 0; productIndex < Object.keys(allLockProductInURL).length; productIndex++) {
// 將該URL內的每個商品ID上鎖。
if (jQuery('#' + Object.keys(allLockProductInURL)[productIndex]).length > 0) {
jQuery('#' + Object.keys(allLockProductInURL)[productIndex]).parent().find(':input').attr('disabled', true);
jQuery('#' + Object.keys(allLockProductInURL)[productIndex]).empty().append('<option value="0">' +
allLockProductInURL[Object.keys(allLockProductInURL)[productIndex]].text + '<option>');
} else {
console.error ('not found ' + Object.keys(allLockProductInURL)[productIndex]);
}
}
}
}
}
function GetJsonData() {
let result;
let rawFile = new XMLHttpRequest();
let version = Date.now() * 1000 + Math.floor(Math.random() * 1000);
rawFile.open("GET", 'https://www.co-medical.tw/CommonFiles/js/lock.json?ver=' + version, false);
rawFile.onreadystatechange = function () {
if (rawFile.readyState === 4) {
if (rawFile.status === 200 || rawFile.status == 0) {
let allText = rawFile.responseText;
result = JSON.parse(allText);
}
}
}
rawFile.send(null);
return result.LockedProduct;
}
// 電子發票條碼驗證區塊
(function () {
// 判斷電子載具的建構式 function
function JudgeElectronicInvoice() {
// 作為私有屬性, 不可外部存取修改, 用來判斷電子載具是否正確的條件
this._term = false;
this._browser = '';
}
/**
* 增加該建構式的方法, 使用prototype存取
* 單純的建構式新增方法或是用閉包也可以
* 使用prototype的話可以比較不消耗資源並且也好管理各個實例化的方法
*/
JudgeElectronicInvoice.prototype = {
/**
* 因使用直接覆蓋prototype的方式新增共用方法
* 所以原本的constructor來源會不見, 為了能夠辨識出建構來源因此設置該constructor屬性
*/
constructor: JudgeElectronicInvoice,
// 初始化綁定事件
init: function () {
/**
* 因整個建構式包在IIFE裡, 所以執行setTimeout非同步操作會導致目前建構式的scope遺失變成全域(window)
* return IIFE時把目前的scope(this)作引數傳入匿名function內當參數(scope)
* 內部執行setTimeout時因為要綁定剛剛傳入的scope, 所以使用匿名function作為callback
*/
if (!(document.getElementById('carrierPhone') && document.getElementById('submitBtn'))) {
return void(function (scope) {
setTimeout(function () {
this.init();
}.bind(scope), 500);
})(this);
}
/**
* 用bind綁定目前實例化的scope以免在事件中callback呼叫時scope被HTML element取代掉
* addEventListener第三個參數是設定事件要在哪個階段被觸發, 預設為false(冒泡階段), 在這邊設定true(捕獲階段)來提早攔截
* 所以將click事件綁定在submitBtn元素上, 以便在送出訂單的事件之前先被"捕獲"並觸發
*/
this.blurHandler = this.blurHandler.bind(this);
this.submitHandler = this.submitHandler.bind(this);
document.getElementById('carrierPhone').addEventListener('blur', this.blurHandler);
document.getElementById('submitBtn').addEventListener('click', this.submitHandler, true);
// 判斷瀏覽器種類使用對應支援的方法
this._browser = (function () {
var test = function (regexp) {
return regexp.test(window.navigator.userAgent);
}
switch (true) {
case test(/edge/i):
return "edge";
case test(/opr/i) && (!!window.opr || !!window.opera):
return "opera";
case test(/chrome/i) && !!window.chrome:
return "chrome";
case test(/trident/i):
return "ie";
case test(/firefox/i):
return "firefox";
case test(/safari/i):
return "safari";
default:
return "other";
}
})();
},
// 電子載具輸入欄位blur時觸發的event hanlder
blurHandler: function (e) {
if (window.XMLHttpRequest) {
// 保留目前實例化的scope
const SELF = this;
const HTTP_REQUEST = new XMLHttpRequest();
const REQUEST_URL = 'https://einvoice-proxy.acs-tpkg.com/BIZAPIVAN/biz';
var carrierPhone = encodeURIComponent(document.getElementById('carrierPhone').value);
var params = 'version=1.0&\
action=bcv&\
barCode=' + carrierPhone + '&\
TxID=' + new Date().getTime() + '&\
appId=EINV1201904277061';
// ES6模板字符串IE不支援
// 為了方便閱讀將params字串分行串接, 但字串會有空白因此用replace過濾掉空白字元
params = params.replace(/\s+/g, '');
HTTP_REQUEST.open('POST', REQUEST_URL, false);
HTTP_REQUEST.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
HTTP_REQUEST.onreadystatechange = function () {
if (HTTP_REQUEST.readyState === 4 && HTTP_REQUEST.status === 200) {
var data = JSON.parse(HTTP_REQUEST.responseText);
// 判斷載具是否正確
if (data.isExist === 'Y') SELF._term = true
else {
document.getElementById('carrierPhone').classList.add('error_field');
document.getElementById('err_carrierType').innerHTML = '請務必輸入正確: 手機條碼';
console.log('驗證失敗(手機條碼輸入錯誤)!');
SELF._term = false;
}
} else {
console.error('請求失敗!');
}
};
try {
HTTP_REQUEST.send(params);
} catch(error) {
console.error(error);
document.getElementById('carrierPhone').removeEventListener('blur', this.blurHandler);
document.getElementById('submitBtn').removeEventListener('click', this.submitHandler, true);
console.error('電子發票認證功能已關閉!');
}
}
},
// 送出按鈕被點擊時執行的event handler
submitHandler: function (e) {
e.preventDefault();
// 用event本身的屬性target來判斷實際上點了哪個元素, 確認目標來避免元素包元素時的大小差別被誤點擊
if (e.target.id === 'langSubmitBtnText') {
var radioChecked = document.getElementById("type_Phone").checked || false;
// 如果勾選電子載具並且載具錯誤則擋下來跳錯, 反之通過並讓當前事件捕獲及冒泡的傳遞進行下去
if ((!this._term) && radioChecked) {
// 使用事件本身的方法 stopPropagation 讓當前事件的捕獲及冒泡的傳遞停止下來
e.stopPropagation();
var scrollTarget = document.getElementById('tr_carrierType');
document.getElementById('carrierPhone').classList.add('error_field');
document.getElementById('err_carrierType').innerHTML = '請務必輸入正確: 手機條碼';
// 根據不同的瀏覽器使用相對應支援的方法
if (this._browser === 'ie' || this._browser === 'edge') {
scrollTarget.scrollIntoView({ behavior: 'smooth' });
} else {
window.scrollTo({
top: scrollTarget.offsetTop,
behavior: 'smooth'
});
}
}
} else {
return;
}
}
};
// 實例化建構式, 並執行init方法初始化
var electronicInvoice = new JudgeElectronicInvoice();
electronicInvoice.init();
})();
function hidePantiesAndBra_21323() {
const path = getPathName();
const hideBraList = ['A_CB_S', 'A_CB_SM', 'A_CB_ML', 'A_CB_LL', 'A_TG_S', 'A_TG_SM', 'A_TG_ML', 'A_TG_LL'];
if (!document.getElementById('productSelection_A')) return void setTimeout(hidePantiesAndBra_21323, 500);
if (path === 'RBLP08BAG') {
hideBraList.forEach(function (item) {
document.getElementById(item).parentElement.style.display = 'none';
});
} else if (path === 'RBLP08setBAG') {
DisappearPanties();
} else {
return;
}
}
function getPathName() {
const pathArray = location.pathname.split('/').filter(Boolean);
return pathArray.slice(-1) === 'index.html' ?
pathArray[pathArray.length - 2] :
pathArray[pathArray.length - 1];
}
function DisappearPanties() {
if (document.getElementById('productSelection_A') == null) {
setTimeout(DisappearPanties, 1000);
return;
}
if (location.pathname.includes('/RBLP08CP_set/') ||
location.pathname.includes('/RBLP08CP_set_test/') ||
location.pathname.includes('/RBLP08setBAG/') ||
location.pathname.includes('/BD2001/') ||
location.pathname.includes('/RBLP09set/') ||
location.pathname.includes('/RBLP09set_test/') ||
location.pathname.includes('/BD2005/') ||
location.pathname.includes('/BD2007/')
) {
//=====隱藏內褲的尺寸
//所有顏色的內褲
var hidePantiesList1 = ['BK_2', 'RD_2', 'MT_2', 'BL_2', 'WT_2', 'AQ_2', 'MC_2', 'WN_2', 'LV_2'];
//所有尺寸的內褲
var hidePantiesList2 = ['SS','S','SM','M','ML','L','LL'];
hidePantiesList1.forEach(function(list1) {
hidePantiesList2.forEach(function(list2) {
document.getElementById('A_' + list1 + '_' + list2).parentElement.style.display = 'none';
})
})
//=====隱藏內衣的尺寸
//所有顏色的內衣
var hideBraList1 = ['BK', 'RD', 'MT', 'BL', 'WT', 'AQ', 'MC', 'WN', 'LV'];
//所有尺寸的內衣
var hideBraList2 = ['S_2','M_2','L_2','LL_2'];
hideBraList1.forEach(function(list1) {
hideBraList2.forEach(function(list2) {
document.getElementById('A_' + list1 + '_' + list2).parentElement.style.display = 'none';
})
})
}
if( location.pathname.includes('/RBLP09set/') ||
location.pathname.includes('/RBLP09set_test/')){
//=====隱藏新顏色內褲
//所有新顏色的內褲
var hidePantiesList1 = ['CR_2', 'CP_2', 'CG_2', 'CD_2', 'CB_2', 'TG_2'];
//所有尺寸的內褲
var hidePantiesList2 = ['SS', 'S', 'SM', 'M', 'ML', 'L', 'LL'];
hidePantiesList1.forEach(function(list1) {
hidePantiesList2.forEach(function(list2) {
document.getElementById('A_' + list1 + '_' + list2).parentElement.style.display = 'none';
})
})
//=====隱藏新顏色內衣的尺寸
//新顏色的內衣
var hideBraList1 = ['CR', 'CP', 'CG', 'CD', 'CB', 'TG'];
//所有尺寸的內衣
var hideBraList2 = ['S_2','M_2','L_2','LL_2'];
hideBraList1.forEach(function(list1) {
hideBraList2.forEach(function(list2) {
document.getElementById('A_' + list1 + '_' + list2).parentElement.style.display = 'none';
})
})
}
/* if (location.pathname.includes('/RBLP09AT/')) {
//=====隱藏內褲的尺寸
//所有顏色的內褲
var hidePantiesList1 = ['CR_2','TG_2','CP_2','CG_2','CD_2','CB_2','BK_2', 'RD_2', 'MT_2', 'BL_2', 'WT_2', 'AQ_2', 'MC_2', 'WN_2', 'LV_2'];
//所有尺寸的內褲
var hidePantiesList2 = ['SS','S','SM','M','ML','L', 'LL'];
hidePantiesList1.forEach(function(list1) {
hidePantiesList2.forEach(function(list2) {
console.log('A_' + list1 + '_' + list2);
document.getElementById('A_' + list1 + '_' + list2).parentElement.style.display = 'none';
})
})
//=====隱藏新顏色內衣的尺寸
//新顏色的內衣
var hideBraList1 = ['CR', 'CP', 'CG', 'CD', 'CB', 'TG', 'BK', 'RD', 'MT', 'BL', 'WT', 'AQ', 'MC', 'WN', 'LV'];
//所有尺寸的內衣
var hideBraList2 = ['S_2','M_2','L_2','LL_2'];
hideBraList1.forEach(function(list1) {
hideBraList2.forEach(function(list2) {
console.log('A_' + list1 + '_' + list2);
document.getElementById('A_' + list1 + '_' + list2).parentElement.style.display = 'none';
})
})
} */
if (location.pathname.includes('/CA2001/') || location.pathname.includes('/CA2002/') || location.pathname.includes('/RBLP09set/')
|| location.pathname.includes('/RBLP09set_test/')) {
//=====隱藏內褲的尺寸
//所有顏色的內褲
var hidePantiesList1 = ['CR_2','TG_2','CP_2','CG_2','CD_2','CB_2','BK_2', 'RD_2', 'MT_2', 'BL_2', 'WT_2', 'AQ_2', 'MC_2', 'WN_2', 'LV_2', 'LY_2'];
//所有尺寸的內褲
var hidePantiesList2 = ['SS','S','SM','M','ML','L', 'LL'];
hidePantiesList1.forEach(function(list1) {
hidePantiesList2.forEach(function(list2) {
document.getElementById('A_' + list1 + '_' + list2).parentElement.style.display = 'none';
})
})
//=====隱藏新顏色內衣的尺寸
//新顏色的內衣
var hideBraList1 = ['CR', 'CP', 'CG', 'CD', 'CB', 'TG', 'BK', 'RD', 'MT', 'BL', 'WT', 'AQ', 'MC', 'WN', 'LV', 'LY'];
//所有尺寸的內衣
var hideBraList2 = ['S_2','M_2','L_2','LL_2'];
hideBraList1.forEach(function(list1) {
hideBraList2.forEach(function(list2) {
document.getElementById('A_' + list1 + '_' + list2).parentElement.style.display = 'none';
})
})
}
if (location.pathname.includes("/BD2006/")) {
//=====隱藏內褲的尺寸
//所有顏色的內褲
var hidePantiesList1 = ['BK_2', 'RD_2', 'MT_2', 'BL_2', 'WT_2', 'AQ_2', 'MC_2', 'WN_2', 'LV_2'];
//所有尺寸的內褲
var hidePantiesList2 = ["SS", "S", "SM", "M", "ML", "L", "LL"];
hidePantiesList1.forEach(function (list1) {
hidePantiesList2.forEach(function (list2) {
document.getElementById(
"A_" + list1 + "_" + list2
).parentElement.style.display = "none";
});
});
//=====隱藏新顏色內衣的尺寸
//新顏色的內衣
var hideBraList1 = ['BK', 'RD', 'MT', 'BL', 'WT', 'AQ', 'MC', 'WN', 'LV'];
//所有尺寸的內衣
var hideBraList2 = ["S_2", "M_2", "L_2", "LL_2"];
hideBraList1.forEach(function (list1) {
hideBraList2.forEach(function (list2) {
document.getElementById(
"A_" + list1 + "_" + list2
).parentElement.style.display = "none";
});
});
}
}
/**
* 新增缺貨備註 redmine #6730
*/
/*function addMemo() {
$ = jQuery;
$('.titlefont4:eq(1)').before($('<div>', {
'class': 'titlefont',
'html': '<font color="red">黑色/粉色/深藍色 M-L、黑色L-LL目前缺貨, <br>預計1月下旬出貨。<br>造成您的不便, 深感抱歉! 請諒解</font>'
}));
}*/
/**
* GTM(Google Tag Manager)
* 呼叫寫法:
* <!-- Google Tag Manager -->
* <script type="text/javascript">callGTM();</script>
* <!-- End Google Tag Manager -->
*/
function callGTM() {
document.write(
'<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WHJR2RL" \n\
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> \n\
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({"gtm.start":\n\
new Date().getTime(),event:"gtm.js"});var f=d.getElementsByTagName(s)[0],\n\
j=d.createElement(s),dl=l!="dataLayer"?"&l="+l:"";j.async=true;j.src= \n\
"https://www.googletagmanager.com/gtm.js?id="+i+dl;f.parentNode.insertBefore(j,f);\n\
})(window,document,"script","dataLayer","GTM-WHJR2RL");</script>'
);
}