"틀:SemanticGraph"의 두 판 사이의 차이
광주문화예술인문스토리플랫폼
| 1번째 줄: | 1번째 줄: | ||
<onlyinclude> | <onlyinclude> | ||
{{#tag:html| | {{#tag:html| | ||
| − | <iframe width="100%" height="640px" style="border:0" src="https://app.vaquitalab.com/aistory/story01?server=tcp:encyves.aks.ac.kr&db=gwangju2025&project=gwangju&key={{{key|}}}"></iframe> | + | <div id="semantic-graph-container"> |
| + | <iframe id="semantic-graph-iframe" width="100%" height="640px" style="border:0" src="https://app.vaquitalab.com/aistory/story01?server=tcp:encyves.aks.ac.kr&db=gwangju2025&project=gwangju&key={{{key|}}}"></iframe> | ||
<br/> | <br/> | ||
<input type="button" value="전체화면" onclick="location.href='https://app.vaquitalab.com/aistory/story01?server=tcp:encyves.aks.ac.kr&db=gwangju2025&project=gwangju&key={{{key}}}'"> | <input type="button" value="전체화면" onclick="location.href='https://app.vaquitalab.com/aistory/story01?server=tcp:encyves.aks.ac.kr&db=gwangju2025&project=gwangju&key={{{key}}}'"> | ||
| + | </div> | ||
| + | <script> | ||
| + | (function() { | ||
| + | var iframe = document.getElementById('semantic-graph-iframe'); | ||
| + | var container = document.getElementById('semantic-graph-container'); | ||
| + | |||
| + | iframe.addEventListener('load', function() { | ||
| + | try { | ||
| + | // iframe 내용 접근 시도 (same-origin인 경우) | ||
| + | var iframeDoc = iframe.contentDocument || iframe.contentWindow.document; | ||
| + | |||
| + | // 404 또는 에러 페이지 체크 | ||
| + | if (iframeDoc.title.includes('404') || | ||
| + | iframeDoc.body.innerHTML.includes('404') || | ||
| + | iframeDoc.body.innerHTML.length < 100) { | ||
| + | hideGraphSection(); | ||
| + | } | ||
| + | } catch(e) { | ||
| + | // Cross-origin인 경우 접근 불가, fetch로 체크 | ||
| + | fetch(iframe.src, {method: 'HEAD'}) | ||
| + | .then(function(response) { | ||
| + | if (!response.ok || response.status === 404) { | ||
| + | hideGraphSection(); | ||
| + | } | ||
| + | }) | ||
| + | .catch(function() { | ||
| + | hideGraphSection(); | ||
| + | }); | ||
| + | } | ||
| + | }); | ||
| + | |||
| + | // 에러 발생 시에도 숨김 | ||
| + | iframe.addEventListener('error', function() { | ||
| + | hideGraphSection(); | ||
| + | }); | ||
| + | |||
| + | function hideGraphSection() { | ||
| + | // iframe이 포함된 p 태그 찾기 | ||
| + | var pTag = container.closest('p'); | ||
| + | if (pTag) { | ||
| + | pTag.style.display = 'none'; | ||
| + | |||
| + | // 이전 형제 요소 중 h2 찾기 | ||
| + | var prevElement = pTag.previousElementSibling; | ||
| + | while (prevElement) { | ||
| + | if (prevElement.tagName === 'H2') { | ||
| + | prevElement.style.display = 'none'; | ||
| + | break; | ||
| + | } | ||
| + | prevElement = prevElement.previousElementSibling; | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | })(); | ||
| + | </script> | ||
}} | }} | ||
</onlyinclude> | </onlyinclude> | ||
| + | |||
==사용방법== | ==사용방법== | ||
2026년 1월 12일 (월) 09:32 판