<!DOCTYPE html>
<html>
<head>
    <title>API文档</title>
</head>
<body>
<iframe id="swaggerFrame" src="/swagger-ui/index.html"
        style="width: 100%; height: 100vh; border: none;"></iframe>

<script>
    // 等待iframe加载完成后修改其内容
    document.getElementById('swaggerFrame').onload = function() {
        const iframe = this;
        const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;

        // 创建style元素并注入到iframe中
        const style = iframeDoc.createElement('style');
        style.innerHTML = `
        /* 隐藏顶部栏 */
        .topbar {
            display: none !important;
            height: 0 !important;
            padding: 0 !important;
            margin: 0 !important;
        }
    `;

        // 将样式添加到iframe的head中
        iframeDoc.head.appendChild(style);

        // 额外的DOM操作确保隐藏
        setTimeout(() => {
            const topbar = iframeDoc.querySelector('.topbar');
            if (topbar) topbar.style.display = 'none';

            // const info = iframeDoc.querySelector('.swagger-ui .info');
            // if (info) info.style.display = 'none';
        }, 1000);
    };
</script>
</body>
</html>