|
63 | 63 |
|
64 | 64 | mainView.innerHTML = ` |
65 | 65 | <div class="verse-card"> |
66 | | - <h2>${v.book} ${v.reference}</h2> |
67 | | - <p style="font-size:1.4rem; font-style:italic;">"${v.text || ''}"</p> |
| 66 | + <div style="display:flex;justify-content:space-between;align-items:flex-start;gap:8px;flex-wrap:wrap;"> |
| 67 | + <h2 style="margin:0;">${v.book} ${v.reference}</h2> |
| 68 | + <button id="btn-ver-capitulo" style="background:var(--primary);color:white;border:none;border-radius:8px;padding:6px 14px;cursor:pointer;font-size:0.85rem;font-weight:bold;flex-shrink:0;">📖 Ver Capítulo</button> |
| 69 | + </div> |
| 70 | + <p style="font-size:1.4rem; font-style:italic; margin-top:12px;">“${v.text || ''}”</p> |
68 | 71 | ${v.tags && v.tags.length > 0 ? `<div class="verse-tags">${v.tags.map(t => `<span>#${t}</span>`).join('')}</div>` : ''} |
69 | 72 | </div> |
70 | 73 | <div id="v-sections"> |
71 | | - ${v.base_perspectives ? `<h3 class="study-section-title">📚 Estudio Bíblico</h3><div class="perspective-selector" id="b-btns"></div><div id="b-cont" class="perspective-content" style="display:none; border-color:var(--secondary);"></div>` : ''} |
72 | | - <h3 class="study-section-title">✍️ Mis Notas Personales</h3><div class="perspective-selector" id="p-btns"></div><div id="p-cont" class="perspective-content" style="display:none;"></div> |
| 74 | + ${v.base_perspectives ? `<h3 class="study-section-title">📚 Notas de Estudio <span style="font-size:0.75rem;font-weight:400;color:var(--text-muted);">(libro/capítulo)</span></h3><div class="perspective-selector" id="b-btns"></div><div id="b-cont" class="perspective-content" style="display:none; border-color:var(--secondary);"></div>` : ''} |
| 75 | + <h3 class="study-section-title">✍️ Mis Notas Personales <span style="font-size:0.75rem;font-weight:400;color:var(--text-muted);">(este versículo)</span></h3><div class="perspective-selector" id="p-btns"></div><div id="p-cont" class="perspective-content" style="display:none;"></div> |
73 | 76 | ${v.cross_references && v.cross_references.length > 0 ? `<h3 class="study-section-title">🔗 Referencias Cruzadas</h3><div id="cross-ref-list" style="margin-top:8px;"></div>` : ''} |
74 | 77 | </div> |
75 | 78 | `; |
| 79 | + // Botón Ver Capítulo |
| 80 | + const btnVerCap = document.getElementById('btn-ver-capitulo'); |
| 81 | + if (btnVerCap) { |
| 82 | + btnVerCap.onmouseenter = () => btnVerCap.style.opacity = '0.85'; |
| 83 | + btnVerCap.onmouseleave = () => btnVerCap.style.opacity = '1'; |
| 84 | + btnVerCap.onclick = () => { |
| 85 | + const chapNum = parseInt((v.reference || '').split(':')[0]) || parseInt(v.chapter) || 1; |
| 86 | + const allVersesInChap = currentData.filter(x => |
| 87 | + x.type === 'verse' && normalizeBookName(x.book) === normalizeBookName(v.book) && |
| 88 | + (parseInt(x.chapter) === chapNum || parseInt((x.reference||'').split(':')[0]) === chapNum) |
| 89 | + ); |
| 90 | + if (allVersesInChap.length > 0) { |
| 91 | + window.viewReading(`${v.book} ${chapNum}`, allVersesInChap, |
| 92 | + { type: 'chapter', version: v.version, book: v.book, chapter: chapNum.toString() }); |
| 93 | + const verseNum = parseInt((v.reference || '').split(':')[1]) || 1; |
| 94 | + setTimeout(() => window.scrollToVerseAndHighlight(normalizeBookName(v.book), chapNum, verseNum), 200); |
| 95 | + } |
| 96 | + }; |
| 97 | + } |
76 | 98 | setEditor({ type: 'verse', id: v.id }, "Título de mi nota personal..."); |
77 | 99 |
|
78 | 100 | const fill = (data, btnDivId, contDivId, isBase) => { |
|
276 | 298 | const match = refStr.match(/^(.*?)\s+(\d+):(\d+)(?:\s*-\s*\d+)?$/); |
277 | 299 | if (!match) return; |
278 | 300 | window.currentTrackerRef = { book: match[1], chapter: parseInt(match[2]), verse: parseInt(match[3]), version: version || (window.currentTrackerRef && window.currentTrackerRef.version) || null }; |
279 | | - const t = document.getElementById('tracker-ref'); |
280 | | - if (!t) return; |
281 | 301 |
|
282 | 302 | // Calcular límites dinámicos para el libro/capítulo actual |
283 | 303 | const allVerses = currentData.filter(x => x.type === 'verse'); |
|
330 | 350 | trackerBarEl.style.display = 'flex'; |
331 | 351 | } |
332 | 352 | // Limpiar también tracker-ref si existe (por compatibilidad) |
333 | | - const t = document.getElementById('tracker-ref'); |
334 | | - if (t) t.style.display = 'none'; |
| 353 | + const oldT = document.getElementById('tracker-ref'); |
| 354 | + if (oldT) oldT.style.display = 'none'; |
335 | 355 |
|
336 | 356 |
|
337 | 357 | // ── Lógica del autocompletar de Libro ────────────────────────────── |
|
498 | 518 | } |
499 | 519 | let pFiltered = v.perspectives ? Object.entries(v.perspectives).map(([k,val]) => `<b>${k.replace(/_/g,' ').toUpperCase()}:</b><br>${val}`) : []; |
500 | 520 |
|
501 | | - // Construir tooltip: tags + notas únicas + referencias cruzadas con contenido |
| 521 | + // Tooltip: SOLO referencias cruzadas + tags (las notas de estudio son del capítulo, no del versículo) |
502 | 522 | let ttParts = []; |
503 | 523 | if (v.tags?.length) ttParts.push(`<span style="font-size:0.8em;opacity:0.75;">${v.tags.map(t=>'#'+t).join(' ')}</span>`); |
504 | | - if (bFiltered.length) ttParts.push(...bFiltered); |
| 524 | + // Notas personales del versículo (perspectives) sí pueden aparecer en tooltip |
505 | 525 | if (pFiltered.length) ttParts.push(...pFiltered); |
506 | 526 |
|
507 | 527 | // Referencias cruzadas con texto — búsqueda O(1) con el mapa preconstruido |
508 | 528 | if (v.cross_references?.length) { |
509 | 529 | let crHtml = '<b>🔗 REFERENCIAS:</b>'; |
510 | 530 | let lastCrBook = null, lastCrChap = null; |
511 | | - // Limitar a 4 refs en el tooltip para no retrasar el render |
512 | | - v.cross_references.slice(0, 4).forEach(ref => { |
| 531 | + v.cross_references.slice(0, 6).forEach(ref => { |
513 | 532 | const m = ref.trim().match(/^(.+?)\s+(\d+):(\d+)$/); |
514 | 533 | if (!m) return; |
515 | 534 | const found = findVerseByRef(ref); |
|
521 | 540 | } |
522 | 541 |
|
523 | 542 | const tt = ttParts.join('<hr style="margin:4px 0;opacity:0.3;">'); |
524 | | - const hasDot = bFiltered.length > 0 || pFiltered.length > 0; |
525 | | - const hasRef = v.cross_references?.length > 0; |
526 | | - const dot = (hasDot ? `<span class="has-persp-dot base"></span>` : '') + (hasRef ? `<span class="has-persp-dot" style="background:#3498db;width:6px;height:6px;"></span>` : ''); |
| 543 | + const hasDot = pFiltered.length > 0; // nota personal del vers. |
| 544 | + const hasStudy = v.base_perspectives && Object.keys(v.base_perspectives).length > 0; // notas de capítulo |
| 545 | + const hasRef = v.cross_references?.length > 0; // referencias cruzadas |
| 546 | + // ● naranja = notas de estudio (cap/libro) ● verde = nota personal ● azul = ref cruzada |
| 547 | + const dot = (hasStudy ? `<span class="has-persp-dot base" title="Notas de estudio"></span>` : '') |
| 548 | + + (hasDot ? `<span class="has-persp-dot" style="background:#27ae60;width:6px;height:6px;" title="Nota personal"></span>` : '') |
| 549 | + + (hasRef ? `<span class="has-persp-dot" style="background:#3498db;width:6px;height:6px;" title="Referencias cruzadas"></span>` : ''); |
527 | 550 |
|
528 | 551 | let span = document.createElement('span'); |
529 | 552 | span.className = 'verse-text-span'; |
|
0 commit comments