merge master into develop - CscListRForm.jsp FAQ 아코디언 버그 수정
This commit is contained in:
@@ -0,0 +1,514 @@
|
||||
function loadScript(src) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.src = src;
|
||||
script.onload = () => resolve();
|
||||
script.onerror = () => reject(new Error(`Failed to load script: ${src}`));
|
||||
document.head.prepend(script);
|
||||
});
|
||||
}
|
||||
|
||||
function adn2dot0(list, url) {
|
||||
if(fn_is_empty(list)){
|
||||
return false;
|
||||
}
|
||||
|
||||
/*공통헤더*/
|
||||
const commonHeaderAt = adScriptCommonHeaderAt(list);
|
||||
/*방문자 스크립트 */
|
||||
const commonFooterAt = adScriptCommonFooterAt(list);
|
||||
|
||||
/*상품상세 스크립트*/
|
||||
const goodsDtlFormAt = adScriptGoodsDtlFormAt(list);
|
||||
|
||||
//# 장바구니 페이지가 로드되면 아래 코드 실행.
|
||||
const cartListFormAt = adScriptCartListFormAt(list);
|
||||
|
||||
/*주문완료페이지 */
|
||||
const purchsCompleteFormAt = adScriptPurchsCompleteFormAt(list);
|
||||
|
||||
(async function() {
|
||||
// Header 스크립트 로드
|
||||
if (commonHeaderAt) {
|
||||
try {
|
||||
// adn2dot0HeaderScript 로드 및 실행 대기
|
||||
await loadScript('//fin.rainbownine.net/js/across_adn_2.0.1.js');
|
||||
} catch (error) {
|
||||
console.error('error', error);
|
||||
return; // 스크립트 로드 실패 시 이후 진행 중지
|
||||
}
|
||||
}
|
||||
|
||||
// Footer 스크립트 실행 로직
|
||||
if (commonFooterAt) {
|
||||
|
||||
const adMediaId = commonFooterAt.adMediaId;
|
||||
|
||||
let adn2dot0FooterScript = document.createElement('script');
|
||||
adn2dot0FooterScript.type = 'text/x-javascript';
|
||||
adn2dot0FooterScript.innerHTML = `
|
||||
var across_adn_contain = new fn_across_adn_contain();
|
||||
var across_adn_param = [];
|
||||
across_adn_param = {"ut":"Home","ui":"${adMediaId}"};
|
||||
|
||||
var checkAdnInterval = setInterval(() => {
|
||||
|
||||
if(adn_health_flag ==='ok'){
|
||||
|
||||
console.log('adn_health_flag',adn_health_flag);
|
||||
|
||||
clearInterval(checkAdnInterval);
|
||||
|
||||
across_adn_contain.init(across_adn_param);
|
||||
|
||||
}
|
||||
|
||||
}, 100 );
|
||||
`;
|
||||
|
||||
// footer 태그가 없으면 새로 생성
|
||||
let footer = document.getElementsByTagName('footer')[0];
|
||||
if (!footer) {
|
||||
footer = document.createElement('footer');
|
||||
document.body.appendChild(footer);
|
||||
}
|
||||
|
||||
footer.appendChild(adn2dot0FooterScript);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 상품 상세페이지에 설치.
|
||||
<body></body> 태그 사이 최하단에 설치.
|
||||
* */
|
||||
if(url.includes(selectGoodsDtl) && goodsDtlFormAt) {
|
||||
|
||||
const adMediaId = goodsDtlFormAt.adMediaId
|
||||
const goodsInnb = $('#goodsInnb').val()
|
||||
|
||||
const goodsDtl = document.createElement('script')
|
||||
goodsDtl.type = '';
|
||||
goodsDtl.innerHTML = `
|
||||
var across_adn_item_contain = new fn_across_adn_contain();
|
||||
var across_adn_item_param = [];
|
||||
across_adn_item_param = {"ut":"Item","ui":"${adMediaId}", "items":{"i":"${goodsInnb}","s":""} };
|
||||
|
||||
var checkInterval = setInterval(() => {
|
||||
|
||||
if(adn_health_flag ==='ok'){
|
||||
|
||||
clearInterval(checkInterval);
|
||||
|
||||
across_adn_item_contain.init(across_adn_item_param);
|
||||
|
||||
}
|
||||
|
||||
}, 100 )
|
||||
|
||||
|
||||
|
||||
`;
|
||||
|
||||
document.body.appendChild(goodsDtl)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* 장바구니 페이지 조회
|
||||
* 장바구니 페이지에 설치.
|
||||
<body></body> 태그 사이 최하단에 설치.
|
||||
→ 장바구니 버튼 클릭이 아니라 페이지 조회로 공유하였음.
|
||||
* */
|
||||
if(url.includes(selectSpbk)){
|
||||
|
||||
if(cartListFormAt){
|
||||
|
||||
const adScriptGoodsList = JSON.parse($('#adscriptCartGoodsList').val())
|
||||
|
||||
// 데이터를 저장할 배열
|
||||
let productDataArray = [];
|
||||
|
||||
let totalPrice = 0;
|
||||
|
||||
if(!fn_is_empty(adScriptGoodsList.goodsList)){
|
||||
adScriptGoodsList.goodsList.forEach(optn => {
|
||||
|
||||
// 객체로 저장
|
||||
const productData = {
|
||||
i: optn.goodsInnb, //상품번호
|
||||
c: '',
|
||||
s: optn.optn, //상품명
|
||||
p: optn.subSlepric, //옵션주문단가*옵션주문수량
|
||||
q: optn.qy //옵션주문수량
|
||||
};
|
||||
|
||||
// 배열에 추가
|
||||
productDataArray.push(productData);
|
||||
totalPrice += optn.subSlepric
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
let cartListScript = document.createElement('script');
|
||||
|
||||
const adMediaId = cartListFormAt.adMediaId
|
||||
|
||||
cartListScript.innerHTML= `
|
||||
var across_adn_cart_contain = new fn_across_adn_contain();
|
||||
var across_adn_cart_param = [];
|
||||
across_adn_cart_param = {"ut":"Cart","ui":"${adMediaId}", "items":${JSON.stringify(productDataArray)}
|
||||
};
|
||||
|
||||
|
||||
var checkCartInterval = setInterval(() => {
|
||||
|
||||
if(adn_health_flag ==='ok'){
|
||||
|
||||
clearInterval(checkCartInterval);
|
||||
|
||||
across_adn_cart_contain.init(across_adn_cart_param);
|
||||
|
||||
}
|
||||
|
||||
}, 100 )
|
||||
|
||||
|
||||
|
||||
`;
|
||||
|
||||
document.body.appendChild(cartListScript);
|
||||
|
||||
}
|
||||
}//장바구니 페이지 END
|
||||
|
||||
|
||||
/*주문완료 페이지
|
||||
*
|
||||
* <body></body> 태그 사이 최하단에 설치.
|
||||
→ 네이버페이를 전환추적은 제외하기로 하였음.
|
||||
* */
|
||||
//주문 완료 페이지
|
||||
if(url.includes(selectOrdrCompt)){
|
||||
|
||||
//# 주문완료 페이지가 로드되면 아래 코드 실행.
|
||||
if(purchsCompleteFormAt){
|
||||
|
||||
|
||||
const adscriptVal = $('#adscript').val()
|
||||
const decode = decodeURIComponent(atob(adscriptVal).split('').map(function (c) {
|
||||
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
||||
}).join(''));
|
||||
|
||||
const adscriptParse = JSON.parse(decode);
|
||||
|
||||
let price = parseInt(adscriptParse.total.setleAmt)
|
||||
let finalOrderNo = adscriptParse.total.ordrInnb
|
||||
|
||||
|
||||
let purchsComplateFormScript = document.createElement('script');
|
||||
|
||||
purchsComplateFormScript.innerHTML= `
|
||||
var across_adn_order_contain = new fn_across_adn_contain();
|
||||
var across_adn_order_param = [];
|
||||
across_adn_order_param = {"ut":"Purchase","ui":"${purchsCompleteFormAt.adMediaId}", "uo":"${finalOrderNo}", "up":"${price}"};
|
||||
|
||||
|
||||
var checkOrderInterval = setInterval(() => {
|
||||
|
||||
if(adn_health_flag ==='ok'){
|
||||
|
||||
clearInterval(checkOrderInterval);
|
||||
|
||||
across_adn_order_contain.init(across_adn_order_param);
|
||||
|
||||
}
|
||||
|
||||
}, 100 )
|
||||
|
||||
|
||||
`;
|
||||
|
||||
document.body.appendChild(purchsComplateFormScript);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}//주문 완료 페이지 END
|
||||
|
||||
|
||||
|
||||
//회원가입 완료 페이지
|
||||
|
||||
/*회원가입 완료 페이지
|
||||
* <body></body> 태그 사이 최하단에 설치.
|
||||
* */
|
||||
if(url.includes(selectJoinCompleteR)){
|
||||
|
||||
|
||||
|
||||
//# 회원가입 완료 페이지 로드되면 아래 코드 실행
|
||||
const mbrRegstFormAt = adScriptMbrRegstFormAt(list);
|
||||
if(mbrRegstFormAt){
|
||||
|
||||
const adMediaId = mbrRegstFormAt.adMediaId
|
||||
|
||||
|
||||
let joinScript = document.createElement('script');
|
||||
|
||||
joinScript.innerHTML = `
|
||||
var across_adn_complete_contain = new fn_across_adn_contain();
|
||||
var across_adn_complete_param = [];
|
||||
across_adn_complete_param = {"ut":"Complete","ui":"${adMediaId}","uo":"types1"};
|
||||
|
||||
|
||||
var checkMemInterval = setInterval(() => {
|
||||
|
||||
if(adn_health_flag ==='ok'){
|
||||
|
||||
clearInterval(checkMemInterval);
|
||||
|
||||
across_adn_complete_contain.init(across_adn_complete_param);
|
||||
|
||||
}
|
||||
|
||||
}, 100 )
|
||||
`;
|
||||
|
||||
document.body.appendChild(joinScript);
|
||||
}
|
||||
|
||||
}//회원가입 완료 페이지 END
|
||||
})();
|
||||
|
||||
/*클로징 패널(MO)
|
||||
*모바일 버전에 설치
|
||||
만약 PC와 Mobile의 URL 주소가 같다면(반응형 페이지), 해당 페이지에 PC와 Mobile 패널 둘 다 설치.
|
||||
모든 페이지. <footer></footer> 태그 사이에 설치.
|
||||
→ 실제로 사용
|
||||
* */
|
||||
const mblFooterAt = adScriptMblFooterAt(list)
|
||||
if(mblFooterAt) {
|
||||
|
||||
const instlPgeLbl = mblFooterAt.instlPgeLbl;
|
||||
|
||||
let mblFooterScript = document.createElement('script');
|
||||
|
||||
mblFooterScript.innerHTML = `
|
||||
var adn_mobile_panel_param = adn_mobile_panel_param || [];
|
||||
adn_mobile_panel_param.push([${instlPgeLbl}]);
|
||||
`;
|
||||
|
||||
// footer가 없으면 새로 생성
|
||||
let footer;
|
||||
if (!document.getElementsByTagName('footer').length) {
|
||||
footer = document.createElement('footer');
|
||||
document.body.appendChild(footer); // body에 footer 추가
|
||||
} else {
|
||||
footer = document.getElementsByTagName('footer')[0];
|
||||
}
|
||||
|
||||
footer.appendChild(mblFooterScript);
|
||||
|
||||
let closeMblScript = document.createElement('script')
|
||||
closeMblScript.type = 'text/javascript'
|
||||
closeMblScript.async = true;
|
||||
closeMblScript.src = "//fin.rainbownine.net/js/across_adn_closed_mobile_ad_1.0.4.js";
|
||||
|
||||
footer.appendChild(closeMblScript)
|
||||
|
||||
}
|
||||
|
||||
/*클로징패널 PC
|
||||
* PC 버전에 설치.
|
||||
만약 PC와 Mobile의 URL 주소가 같다면(반응형 페이지), 해당 페이지에 PC와 Mobile 패널 둘 다 설치.
|
||||
모든 페이지. <footer></footer> 태그 사이에 설치.
|
||||
→ 실제로 사용
|
||||
* */
|
||||
const pcFooterAt = adScriptPcFooterAt(list)
|
||||
if(pcFooterAt){
|
||||
const instlPgeLbl = pcFooterAt.instlPgeLbl;
|
||||
|
||||
let pcFooterScript = document.createElement('script');
|
||||
|
||||
pcFooterScript.innerHTML = `
|
||||
var adn_panel_param = adn_panel_param || [];
|
||||
adn_panel_param.push([${instlPgeLbl}]);
|
||||
`;
|
||||
|
||||
// footer가 없으면 새로 생성
|
||||
let footer;
|
||||
if (!document.getElementsByTagName('footer').length) {
|
||||
footer = document.createElement('footer');
|
||||
document.body.appendChild(footer); // body에 footer 추가
|
||||
} else {
|
||||
footer = document.getElementsByTagName('footer')[0];
|
||||
}
|
||||
|
||||
footer.appendChild(pcFooterScript);
|
||||
|
||||
let closePcScript = document.createElement('script')
|
||||
closePcScript.type = 'text/javascript'
|
||||
closePcScript.async = true;
|
||||
closePcScript.src = "//fin.rainbownine.net/js/across_adn_closed_pc_ad_1.0.4.js";
|
||||
|
||||
footer.appendChild(closePcScript)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//main page
|
||||
if(url === mainPage || url === mainIndex) {
|
||||
/* 메인 패널(MO)
|
||||
* 모바일 버전에 설치
|
||||
만약 PC와 Mobile의 URL 주소가 같다면(반응형 페이지), 해당 페이지에 PC와 Mobile 패널 둘 다 설치.
|
||||
메인 페이지에 설치.
|
||||
<body></body> 태그 사이 최하단에 설치.
|
||||
→ 실제로 사용
|
||||
*
|
||||
* */
|
||||
const mblMainFormAt = adScriptMblMainFormAt(list);
|
||||
if(mblMainFormAt) {
|
||||
let mainMo = document.createElement('script')
|
||||
|
||||
const instlPgeLbl = mblMainFormAt.instlPgeLbl;
|
||||
|
||||
mainMo.type = 'text/javascript'
|
||||
mainMo.innerHTML = `
|
||||
var adn_mobile_pinad_param = adn_mobile_pinad_param || [];
|
||||
adn_mobile_pinad_param.push([${instlPgeLbl}]);
|
||||
`;
|
||||
|
||||
document.body.appendChild(mainMo)
|
||||
|
||||
let mainMoScript = document.createElement('script')
|
||||
mainMoScript.type = 'text/javascript'
|
||||
mainMoScript.async = true;
|
||||
mainMoScript.src = "//fin.rainbownine.net/js/across_adn_mainpanel_mobile_ad_1.0.4.js";
|
||||
|
||||
document.body.appendChild(mainMoScript)
|
||||
}
|
||||
|
||||
/*메인패널 PC
|
||||
* PC 버전에 설치.
|
||||
만약 PC와 Mobile의 URL 주소가 같다면(반응형 페이지), 해당 페이지에 PC와 Mobile 패널 둘 다 설치.
|
||||
메인 페이지에 설치.
|
||||
<body></body> 태그 사이 최하단에 설치.
|
||||
→ 실제로 사용
|
||||
* */
|
||||
const pcMainFormAt = adScriptPCMainFormAt(list)
|
||||
if(pcMainFormAt) {
|
||||
|
||||
const instlPgeLbl = pcMainFormAt.instlPgeLbl
|
||||
|
||||
const mainPc = document.createElement('script')
|
||||
mainPc.type = '';
|
||||
mainPc.innerHTML = `
|
||||
var adn_pinad_param = adn_pinad_param || [];
|
||||
adn_pinad_param.push([${instlPgeLbl}]);
|
||||
`;
|
||||
|
||||
document.body.appendChild(mainPc)
|
||||
|
||||
const mainPcScript = document.createElement('script')
|
||||
mainPcScript.type = 'text/javascript'
|
||||
mainPcScript.async = true;
|
||||
mainPcScript.src = "//fin.rainbownine.net/js/across_adn_mainpanel_pc_ad_1.0.5.js";
|
||||
|
||||
document.body.appendChild(mainPcScript)
|
||||
}
|
||||
|
||||
}//main end
|
||||
|
||||
|
||||
|
||||
|
||||
//상품 상세 페이지
|
||||
if(url.includes(selectGoodsDtl)){
|
||||
|
||||
|
||||
/* 상품 패널(MO)
|
||||
* 모바일 버전에 설치
|
||||
만약 PC와 Mobile의 URL 주소가 같다면(반응형 페이지), 해당 페이지에 PC와 Mobile 패널 둘 다 설치.
|
||||
상품 상세페이지에 설치.
|
||||
→ 실제로 사용
|
||||
상품 상세페이지 탭 바로 위에 설치.
|
||||
상세페이지 설명 맨 아래에 설치.
|
||||
→ 상세페이지 탭 바로 위에, 리뷰 아래에 설치
|
||||
* */
|
||||
const mblGoodsDtlFormAt =adScriptMblGoodsDtlFormAt(list)
|
||||
if(mblGoodsDtlFormAt) {
|
||||
|
||||
//상세페이지 탭 바로 위에, 리뷰 아래에 위치
|
||||
const prodDtlTab = document.querySelector('.productDetailTab')
|
||||
const container = document.createElement('div')
|
||||
container.id = 'suggestad_mobie_wrap_container';
|
||||
|
||||
prodDtlTab.parentNode.insertBefore(container, prodDtlTab);
|
||||
|
||||
|
||||
const instlPgeLbl = mblGoodsDtlFormAt.instlPgeLbl
|
||||
|
||||
const mblGoodsDtlForm = document.createElement('script')
|
||||
mblGoodsDtlForm.type='text/javascript'
|
||||
mblGoodsDtlForm.innerHTML = `
|
||||
var adn_suggestad_mobile_param = adn_suggestad_mobile_param || [];
|
||||
adn_suggestad_mobile_param.push([${instlPgeLbl}]);
|
||||
`
|
||||
|
||||
container.appendChild(mblGoodsDtlForm)
|
||||
|
||||
const mblGoodsDtlScript = document.createElement('script')
|
||||
mblGoodsDtlScript.type = 'text/javascript'
|
||||
mblGoodsDtlScript.src = "//fin.rainbownine.net/js/across_adn_recommend_mobile_ad_1.0.5.js";
|
||||
|
||||
container.appendChild(mblGoodsDtlScript)
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*상품패널 PC
|
||||
* PC 버전에 설치.
|
||||
만약 PC와 Mobile의 URL 주소가 같다면(반응형 페이지), 해당 페이지에 PC와 Mobile 패널 둘 다 설치.
|
||||
상품 상세페이지에 설치.
|
||||
→ 실제로 사용
|
||||
상품 상세페이지 탭 바로 위에 설치.
|
||||
상세페이지 설명 맨 아래에 설치.
|
||||
→ 상세페이지 탭 바로 위에, 리뷰 아래에 설치
|
||||
* */
|
||||
const pcGoodsDtlFormAt =adScriptPcGoodsDtlFormAt(list)
|
||||
if(pcGoodsDtlFormAt) {
|
||||
//상세페이지 탭 바로 위에, 리뷰 아래에 위치
|
||||
const prodDtlTab = document.querySelector('.productDetailTab')
|
||||
const container = document.createElement('div')
|
||||
container.id = 'suggestad_wrap_container';
|
||||
|
||||
prodDtlTab.parentNode.insertBefore(container, prodDtlTab);
|
||||
|
||||
const pcGoodsDtlForm = document.createElement('script')
|
||||
|
||||
|
||||
const instlPgeLbl = pcGoodsDtlFormAt.instlPgeLbl
|
||||
|
||||
pcGoodsDtlForm.innerHTML = `
|
||||
var adn_suggestad_param = adn_suggestad_param || [];
|
||||
adn_suggestad_param.push([${instlPgeLbl}]);
|
||||
`
|
||||
|
||||
container.appendChild(pcGoodsDtlForm)
|
||||
|
||||
const pcGoodsDtlScript = document.createElement('script')
|
||||
pcGoodsDtlScript.type = 'text/javascript'
|
||||
pcGoodsDtlScript.src = "//fin.rainbownine.net/js/across_adn_recommend_pc_ad_1.0.5.js";
|
||||
|
||||
container.appendChild(pcGoodsDtlScript)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user