Changes for page 学校ページ テンプレート
Last modified by Super Admin on 2026/04/05 18:59
From version
56.1
edited by Super Admin
on 2026/03/15 16:10
on 2026/03/15 16:10
Change comment:
There is no comment for this version
To version
59.1
edited by Super Admin
on 2026/03/17 14:19
on 2026/03/17 14:19
Change comment:
There is no comment for this version
Summary
Details
- Page properties
-
- Content
-
... ... @@ -1003,6 +1003,25 @@ 1003 1003 window.history.replaceState({}, document.title, window.location.pathname); 1004 1004 } 1005 1005 } 1006 + // 長文投稿の折りたたみ初期化 1007 + document.querySelectorAll('.thread-post-body').forEach(function(body) { 1008 + // 先にtruncatedを仮適用してline-clampを有効にし、高さの差分で判定 1009 + var fullH = body.scrollHeight; 1010 + body.classList.add('truncated'); 1011 + var clampedH = body.clientHeight; 1012 + body.classList.remove('truncated'); 1013 + if (fullH > clampedH + 10) { 1014 + body.classList.add('truncated'); 1015 + var btn = document.createElement('button'); 1016 + btn.className = 'btn-read-more'; 1017 + btn.textContent = '広げて読む ▼'; 1018 + btn.addEventListener('click', function() { 1019 + var isExpanded = body.classList.toggle('expanded'); 1020 + btn.textContent = isExpanded ? '折りたたむ ▲' : '広げて読む ▼'; 1021 + }); 1022 + body.parentNode.insertBefore(btn, body.nextSibling); 1023 + } 1024 + }); 1006 1006 }); 1007 1007 1008 1008 // トースト通知表示