72 lines
2.0 KiB
HTML
72 lines
2.0 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script>
|
|
</head>
|
|
<body>
|
|
<rapi-doc
|
|
id="doc"
|
|
spec-url="/docs?api-docs.json"
|
|
render-style="focused"
|
|
theme="light"
|
|
show-method-in-nav-bar="as-colored-block"
|
|
show-header="false"
|
|
show-info="true"
|
|
show-components="true"
|
|
show-try="true"
|
|
show-path-in-nav-bar="true"
|
|
bg-color="#f8f9fa"
|
|
primary-color="#206a9e"
|
|
nav-bg-color="#2d3e50"
|
|
nav-text-color="#f5f5f5"
|
|
nav-hover-bg-color="#496080"
|
|
nav-active-bg-color="#206a9e"
|
|
nav-item-spacing="compact"
|
|
font-size="small"
|
|
default-schema-tab="example"
|
|
style="width:100vw; height:100vh;"
|
|
></rapi-doc>
|
|
|
|
<script type="module">
|
|
const doc = document.getElementById('doc');
|
|
|
|
// 스펙이 로드되어 컴포넌트 내부가 그려진 뒤 실행
|
|
doc.addEventListener('spec-loaded', () => {
|
|
const root = doc.shadowRoot;
|
|
if (!root) return;
|
|
|
|
// 1) collapse-all 버튼이 있으면 클릭
|
|
const collapseBtn =
|
|
root.querySelector('[data-action="collapse-all"]') ||
|
|
root.querySelector('[title="Collapse all"]') ||
|
|
root.querySelector('.collapse-all');
|
|
|
|
if (collapseBtn) {
|
|
collapseBtn.click();
|
|
return;
|
|
}
|
|
|
|
// 2) 버튼이 없으면 펼쳐진 섹션 헤더들을 클릭해서 접기 (폴백)
|
|
const selectors = [
|
|
'[expanded] .tag-head',
|
|
'.tag.is-expanded .tag-head',
|
|
'[expanded] .section-endpoint-head',
|
|
'.section.is-expanded .section-endpoint-head',
|
|
'[aria-expanded="true"] .tag-head'
|
|
];
|
|
|
|
const collapseAll = () => {
|
|
selectors.forEach(sel => {
|
|
root.querySelectorAll(sel).forEach(el => el.click());
|
|
});
|
|
};
|
|
|
|
collapseAll();
|
|
// 느린 렌더 케이스 대비, 살짝 늦게 한 번 더
|
|
setTimeout(collapseAll, 200);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|