PageSourceSearch

https://pctech.com.vn/wp-content/themes/pctech-child/assets/js/modules/10-hero-time-cta.js?ver=1790690010

js pctech.com.vn collected 2026-10-02 22:47:17 UTC 1,573 bytes, 30 lines download raw bytes

1/**
2 * Module: hero-time-cta.js
3 * Trích nguyên văn dòng 603-620 của pctech-homepage.js gốc.
4 * Không đổi bất kỳ ký tự nào bên trong — chỉ cắt file, không sửa logic.
5'use strict';
6
7 */
8  /* ── Hero CTA theo giờ ── */
9  function initHeroTimeCta() {
10    const el = document.getElementById('heroTimeCta');
11    const headerBtn = document.getElementById('headerCallBtn');
12    const heroCall = document.getElementById('heroCallBtn');
13    const hour = new Date().getHours();
14    const isOpen = hour >= 8 && hour < 21;
15    if (el) {
16      el.innerHTML = isOpen
17        ? '🟢 <strong>KTV đang online</strong> — Gọi ngay, phản hồi trong vài phút'
18        : '🌙 Ngoài giờ làm việc — <a href="#" data-modal-open="modalBooking" style="color:#ffd080">Đặt lịch sáng mai</a>';
19      el.querySelector('[data-modal-open]')?.addEventListener('click', (e) => { e.preventDefault(); openModal('modalBooking'); });
20    }
21    // Nút menu chính: chữ NGẮN (tránh nút to, xuống dòng); trạng thái online thể hiện bằng chấm xanh + tooltip.
22    const callText = isOpen ? 'Gọi ngay' : 'Để lại tin';
23    if (headerBtn) {
24      headerBtn.textContent = callText;
25      headerBtn.setAttribute('data-online', isOpen ? '1' : '0');
26      headerBtn.title = isOpen ? 'KTV đang online — phản hồi trong vài phút' : 'Ngoài giờ làm việc — để lại tin, chúng tôi gọi lại sáng mai';
27    }
28    if (heroCall) heroCall.textContent = isOpen ? '☎ Gọi Ngay' : '☎ Để lại tin nhắn';
29  }
30

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.