fix: [show tracker] add btn to hide/show long rule

This commit is contained in:
terrtia 2025-01-31 15:50:45 +01:00
parent 63be1f3d0f
commit f300c967fe
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0

View file

@ -447,12 +447,13 @@
const lineHeight = parseFloat(window.getComputedStyle(textElement).lineHeight);
var maxLines = 30;
const maxHeight = lineHeight * maxLines;
// Apply initial truncation
textElement.style.maxHeight = maxHeight + 'px';
if (textElement.getBoundingClientRect().height < maxHeight) {
textElement.style.maxHeight = '100%'
btn_read_more.hide();
} else {
// Apply initial truncation
textElement.style.maxHeight = maxHeight + 'px';
btn_read_more.on("click", function() {
if (btn_read_more.text() === "Show more") {
textElement.style.maxHeight = 'none';