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%; }