쿠키 삭제 스크립트 추가

This commit is contained in:
2024-07-28 20:52:27 +09:00
parent b304813abf
commit 1d6468b0e5

View File

@@ -714,9 +714,7 @@ function pdpIntro() {
break;
}
$(".close-today").html(
`<span onclick="hideTodayIntroPopup('${cookieVal}')" style="cursor:pointer"><input type="checkbox"> 오늘 하루 재생하지 않기</span>`
);
if (getCookie(cookieVal)) {
$(".editorWarp").removeClass("playing");
@@ -724,6 +722,13 @@ function pdpIntro() {
videoElements[0].pause();
videoElements[0].currentTime = 0;
$(".video_wrap").hide();
$(".close-today").html(
`<span onclick="deleteCookie('${cookieVal}')" style="cursor:pointer"><input type="checkbox"> 오늘 하루 재생하지 않기</span>`
);
} else {
$(".close-today").html(
`<span onclick="hideTodayIntroPopup('${cookieVal}')" style="cursor:pointer"><input type="checkbox"> 오늘 하루 재생하지 않기</span>`
);
}
videoElements.forEach((video) => {
@@ -1109,6 +1114,12 @@ function getCookie(name) {
}
return null;
}
// 쿠키 삭제 함수
function deleteCookie(name) {
document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";
$(".close-today input").prop("checked", false);
}
// 팝업을 숨기는 함수
function hideTodayIntroPopup(target) {
const videoElements = document.querySelectorAll(".video_wrap video");