feat(backend,site): NOL 수집 및 숙박 안내 구조화와 지역 콘텐츠 연동

수집한 객실·이용 정보가 발행 화면에 연결되지 않던 경로를 보완하고, 숙소 소개와 지역 맛집 표시를 개선한다.

- NOL 브라우저 수집 어댑터와 수집·반영 스크립트 추가
- 크롤링 fact 즉시 노출 및 직접 입력·정정값 보호
- 이용안내 항목별 구조화와 기존 표 연결, 원문 UI 비표시
- 군산 한일옥 고정 등록과 지역 맛집 탐색·보강 경로 추가
- 숙소 소개 요약, 히어로 문구, 지역 콘텐츠·목업 표시 개선

검증: 작업 트리 기준 site 타입·린트·빌드 및 안내 렌더링 테스트 통과, PC·모바일 화면 확인. 스테이징 diff 공백 검사 통과. 사용자 요청에 따라 현재 스테이징된 55개 파일만 포함하며 미스테이징 문서·테스트 등은 제외.
This commit is contained in:
skkim committed 2026-09-14 19:40:04 +09:00
1 parent 67a1db3cb9
commit a093921b62
55 files changed
+2325 -269

No files matched your search

+53 -79
View File
@@ -43,57 +43,62 @@
var items = catchphrases();
if (items.length === 0) return;
/* ★ 대표 문구는 고정이고, 순환은 그 **아래 줄**에서 돈다 (2026-09-11 사장님 지시:
"메인 모토는 고정으로 하고, 그 아래 계속 변동되는 모토가 돌아가는 방향").
예전에는 대표 문구 자리를 통째로 갈아 끼워 "히로쓰 가옥 담 너머…" 가 5초 뒤 사라졌다 —
숙소 이름 다음으로 남아야 할 한 줄이 첫 화면에서 지워지는 셈이었다. */
var base = ((P.narrative && P.narrative.tagline) || '').trim();
var node = null;
var last = null;
/* ★ 노드를 들고 있지 않고 매번 찾는다.
/* ★ 노드를 들고 있지 않고 매번 확인한다.
이 목업은 payload 를 손으로 고친 것이라 구워진 마크업과 어긋나고, React 는 하이드레이션에
실패하면 #root 를 **통째로 다시 그린다** — 그때 히어로의 <p> 가 새 노드로 바뀐다.
한 번 잡아 둔 참조로 계속 쓰면 그 순간부터 아무 일도 안 일어나면서 오류도 안 난다. */
function findNode() {
var wanted = [base];
if (last) wanted.push(last);
실패하면 #root 를 **통째로 다시 그린다** — 대표 문구 <p> 가 새 노드로 바뀌고 그 아래 붙여 둔
줄은 같이 사라진다. 한 번 잡아 둔 참조로 계속 쓰면 그 순간부터 아무 일도 안 일어나면서 오류도 안 난다. */
function findTagline() {
var candidates = document.querySelectorAll('#root p');
for (var i = 0; i < candidates.length; i += 1) {
if (wanted.indexOf(candidates[i].textContent.trim()) >= 0) return candidates[i];
if (candidates[i].textContent.trim() === base) return candidates[i];
}
return null;
}
if (!findNode()) return;
function ensureNode() {
if (node && node.isConnected) return node;
var tagline = findTagline();
if (!tagline) return null;
node = document.createElement('p');
node.id = 'w4d-sub';
node.className = 'w4d-sub measure';
tagline.insertAdjacentElement('afterend', node);
reserve();
return node;
}
if (!base || !findTagline()) return;
/* 줄 높이를 **가장 긴 문구**에 맞춰 박는다. 히어로는 아래 정렬이라 이 줄이 한 줄↔두 줄을 오가면
숙소 이름과 대표 문구가 통째로 위아래로 튄다. 지금 폭에서 문구를 다 재 보고 가장 높은 값을 쓴다. */
function reserve() {
var width = node.getBoundingClientRect().width;
if (!width) return;
var probe = node.cloneNode(false);
probe.removeAttribute('id');
probe.style.cssText = 'position:absolute;visibility:hidden;pointer-events:none;width:' + width + 'px';
node.parentNode.appendChild(probe);
var max = 0;
items.forEach(function (it) {
probe.textContent = it.text;
max = Math.max(max, probe.getBoundingClientRect().height);
});
probe.remove();
node.style.minHeight = Math.ceil(max) + 'px';
}
var resizeTimer = null;
window.addEventListener('resize', function () {
window.clearTimeout(resizeTimer);
resizeTimer = window.setTimeout(function () { if (node && node.isConnected) reserve(); }, 200);
});
var byKind = function (kind) {
return items.filter(function (it) { return it.kind === kind; });
};
var weather = null; // 못 받아 오면 날씨 문장은 아예 순환에 넣지 않는다.
var bag = [];
var cycle = [];
function nextGeneral() {
if (bag.length === 0) {
bag = byKind('general').slice();
for (var j = bag.length - 1; j > 0; j -= 1) {
var k = Math.floor(Math.random() * (j + 1));
var t = bag[j]; bag[j] = bag[k]; bag[k] = t;
}
}
return bag.pop();
}
function buildCycle() {
var now = new Date();
var month = now.getMonth() + 1;
var season = SEASON_OF_MONTH[month - 1];
var out = [nextGeneral()];
out.push(pick(byKind('season').filter(function (it) { return it.season === season; })));
out.push(nextGeneral());
out.push(pick(byKind('month').filter(function (it) { return it.month === month; })));
out.push(nextGeneral());
if (weather) {
out.push(pick(byKind('weather').filter(function (it) { return it.weather === weather; })));
}
return out.filter(Boolean);
}
function buildCycle() { return items.filter(function (item) { return item.kind === "general"; }); }
/* 문장 하나를 단어 칸으로 조립한다. innerHTML 을 안 쓰는 이유는 문구가 데이터라서다 —
지금은 우리가 쓴 문장이지만, 이 자리는 나중에 서버가 채운다. */
@@ -118,63 +123,32 @@
}
function show(text) {
last = text;
var fresh = !(node && node.isConnected);
if (!ensureNode()) return;
if (REDUCED) { node.textContent = text; return; }
var current = node.firstElementChild;
if (current && current.classList.contains('w4d-line')) {
current.classList.remove('w4d-line--in');
current.classList.add('w4d-line--out');
}
// 새로 붙인 줄은 비어 있으니 나갈 문장이 없다 — 기다리지 않고 바로 세운다.
window.setTimeout(function () {
if (!node || !node.isConnected) node = findNode();
if (!node) return;
if (!ensureNode()) return;
paint(text);
}, 300);
}, fresh ? 0 : 300);
}
function tick() {
if (!node || !node.isConnected) node = findNode();
if (!node) return;
if (cycle.length === 0) cycle = buildCycle();
var next = cycle.shift();
if (next && next.text) show(next.text);
}
/* 날씨는 렌더러가 쓰는 그 엔드포인트로 받는다(같은 오리진). 실패하면 조용히 넘어간다 —
날씨 문장 몇 개 때문에 순환이 멈추면 안 된다. */
function refreshWeather() {
var place = P.place || {};
if (!place.regionCode || place.latitude == null) return;
var query = 'region_code=' + encodeURIComponent(place.regionCode) +
'&latitude=' + place.latitude + '&longitude=' + place.longitude;
fetch('/v1/local/weather?' + query)
.then(function (r) { return r.ok ? r.json() : null; })
.then(function (body) {
if (!body || !body.weather) return;
var code = Number(body.weather.weather_code);
// 렌더러(use-live-weather.ts)와 같은 분류를 쓴다 — 갈리면 화면의 날씨와 문장이 어긋난다.
weather = code === 0 ? '맑음'
: code >= 1 && code <= 3 ? '구름많음'
: code >= 50 && code <= 69 ? '비'
: code >= 70 && code <= 79 ? '눈' : '흐림';
})
.catch(function () { /* 구운 값 그대로 둔다 */ });
}
refreshWeather();
window.setInterval(refreshWeather, 10 * 60 * 1000);
// 구워진 줄 높이를 하한으로 박는다 — 문장이 짧아 한 줄이 되면 아래 단추가 위로 튄다.
(function reserve() {
var found = findNode();
if (!found) return;
var h = found.getBoundingClientRect().height;
if (h > 0) found.style.minHeight = Math.ceil(h) + 'px';
})();
// 첫 문장은 구워진 그대로 5초 두고 시작한다 — 들어오자마자 글자가 바뀌면 읽던 것을 놓친다.
// 대표 문구가 먼저 읽히고 나서 아래 줄이 선다 — 둘이 한꺼번에 뜨면 어느 쪽이 숙소의 한 줄인지 안 읽힌다.
window.setTimeout(function () {
tick();
window.setInterval(tick, 7000);
}, 5000);
window.setInterval(function () { if (!document.hidden && !REDUCED) tick(); }, 6000);
}, 1200);
}
/* ══ ② 헤더 안 미니 플레이어 ═══════════════════════════════════════════════