From 6260f99a1bef15aa236d04cc0925beac19824db6 Mon Sep 17 00:00:00 2001 From: uduki Date: Tue, 3 Nov 2026 14:50:41 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=E3=82=B5=E3=82=A4=E3=83=89=E3=83=90?= =?UTF-8?q?=E3=83=BCiframe=E3=81=AE=E9=AB=98=E3=81=95=E8=BF=BD=E5=BE=93?= =?UTF-8?q?=E3=81=8C=E5=88=9D=E5=9B=9E=E5=AE=9F=E8=A1=8C=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=81=9A=E3=82=B3=E3=83=B3=E3=83=86=E3=83=B3=E3=83=84=E3=81=8C?= =?UTF-8?q?=E5=9B=9E=E3=82=8A=E8=BE=BC=E3=82=80=E5=95=8F=E9=A1=8C=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/css/seesaa_neutral_gray.css | 2 +- common/js/wiki_common.js | 23 ++++++++++++++++++++--- common/sidebar.html | 1 + 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/common/css/seesaa_neutral_gray.css b/common/css/seesaa_neutral_gray.css index de37c54..d860358 100644 --- a/common/css/seesaa_neutral_gray.css +++ b/common/css/seesaa_neutral_gray.css @@ -181,7 +181,7 @@ a:hover { width: 100%; height: 100%; flex: 1 1 auto; - min-height: 0; + min-height: 600px; border: none; display: block; } diff --git a/common/js/wiki_common.js b/common/js/wiki_common.js index 7911ae9..128703e 100644 --- a/common/js/wiki_common.js +++ b/common/js/wiki_common.js @@ -753,18 +753,35 @@ document.addEventListener('DOMContentLoaded', () => { try { - const doc = sidebarFrame.contentWindow.document; + const win = sidebarFrame.contentWindow; - sidebarFrame.style.height = doc.body.scrollHeight + 'px'; + const doc = win.document; + + const h = Math.max(doc.body.scrollHeight, doc.documentElement.scrollHeight); + + sidebarFrame.style.height = h + 'px'; } catch (e) { /* クロスオリジン時は無視 */ } }; - sidebarFrame.addEventListener('load', fitSidebar); + // 既に読み込み完了している場合は即実行(load を取り逃がす対策) + const sdoc = sidebarFrame.contentWindow && sidebarFrame.contentWindow.document; + + if (sdoc && sdoc.readyState === 'complete') { + + fitSidebar(); + + } else { + + sidebarFrame.addEventListener('load', fitSidebar); + + } window.addEventListener('resize', fitSidebar); + window.addEventListener('load', fitSidebar); + } }); diff --git a/common/sidebar.html b/common/sidebar.html index 3419284..d7b4cfa 100644 --- a/common/sidebar.html +++ b/common/sidebar.html @@ -16,6 +16,7 @@ padding: 16px 12px; font-size: 13px; overflow-x: hidden; + min-height: 100%; }