v0.1.41 theme: 홈/사이드바/추천 모달 동작 정리

Made-with: Cursor
This commit is contained in:
2026-04-16 15:39:45 +09:00
parent b380820bb6
commit 4ca64abfa7
16 changed files with 213 additions and 99 deletions

View File

@@ -153,28 +153,6 @@
syncLeftSidebarState();
var siteMain = document.querySelector(".site-main");
var sidebarNodes = document.querySelectorAll(".sidebar--left, .sidebar--right");
function shouldProxySidebarWheel() {
return !tabletMedia.matches && !!siteMain;
}
sidebarNodes.forEach(function (sidebar) {
sidebar.addEventListener("wheel", function (event) {
if (!shouldProxySidebarWheel()) {
return;
}
event.preventDefault();
siteMain.scrollBy({
top: event.deltaY,
left: 0,
behavior: "auto"
});
}, { passive: false });
});
var tabRoot = document.querySelector("[data-tabs]");
if (tabRoot) {
var triggers = tabRoot.querySelectorAll("[data-tab-trigger]");
@@ -371,6 +349,64 @@
syncUserMenuToggles();
var recommendationsPortalTrigger = document.querySelector("[data-portal='recommendations']");
var recommendationsPortalTitle = recommendationsPortalTrigger ? recommendationsPortalTrigger.getAttribute("data-portal-title") : "";
var recommendationsPortalDescription = recommendationsPortalTrigger ? recommendationsPortalTrigger.getAttribute("data-portal-description") : "";
function getPortalDocuments() {
var docs = [document];
document.querySelectorAll("iframe").forEach(function (frame) {
try {
if (frame.contentDocument) {
docs.push(frame.contentDocument);
}
} catch (error) {}
});
return docs;
}
function applyRecommendationsPortalCopy() {
if (!recommendationsPortalTitle && !recommendationsPortalDescription) {
return false;
}
var hasPatched = false;
getPortalDocuments().forEach(function (docRoot) {
var portalTitle = docRoot.querySelector(".gh-portal-main-title");
var portalDescription = docRoot.querySelector(".gh-portal-recommendations-description");
if (portalTitle && recommendationsPortalTitle) {
portalTitle.textContent = recommendationsPortalTitle;
hasPatched = true;
}
if (portalDescription && recommendationsPortalDescription) {
portalDescription.textContent = recommendationsPortalDescription;
hasPatched = true;
}
});
return hasPatched;
}
if (recommendationsPortalTrigger && (recommendationsPortalTitle || recommendationsPortalDescription)) {
recommendationsPortalTrigger.addEventListener("click", function () {
applyRecommendationsPortalCopy();
var attempts = 0;
var maxAttempts = 20;
var retryTimer = window.setInterval(function () {
attempts += 1;
var done = applyRecommendationsPortalCopy();
if (done || attempts >= maxAttempts) {
window.clearInterval(retryTimer);
}
}, 100);
});
}
function updateLoadMoreState(pagination, nextUrl, loading) {
var trigger = pagination.querySelector("[data-load-more-trigger]");
if (!trigger) {