씽크 맞춤춤

This commit is contained in:
2026-01-14 23:13:49 +09:00
parent f7e7196d65
commit c67e0944f2
2 changed files with 63 additions and 23 deletions

View File

@@ -70,12 +70,18 @@ $(document).ready(function () {
if (targetSize != "moblie") {
menu_init();
$(document).on("click", ".mobileCarlist > .mobilecarItem .btn-select", function () {
if (!$(this).hasClass("noitem")) {
$(this).next().slideToggle("fast");
$(this).find(".arrow").toggleClass("on");
$(this).toggleClass("on");
if ($(this).hasClass("on")) {
$(document).on("click", ".mobileCarlist > .mobilecarItem .btn-select", function (e) {
const $btn = $(this);
if ($btn.is("[data-only-popup]")) {
e.stopPropagation();
return;
}
if (!$btn.hasClass("noitem")) {
$btn.next().slideToggle("fast");
$btn.find(".arrow").toggleClass("on");
$btn.toggleClass("on");
if ($btn.hasClass("on")) {
window.dataLayer.push({
event: "navigation",
event_category: "Navigation",
@@ -1090,8 +1096,11 @@ function open_layer_popup(popid, addClass) {
}
//레이어 팝업 클로즈 스크립트
function close_layer_popup(popid, removeClass) {
function close_layer_popup(popid, isDuplicated = false, removeClass) {
var popid = popid;
if (popid === "sharePopup" && !isDuplicated) {
window.dataLayer.push({ event: "share", click_location: "Copy FOD page url", click_text: "닫기" });
}
$("#" + popid)
.stop()
.animate(
@@ -1116,9 +1125,7 @@ function close_layer_popup(popid, removeClass) {
//[S]PDP 리뷰 더보기 관련
more_contents_chk();
function more_contents_chk() {
console.log("여기 호출해");
$(".reviewItem").each(function (index, item) {
console.log("여기 호출해22", $(this).find(".contents").height());
if ($(item).find(".contents").height() >= 74) {
$(item).find(".contents").addClass("abstracted");
$(item).find(".contentMoreBtn").css("display", "flex");
@@ -1642,21 +1649,17 @@ function btnTabMenu(tabBtnNumber) {
// 공유하기 팝업 열릴 때 URL 설정
function openSharePopup() {
var currentUrl = window.location.href;
currentUrl = currentUrl.split("?")[0];
currentUrl = currentUrl.split("#")[0];
document.getElementById("shareUrl").value = currentUrl;
window.dataLayer.push({ event: "share", click_location: "Share FOD information", click_text: "share button" });
const shareUrl = getCanonicalUrl();
document.getElementById("shareUrl").value = shareUrl;
const userAgent = navigator.userAgent;
console.log("🚀 ~ userAgent:", userAgent);
const isMobile = /iPhone|iPad|iPod|Android/i.test(userAgent);
// 모바일이고 navigator.share API가 지원되는 경우
if (isMobile && navigator.share) {
const shareData = {
title: document.title,
url: currentUrl,
};
const shareData = { ...getShareMeta(), url: shareUrl };
(async () => {
try {
@@ -1674,6 +1677,8 @@ function openSharePopup() {
// 링크 복사 함수
function copyShareLink() {
window.dataLayer.push({ event: "share", click_location: "Copy FOD page url", click_text: "링크복사" });
var urlInput = document.getElementById("shareUrl");
urlInput.select();
urlInput.setSelectionRange(0, 99999); // 모바일 지원
@@ -1681,13 +1686,13 @@ function copyShareLink() {
try {
document.execCommand("copy");
alert("링크가 복사되었습니다.");
close_layer_popup("sharePopup");
close_layer_popup("sharePopup", true);
} catch (err) {
// execCommand가 실패한 경우 (최신 브라우저)
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(urlInput.value).then(function () {
alert("링크가 복사되었습니다.");
close_layer_popup("sharePopup");
close_layer_popup("sharePopup", true);
});
} else {
alert("링크 복사에 실패했습니다. 수동으로 복사해주세요.");
@@ -1695,6 +1700,41 @@ function copyShareLink() {
}
}
// Canonical URL 가져오기 (기존 유지)
function getCanonicalUrl() {
const link = document.querySelector('link[rel="canonical"][href]');
if (link && link.href) return link.href;
const url = new URL(location.href);
const params = new URLSearchParams(url.search);
// 특정 페이지에서 필요한 파라미터만 유지
const preserveParams = [];
// event-view 페이지인 경우 eventNo, eventType 유지
if (url.pathname.includes("/event-view")) {
if (params.has("eventView")) preserveParams.push(["eventView", params.get("eventView")]);
if (params.has("eventType")) preserveParams.push(["eventType", params.get("eventType")]);
}
// 필요한 파라미터만 설정
url.search = "";
preserveParams.forEach(([key, value]) => {
url.searchParams.set(key, value);
});
url.hash = "";
console.log("Shared URL: ", url.toString());
return url.toString();
}
// 제목과 설명 메타 가져오기 (기존 유지)
function getShareMeta() {
const title = document.querySelector('meta[property="og:title"]')?.content || document.querySelector('meta[name="title"]')?.content || document.title;
const desc = document.querySelector('meta[property="og:description"]')?.content || document.querySelector('meta[name="description"]')?.content || title;
return { title, text: desc };
}
// 앵커로 스크롤 이동 함수
function goToAnchor(anchorId) {
const $target = $("#" + anchorId);

View File

@@ -1975,9 +1975,9 @@
<div class="content">
<div class="title">
<strong>포토리뷰 상세</strong>
<button class="btn-photoList" onClick="open_layer_popup('photoReviewAll_Popup'); close_layer_popup('photoReviewDetail_Popup', 'toPhotoReviewAll');">포토리뷰 전체보기</button>
<button class="btn-photoList" onClick="open_layer_popup('photoReviewAll_Popup'); close_layer_popup('photoReviewDetail_Popup', '', 'toPhotoReviewAll');">포토리뷰 전체보기</button>
<button class="btn-close" onClick="close_layer_popup('photoReviewDetail_Popup', 'toPhotoReviewAll');"><p>닫기</p></button>
<button class="btn-close" onClick="close_layer_popup('photoReviewDetail_Popup', '', 'toPhotoReviewAll');"><p>닫기</p></button>
</div>
<div class="photoReviewDetailWrap">
@@ -2051,7 +2051,7 @@
<div class="carswBtn">
<div class="oneButton">
<a href="javascript:;" class="cartBtn leftBtn" onClick="javascript:close_layer_popup('photoReviewDetail_Popup', 'toPhotoReviewAll');"><p>닫기</p></a>
<a href="javascript:;" class="cartBtn leftBtn" onClick="javascript:close_layer_popup('photoReviewDetail_Popup', '', 'toPhotoReviewAll');"><p>닫기</p></a>
</div>
</div>
</div>