diff --git a/kjvstudy_org/routes/bible.py b/kjvstudy_org/routes/bible.py index e26d36a..f46073d 100644 --- a/kjvstudy_org/routes/bible.py +++ b/kjvstudy_org/routes/bible.py @@ -218,11 +218,13 @@ async def read_chapter(request: Request, book: str, chapter: int): # Add cross-references with cooldown to prevent margin overload cross_refs = get_cross_references(book, chapter, verse.verse) - # Skip if within cooldown period (show condensed count instead) + # If within cooldown period, keep collapsed; otherwise auto-expand if cross_refs and verse.verse - last_xref_verse < xref_cooldown: - commentary['cross_reference_groups'] = [] - commentary['cross_ref_count'] = len(cross_refs) # Just show "+N refs" + commentary['xref_auto_expand'] = False # Stay collapsed elif cross_refs: + commentary['xref_auto_expand'] = True # Auto-expand when there's room + + if cross_refs: # Group cross-references by their description/note grouped_refs = defaultdict(list) for ref in cross_refs: diff --git a/kjvstudy_org/templates/chapter.html b/kjvstudy_org/templates/chapter.html index 52acdc5..be3591b 100644 --- a/kjvstudy_org/templates/chapter.html +++ b/kjvstudy_org/templates/chapter.html @@ -469,11 +469,7 @@ document.body.dataset.resourceReader = 'false'; {% set hidden_count = total_refs - preview_count %} - {% for group in commentary.cross_reference_groups[:3] %}{{ group.description }}: {{ group.refs[0].text }}{% if group.refs|length > 1 %}{% if hidden_count >= 3 %}; {% for ref in group.refs[1:] %}{{ ref.text }}{% if not loop.last %}; {% endif %}{% endfor %}{% else %}; {% for ref in group.refs[1:] %}{{ ref.text }}{% if not loop.last %}; {% endif %}{% endfor %}{% endif %}{% endif %}{% if not loop.last %}. {% endif %}{% endfor %}{% if commentary.cross_reference_groups|length > 3 %}{% if hidden_count >= 3 %}. {% for group in commentary.cross_reference_groups[3:] %}{{ group.description }}: {% for ref in group.refs %}{{ ref.text }}{% if not loop.last %}; {% endif %}{% endfor %}{% if not loop.last %}. {% endif %}{% endfor %}{% else %}. {% for group in commentary.cross_reference_groups[3:] %}{{ group.description }}: {% for ref in group.refs %}{{ ref.text }}{% if not loop.last %}; {% endif %}{% endfor %}{% if not loop.last %}. {% endif %}{% endfor %}{% endif %}{% endif %}{% if hidden_count >= 3 %} +{{ hidden_count }}{% endif %} - {% elif commentary.cross_ref_count %} - - - +{{ commentary.cross_ref_count }} refs + {% for group in commentary.cross_reference_groups[:3] %}{{ group.description }}: {{ group.refs[0].text }}{% if group.refs|length > 1 %}{% if hidden_count >= 3 %}; {% for ref in group.refs[1:] %}{{ ref.text }}{% if not loop.last %}; {% endif %}{% endfor %}{% else %}; {% for ref in group.refs[1:] %}{{ ref.text }}{% if not loop.last %}; {% endif %}{% endfor %}{% endif %}{% endif %}{% if not loop.last %}. {% endif %}{% endfor %}{% if commentary.cross_reference_groups|length > 3 %}{% if hidden_count >= 3 %}. {% for group in commentary.cross_reference_groups[3:] %}{{ group.description }}: {% for ref in group.refs %}{{ ref.text }}{% if not loop.last %}; {% endif %}{% endfor %}{% if not loop.last %}. {% endif %}{% endfor %}{% else %}. {% for group in commentary.cross_reference_groups[3:] %}{{ group.description }}: {% for ref in group.refs %}{{ ref.text }}{% if not loop.last %}; {% endif %}{% endfor %}{% if not loop.last %}. {% endif %}{% endfor %}{% endif %}{% endif %}{% if hidden_count >= 3 %} +{{ hidden_count }}{% endif %} {% endif %} {% endif %}