mingle-website/js/popup.js
68893236+KINDNICK@users.noreply.github.com d4a3a9afa5 Update: 서비스 페이지 논리 오류 수정 및 3월 요금제 변경 팝업 추가
- 서비스1 명칭 '모션캡처 녹화 서비스'로 통일
- 가격 카드 설명을 모션 녹화 중심으로 수정 (방송 표현 제거)
- SEO 메타/OG/Twitter 가격 및 용어 오류 수정
- mailto 템플릿 가격·용어 현행화
- 메인 팝업: 3월 요금제 변경 안내로 교체
  - 할인 이벤트 종료, 스트리밍글 4시간 신설, 추천인 제도 오픈
- 팝업 스크롤바 숨김 처리 및 변경사항 카드 스타일 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 20:50:02 +09:00

97 lines
2.7 KiB
JavaScript

/**
* 밍글 스튜디오 메인 팝업 관리
*/
// 쿠키 관련 함수
function setCookie(name, value, days) {
const date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
const expires = "expires=" + date.toUTCString();
document.cookie = name + "=" + value + ";" + expires + ";path=/";
}
function getCookie(name) {
const nameEQ = name + "=";
const ca = document.cookie.split(';');
for(let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
// 팝업 표시 함수
function showPopup() {
const popup = document.getElementById('mainPopup');
if (popup) {
popup.classList.add('active');
document.body.style.overflow = 'hidden'; // 스크롤 방지
}
}
// 팝업 닫기 함수
function closePopup() {
const popup = document.getElementById('mainPopup');
const dontShowToday = document.getElementById('dontShowToday');
if (popup) {
popup.classList.remove('active');
document.body.style.overflow = ''; // 스크롤 복원
// "하루동안 보지 않기" 체크된 경우
if (dontShowToday && dontShowToday.checked) {
setCookie('hidePriceChangePopup', 'true', 1); // 1일간 쿠키 저장
}
}
}
// 페이지 로드 시 실행
document.addEventListener('DOMContentLoaded', function() {
// 쿠키 확인
const hidePopup = getCookie('hidePriceChangePopup');
// 쿠키가 없으면 팝업 표시 (1초 후)
if (!hidePopup) {
setTimeout(showPopup, 1000);
}
// 닫기 버튼 이벤트
const closeBtn = document.getElementById('popupCloseBtn');
if (closeBtn) {
closeBtn.addEventListener('click', closePopup);
}
// X 버튼 이벤트
const closeX = document.getElementById('popupCloseX');
if (closeX) {
closeX.addEventListener('click', closePopup);
}
// 오버레이 클릭 시 닫기
const overlay = document.getElementById('mainPopup');
if (overlay) {
overlay.addEventListener('click', function(e) {
if (e.target === overlay) {
closePopup();
}
});
}
// ESC 키로 닫기
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
closePopup();
}
});
// CTA 버튼 클릭 시 연락처 페이지로 이동
const ctaBtn = document.getElementById('popupCtaBtn');
if (ctaBtn) {
ctaBtn.addEventListener('click', function() {
closePopup();
window.location.href = '/services';
});
}
});