From 2be940db1c4adfcd084dc51a1e0ffdfc3849fca3 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sat, 6 Dec 2025 17:20:46 -0500 Subject: [PATCH] Skip duplicate verse text in Listen button audio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When reading commentary, skip the first paragraph if it contains the verse text (which is commonly quoted at the start of analysis). This prevents reading the verse twice. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- kjvstudy_org/templates/verse.html | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/kjvstudy_org/templates/verse.html b/kjvstudy_org/templates/verse.html index 50497bc..e6d1a5c 100644 --- a/kjvstudy_org/templates/verse.html +++ b/kjvstudy_org/templates/verse.html @@ -1539,11 +1539,21 @@ a.crossref-pill:hover { } // Collect verse text and commentary var parts = []; - var verseText = document.querySelector('.verse-text'); - if (verseText) parts.push(verseText.textContent.trim()); - // Add commentary sections - document.querySelectorAll('.commentary-section p, .commentary-section li').forEach(function(el) { - parts.push(el.textContent.trim()); + var verseEl = document.querySelector('.verse-text'); + var verseText = verseEl ? verseEl.textContent.trim() : ''; + if (verseText) parts.push(verseText); + // Add commentary sections, skipping first paragraph if it contains the verse text + var commentaryEls = document.querySelectorAll('.commentary-section p, .commentary-section li'); + var isFirst = true; + commentaryEls.forEach(function(el) { + var elText = el.textContent.trim(); + // Skip first paragraph if it starts with the verse text (common pattern) + if (isFirst && el.tagName === 'P' && verseText && elText.substring(0, 50).includes(verseText.substring(0, 50))) { + isFirst = false; + return; + } + isFirst = false; + parts.push(elText); }); var text = parts.join(' '); if (window.KJVSpeech && text) {