(function(){ const titleMap = { login:'·Î±×ÀÎ', send:'Àü¼Û', sent:'³»¿ª', charge:'°áÁ¦', reserved:'¿¹¾à', my:'MY' }; // HTML partial include (inc/header.htm, inc/nav.htm) async function includePartials(){ const nodes = document.querySelectorAll('[data-include]'); await Promise.all(Array.from(nodes).map(async el=>{ const url = el.getAttribute('data-include'); const res = await fetch(url, {cache:'no-store'}); const html = await res.text(); el.outerHTML = html; // ÀÚ¸® ÀÚü¸¦ ±³Ã¼ })); } // °øÅë ¼Ð ÃʱâÈ­ function initShell(){ const page = (document.body.dataset.page||'send').trim(); const isLoginPage = page === 'login'; // Çì´õ/³×ºñ Ç¥½Ã¿©ºÎ const header = document.getElementById('main-title'); const nav = document.getElementById('bottomNav'); if(header) header.style.display = isLoginPage ? 'none' : 'flex'; if(nav) nav.style.display = isLoginPage ? 'none' : 'flex'; // ŸÀÌÆ² const pt = document.getElementById('page-title'); if(pt) pt.textContent = titleMap[page] || '¹®ÀÚ³ª¶ó'; // ³×ºñ Ȱ¼º Ç¥½Ã document.querySelectorAll('#bottomNav a').forEach(a=>{ a.classList.toggle('active', a.dataset.page === page); }); // µÚ·Î°¡±â const back = document.getElementById('btnBack'); if(back) back.addEventListener('click', ()=>history.back()); // ·Î±×ÀÎ/·Î±×¾Æ¿ô ¹öư ³ëÃâ Á¤Ã¥ const btnLogin = document.getElementById('btnLogin'); const btnLogout = document.getElementById('btnLogout'); if(isLoginPage){ if(btnLogin) btnLogin.style.display = 'inline-block'; if(btnLogout) btnLogout.style.display = 'none'; }else{ if(btnLogin) btnLogin.style.display = 'none'; if(btnLogout){ btnLogout.style.display = 'inline-block'; btnLogout.addEventListener('click', ()=>{ const returnUrl = encodeURIComponent('/pages/login.htm#login'); location.href = '/MSG/php/logout.php?return_url=' + returnUrl; }); } } } // °øÅë À¯Æ¿ window.mn = window.mn || {}; window.mn.currency = (n)=> (n||0).toLocaleString('ko-KR'); window.mn.copy = (t)=> navigator.clipboard?.writeText(t); // ºÎǰ ·Îµå ÈÄ ¼Ð ¼¼ÆÃ document.addEventListener('DOMContentLoaded', async ()=>{ await includePartials(); initShell(); }); })();