Premiere Room
Modern comfort meets timeless style.
Trans Hotel Jakarta values you as our guest and recognizes that privacy is important to you. This Privacy Policy describes how we collect, use, and disclose information across our services.
We may collect Personal Information such as name, contact details, IDs, guest stay information, and preferences.
We employ reasonable measures to protect data. No system is 100% secure.
`; function openPolicy(title, html) { if (!privModal) return; if (title) policyTitle.textContent = title; if (html) policyContent.innerHTML = html; privModal.classList.add("open"); document.body.style.overflow = 'hidden'; privModal.querySelector('.panel')?.focus(); } function closePolicy() { privModal?.classList.remove("open"); document.body.style.overflow = ''; } function bindOpen(id, title, html) { const el = document.getElementById(id); el?.addEventListener("click", (e) => { e.preventDefault(); openPolicy(title, html); }); } bindOpen("privacyInline", "Privacy Policy", privacyHTML); bindOpen("privacyInline2", "Privacy Policy", privacyHTML); privModal?.addEventListener("click", (e) => { if (e.target.classList.contains('backdrop')) closePolicy(); }); document.getElementById("privClose")?.addEventListener("click", closePolicy); document.addEventListener('keydown', (e) => { if (e.key === 'Escape') closePolicy(); }); /* ========= COOKIE BAR ========= */ const cookiebar = document.getElementById("cookiebar"); const cookieAccept = document.getElementById("cookieAccept"); const cookieDecline = document.getElementById("cookieDecline"); function showCookiebar() { if (cookiebar) cookiebar.style.display = "flex"; } function hideCookiebar() { if (cookiebar) cookiebar.style.display = "none"; } if (DEV) { // DEV MODE: selalu tampil, tanpa tulis/hapus cookie, tidak auto-hide showCookiebar(); cookieAccept?.addEventListener("click", () => { console.log("[DEV] Accept clicked (no-op)."); }); cookieDecline?.addEventListener("click", () => { console.log("[DEV] Decline clicked (no-op)."); }); } else { // PROD MODE: tampil jika belum ada consent; sembunyikan setelah memilih const consent = getCookie("consent"); if (consent !== '1' && consent !== '0') { showCookiebar(); } else { hideCookiebar(); } cookieAccept?.addEventListener("click", () => { setCookie("consent", "1", 3600 * 24 * 180); // 180 hari hideCookiebar(); // TODO: inisialisasi tracker/GA di sini (jika perlu) }); cookieDecline?.addEventListener("click", () => { setCookie("consent", "0", 3600 * 24 * 30); // 30 hari hideCookiebar(); // TODO: pastikan tracker tidak diload saat consent=0 }); } /* ========= DEV HELPERS (opsional) ========= */ window.__consent = { get: () => getCookie('consent'), set: (v, days = 30) => setCookie('consent', String(v), 3600 * 24 * days), reset: () => deleteCookie('consent'), show: showCookiebar, hide: hideCookiebar }; /* ===================== LANGUAGE SWITCHER ======================*/ // loop semua instance (desktop/mobile) document.querySelectorAll(".lang-wrap").forEach((wrap) => { const btn = wrap.querySelector(".lang-btn"); const menu = wrap.querySelector(".lang-menu"); const code = btn?.querySelector(".code"); if (!btn || !menu || !code) return; let justOpenedTick = false; const open = () => { wrap.classList.add("open"); btn.setAttribute("aria-expanded", "true"); justOpenedTick = true; // biar handler global click nggak langsung nutup di tick yg sama setTimeout(() => (justOpenedTick = false), 0); }; const close = () => { wrap.classList.remove("open"); btn.setAttribute("aria-expanded", "false"); }; const toggle = () => (wrap.classList.contains("open") ? close() : open()); btn.addEventListener("click", (e) => { e.preventDefault(); e.stopPropagation(); // cegah handler luar menutup toggle(); }); menu.addEventListener("click", (e) => { const item = e.target.closest("[data-lang]"); if (!item) return; e.preventDefault(); code.textContent = item.getAttribute("data-lang") || code.textContent; close(); }); // tutup saat klik di luar document.addEventListener("click", (e) => { if (!wrap.classList.contains("open")) return; if (justOpenedTick) return; // hindari langsung nutup di klik yg sama if (!wrap.contains(e.target)) close(); }); // Esc untuk tutup document.addEventListener("keydown", (e) => { if (e.key === "Escape" && wrap.classList.contains("open")) close(); }); }); /* ===================== CTA + FORMS ======================*/ // document.getElementById("bookBtn")?.addEventListener("click", (e) => { // e.preventDefault(); // alert("Booking Engine Coming Soon"); // }); document.getElementById("newsForm")?.addEventListener("submit", (e) => { e.preventDefault(); const email = document.getElementById("newsEmail")?.value; if (email) { alert("Thanks for subscribing, " + email + "!"); e.target.reset(); } }); document.getElementById("reqForm")?.addEventListener("submit", (e) => { e.preventDefault(); alert( "Your request has been sent successfully. We’ll contact you within 24 hours." ); e.target.reset(); }); // counters // document.querySelectorAll(".counter button").forEach((btn) => { // btn.addEventListener("click", (e) => { // e.preventDefault(); // const targetId = btn.dataset.target; // const output = document.getElementById(targetId); // if (!output) return; // let val = parseInt(output.textContent, 10) || 0; // if (btn.classList.contains("plus")) val++; // if (btn.classList.contains("minus") && val > 1) val--; // output.textContent = val; // if (targetId === "roomsCount") { // const inEl = document.getElementById("roomsInput"); // if (inEl) inEl.value = val; // } // if (targetId === "guestsCount") { // const inEl = document.getElementById("guestsInput"); // if (inEl) inEl.value = val; // } // }); // }); /* ===================== TOP PROGRESS BAR ======================*/ const progress = document.getElementById("progress"); function updateProgress() { if (!progress) return; const scrollTop = window.scrollY || document.documentElement.scrollTop; const docH = document.documentElement.scrollHeight - window.innerHeight; const percent = docH > 0 ? (scrollTop / docH) * 100 : 0; progress.style.width = percent + "%"; } window.addEventListener("scroll", updateProgress, { passive: true }); window.addEventListener("resize", updateProgress); updateProgress(); /* ===== SUBSCRIBE behavior (minimal, elegan) ===== */ (function () { const form = document.getElementById('subForm'); const email = document.getElementById('subEmail'); const msg = document.getElementById('subMsg'); function show(text) { msg.textContent = text; msg.classList.add('show'); setTimeout(() => msg.classList.remove('show'), 4000); } form?.addEventListener('submit', (e) => { e.preventDefault(); const val = (email.value || '').trim(); const ok = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val); if (!ok) { show('Please enter a valid e-mail address.'); email.focus(); return; } // TODO: kirim ke backend/newsletter provider show('Thanks! You are subscribed.'); form.reset(); }); })(); /* ===================== FOOTER YEAR ======================*/ const yearEl = document.getElementById('year'); if (yearEl) yearEl.textContent = String(new Date().getFullYear()); const dateField = document.querySelector(".booking-form .date-field"); const fieldGroups = document.querySelectorAll(".booking-form .field-group"); const bookingForm = document.querySelector(".booking-form"); if (window.innerWidth <= 768 && dateField) { // Saat tanggal diklik, tampilkan input lainnya dateField.addEventListener("change", () => { fieldGroups.forEach(el => el.style.display = "block"); }); // Tangkap klik tombol Book Now // bookingForm.addEventListener("submit", (e) => { // e.preventDefault(); // alert("Booking Engine Coming Soon"); // }); } // === FIX NAV SLIDE BEHAVIOR === const navContainer = document.querySelector('.nav-center'); const leftArrow = document.querySelector('.nav-arrow.left'); const rightArrow = document.querySelector('.nav-arrow.right'); // Jika elemen ditemukan if (navContainer && leftArrow && rightArrow) { // Pastikan mulai dari kiri navContainer.scrollLeft = 0; // Fungsi scroll halus const scrollAmount = 250; leftArrow.addEventListener('click', () => { navContainer.scrollBy({ left: -scrollAmount, behavior: 'smooth' }); }); rightArrow.addEventListener('click', () => { navContainer.scrollBy({ left: scrollAmount, behavior: 'smooth' }); }); // Perbarui status panah (opsional) const updateArrows = () => { leftArrow.style.opacity = navContainer.scrollLeft <= 0 ? 0.3 : 1; rightArrow.style.opacity = navContainer.scrollLeft + navContainer.clientWidth >= navContainer.scrollWidth ? 0.3 : 1; }; navContainer.addEventListener('scroll', updateArrows); updateArrows(); // jalankan di awal } });