|
3139 | 3139 | var chapterId = currentChapter || ''; |
3140 | 3140 |
|
3141 | 3141 | var rawEntries = verseDiscovery[ref] || []; |
3142 | | - // Filter out chapter-level noise; dedupe by source doc + paragraph |
3143 | | - var entries = dedupeVerseDiscoveryEntries(rawEntries.filter(function(e) { |
| 3142 | + var entries = semanticDedupeVerseDiscoveryEntries(dedupeVerseDiscoveryEntries(rawEntries.filter(function(e) { |
3144 | 3143 | return !discIsRepeat(e.source_text); |
3145 | | - })); |
| 3144 | + }))); |
3146 | 3145 |
|
3147 | | - // Donaldson notes for this verse |
3148 | 3146 | var donaEntry = (donaldsonNotes[chapterId] && donaldsonNotes[chapterId][vnum]) || {}; |
3149 | 3147 | var donaWordsRaw = donaEntry.words || []; |
3150 | 3148 | var donaNotes = donaEntry.notes || []; |
3151 | 3149 | var donaQuotes = donaEntry.quotes || []; |
3152 | 3150 |
|
3153 | | - // ── Verse text header ── |
3154 | 3151 | var verseEl = document.getElementById('v' + vnum); |
3155 | 3152 | var verseText = verseEl ? (verseEl.querySelector('.verse-text') || verseEl).textContent.trim() : ''; |
3156 | 3153 | var donaWords = filterDonaWordsForVerse(donaWordsRaw, verseText); |
3157 | 3154 |
|
| 3155 | + ensureChapterKeywordRegistry(chapterId); |
| 3156 | + var strongsEntries = (strongsIndexCache[chapterId] || {})[vnum] || []; |
| 3157 | + var mergedKw = mergeKeyWordsForVerse(donaWords, strongsEntries, verseText, chapterId); |
| 3158 | + registerChapterKeywordHeadwords(mergedKw, verseText); |
| 3159 | + |
3158 | 3160 | var chW = document.getElementById('ch-word'); |
3159 | 3161 | chW.textContent = ref; |
3160 | 3162 | chW.style.display = 'block'; |
| 3163 | + var entsInline = verseText ? scanVerseEntities(verseText) : { persons: [], places: [], things: [] }; |
| 3164 | + var showedEntityChips = !!(entsInline.persons.length || entsInline.places.length || entsInline.things.length); |
| 3165 | + |
3161 | 3166 | var html = ''; |
3162 | 3167 | html += '<div class="panel-header">' |
3163 | 3168 | + '<div class="panel-verse-ref">' + escapeHtml(ref) + '</div>' |
3164 | | - + (verseText ? '<div class="panel-verse-text">' + escapeHtml(verseText) + '</div>' : '') |
3165 | | - + '</div>'; |
3166 | | - |
3167 | | - // ── People · Places · Things in this verse ── |
3168 | | - var showedEntityChips = false; |
3169 | | - if (verseText) { |
3170 | | - var ents = scanVerseEntities(verseText); |
3171 | | - if (ents.persons.length || ents.places.length || ents.things.length) { |
3172 | | - showedEntityChips = true; |
3173 | | - html += '<div class="panel-section">People · Places · Things</div>'; |
3174 | | - html += renderChips(ents.persons, 'person'); |
3175 | | - html += renderChips(ents.places, 'place'); |
3176 | | - html += renderChips(ents.things, 'thing'); |
3177 | | - } |
3178 | | - } |
3179 | | - |
3180 | | - // ── Key words: Donaldson + Strong's (merged, deduped; Strong's numbers never shown) ── |
3181 | | - var strongsEntries = (strongsIndexCache[chapterId] || {})[vnum] || []; |
3182 | | - var mergedKw = mergeKeyWordsForVerse(donaWords, strongsEntries, verseText); |
3183 | | - var showedKeyWords = mergedKw.length > 0; |
3184 | | - if (showedKeyWords) { |
3185 | | - html += '<div class="panel-section">Key words</div>'; |
3186 | | - html += '<div class="word-cards-wrap' + (mergedKw.length <= 2 ? ' expanded' : '') + '">'; |
3187 | | - mergedKw.forEach(function(item) { |
3188 | | - if (item.kind === 'dona') html += htmlKeyWordCardDona(item.w, verseText); |
3189 | | - else html += htmlKeyWordCardStrongs(item.entry, verseText); |
3190 | | - }); |
3191 | | - if (mergedKw.length > 2) { |
3192 | | - var extraK = mergedKw.length - 2; |
3193 | | - html += '<button class="word-more-btn" onclick="expandWordCards(this)">Show ' + extraK + ' more word' + (extraK > 1 ? 's' : '') + ' \u2192</button>'; |
3194 | | - } |
3195 | | - html += '</div>'; |
3196 | | - } |
| 3169 | + + (verseText ? '<div class="panel-verse-text">' + escapeHtml(verseText) + '</div>' : ''); |
| 3170 | + if (showedEntityChips) html += renderVersePanelEntityChips(entsInline); |
| 3171 | + html += '</div>'; |
3197 | 3172 |
|
3198 | 3173 | var scriptureEdgesEarly = chapterGraphEchoes(chapterId, vnum); |
| 3174 | + var cm = chapterMeta[chapterId] || {}; |
| 3175 | + var donaldsonWorkLine = (cm.book ? cm.book + ' · ' : '') + 'Commentary'; |
3199 | 3176 |
|
3200 | | - // ── Commentary: Donaldson notes + attributed quotes + cross-tradition voices (unified) ── |
3201 | 3177 | var spoonNotes = (donaEntry.spoon && donaEntry.spoon.notes) || []; |
3202 | 3178 | var allCommentary = []; |
3203 | 3179 | donaNotes.forEach(function(para, i) { |
3204 | 3180 | var paraText = (typeof para === 'string') ? para : (para.text || ''); |
3205 | 3181 | allCommentary.push({ |
3206 | | - author: 'Lee Donaldson', work: 'New Testament Commentary', |
| 3182 | + author: 'Lee Donaldson', work: donaldsonWorkLine, |
3207 | 3183 | text: (spoonNotes[i]) || paraText, badge: 'Commentary', badgeClass: '' |
3208 | 3184 | }); |
3209 | 3185 | }); |
|
3226 | 3202 | }); |
3227 | 3203 | if (allCommentary.length) { |
3228 | 3204 | html += '<div class="panel-section">Commentary</div>'; |
3229 | | - html += '<div class="verse-panel-cards' + (allCommentary.length <= 3 ? ' expanded' : '') + '">'; |
| 3205 | + html += '<div class="verse-panel-cards' + (allCommentary.length <= 5 ? ' expanded' : '') + '">'; |
3230 | 3206 | allCommentary.forEach(function(c) { |
3231 | 3207 | html += '<div class="comm-card' + (c.hasLink ? ' has-link' : '') + '"' |
3232 | 3208 | + (c.entryIdx != null ? ' data-idx="' + c.entryIdx + '"' : '') + '>' |
|
3235 | 3211 | + (c.work ? '<div class="comm-work">' + escapeHtml(c.work) + '</div>' : '') |
3236 | 3212 | + '<div class="comm-text">' + escapeHtml(c.text || '') + '</div></div>'; |
3237 | 3213 | }); |
3238 | | - if (allCommentary.length > 3) { |
3239 | | - html += '<button type="button" class="word-more-btn" onclick="expandWordCards(this)">Show ' + (allCommentary.length - 3) + ' more \u2192</button>'; |
| 3214 | + if (allCommentary.length > 5) { |
| 3215 | + html += '<button type="button" class="word-more-btn" onclick="expandWordCards(this)">Show ' + (allCommentary.length - 5) + ' more \u2192</button>'; |
3240 | 3216 | } |
3241 | 3217 | html += '</div>'; |
3242 | 3218 | } |
3243 | 3219 |
|
3244 | | - // ── Scripture echoes from chapter graph (same cap + expand as commentary) ── |
| 3220 | + var showedKeyWords = mergedKw.length > 0; |
| 3221 | + if (showedKeyWords) { |
| 3222 | + html += '<div class="panel-section">Key words</div>'; |
| 3223 | + html += '<div class="word-cards-wrap expanded">'; |
| 3224 | + mergedKw.forEach(function(item) { |
| 3225 | + if (item.kind === 'dona') html += htmlKeyWordCardDona(item.w, verseText); |
| 3226 | + else html += htmlKeyWordCardStrongs(item.entry, verseText); |
| 3227 | + }); |
| 3228 | + html += '</div>'; |
| 3229 | + } |
| 3230 | + |
3245 | 3231 | var scriptureEdges = scriptureEdgesEarly; |
3246 | 3232 | if (scriptureEdges.length) { |
3247 | 3233 | html += '<div class="panel-section">Cross References</div>'; |
3248 | | - html += '<div class="verse-panel-cards' + (scriptureEdges.length <= 3 ? ' expanded' : '') + '">'; |
| 3234 | + html += '<div class="verse-panel-cards verse-panel-cards--scrip' + (scriptureEdges.length <= 4 ? ' expanded' : '') + '">'; |
3249 | 3235 | scriptureEdges.forEach(function(s) { |
3250 | 3236 | var jr = parseVerseRefForStudy(s.ref); |
3251 | 3237 | html += '<div class="scrip-card' + (jr && chapterMeta[jr.chapterId] ? ' scrip-card--jump' : '') + '"' |
|
3257 | 3243 | + '<div class="scrip-text">' + escapeHtml(s.text) + '</div>' |
3258 | 3244 | + '</div>'; |
3259 | 3245 | }); |
3260 | | - if (scriptureEdges.length > 3) { |
3261 | | - html += '<button type="button" class="word-more-btn" onclick="expandWordCards(this)">Show ' + (scriptureEdges.length - 3) + ' more \u2192</button>'; |
| 3246 | + if (scriptureEdges.length > 4) { |
| 3247 | + html += '<button type="button" class="word-more-btn" onclick="expandWordCards(this)">Show ' + (scriptureEdges.length - 4) + ' more \u2192</button>'; |
3262 | 3248 | } |
3263 | 3249 | html += '</div>'; |
3264 | 3250 | } |
|
3276 | 3262 | panelBody.querySelectorAll('.comm-card.has-link').forEach(function(row) { |
3277 | 3263 | row.addEventListener('click', function() { |
3278 | 3264 | var e = entries[parseInt(row.dataset.idx, 10)]; |
| 3265 | + if (!e) return; |
3279 | 3266 | var meta = sourceMeta[e.source_doc_id]; |
3280 | 3267 | if (meta) { |
3281 | 3268 | loadSourceDocument(e.source_doc_id, meta.href, { focusPara: e.source_para }); |
|
0 commit comments