Changeset f1627b6 in Klonkt for src/views/pages/news.ejs
- Timestamp:
- 06/28/2026 02:40:46 PM (2 months ago)
- Branches:
- main
- Children:
- 127f87e
- Parents:
- fe9164f
- File:
-
- 1 edited
-
src/views/pages/news.ejs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/views/pages/news.ejs
rfe9164f rf1627b6 174 174 .tl-content a { color: var(--accent, #06c); } 175 175 .tl-content img { max-width: 100%; height: auto; border-radius: 10px; background: #fff; } 176 /* Long posts collapse to a max height with a fade + "read more" (added by JS only when it overflows). */ 177 .tl-content.tl-clamp { max-height: 20em; overflow: hidden; 178 -webkit-mask-image: linear-gradient(180deg, #000 72%, transparent); 179 mask-image: linear-gradient(180deg, #000 72%, transparent); } 180 .tl-readmore { display: inline-block; margin: .15rem 0 .1rem; padding: .15rem 0; 181 background: none; border: 0; color: var(--accent, #06c); font: inherit; font-weight: 600; 182 font-size: .85rem; cursor: pointer; } 183 .tl-readmore:hover { text-decoration: underline; } 176 184 177 185 /* Always show the FULL image at its natural ratio — never cropped, no letterbox. */ … … 267 275 })(); 268 276 </script> 277 278 <script> 279 // Collapse long post bodies to a max height with a "read more" toggle — only when the content 280 // actually overflows. Runs on every /news render (full load + htmx swap); a per-element flag 281 // prevents double-wiring. 282 (function(){ 283 var RM = '<%= t("tl.read_more") %>', SL = '<%= t("tl.show_less") %>'; 284 document.querySelectorAll('.tl-content:not(.nsfw-media):not([data-rm])').forEach(function(c){ 285 c.setAttribute('data-rm', '1'); 286 if (c.scrollHeight > 360) { 287 c.classList.add('tl-clamp'); 288 var b = document.createElement('button'); 289 b.type = 'button'; b.className = 'tl-readmore'; b.textContent = RM; 290 b.addEventListener('click', function(){ 291 b.textContent = c.classList.toggle('tl-clamp') ? RM : SL; 292 }); 293 c.insertAdjacentElement('afterend', b); 294 } 295 }); 296 })(); 297 </script>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)