Púlpito-RdE
REVELACIÓN DEL ESPÍRITU

Un espacio dedicado al estudio de la Palabra y a la preparación de mensajes.

Puedes usar tu Biblia o versión preferida física (opcional).
Emblema RδE
Púlpito-RdE
REVELACIÓN DEL ESPÍRITU
Estudia el texto bíblico, organiza tus ideas y prepara mensajes claros y fieles a las Escrituras.
RδE — Tu espacio personal de estudio bíblico

Preparar mensaje

Leer Biblia

TIEMPO DEL MENSAJE
00:00:00
`); ventana.document.close(); setTimeout(()=>ventana.print(),500); } function generarPDF(opcion){ if(opcion==='2'){ const usarAndroid=window.AndroidPrint && typeof window.AndroidPrint.savePdfSections==='function'; if(!$('outline').innerHTML)build(); if(!hasSermon()&&!$('topic').value.trim()){ alert('Primero prepara un bosquejo.'); return; } let d=data(); let labels=['Gancho inicial','Introducción','Proposición central']; for(let i=1;i<=+d.points;i++)labels.push('Punto principal '+i); labels.push('Aplicación','Conclusión'); let partes=[ 'TEMA Y TEXTO BÍBLICO\u001f'+ (d.topic||'Mi mensaje')+'\n'+ (d.studyRef||d.reference||'')+'\n'+ (d.type||'')+' · '+(d.duration||'') ]; labels.forEach((titulo,i)=>{ if((d.contents[i]||'').trim()) partes.push(titulo+'\u001f'+d.contents[i]); }); if((d.notes||'').trim()) partes.push('Notas de investigación\u001f'+d.notes); let fecha=new Date(); let nombre=(rdeNombrePDFActual||('RδE - Mensaje - '+Date.now()))+'.pdf'; if(usarAndroid){ window.AndroidPrint.savePdfSections(nombre,partes.join('\u001e')); }else{ rdePDFAppleSecciones(partes); } return; return; } if(!$('outline').innerHTML)build();if(!hasSermon()&&!$('topic').value.trim()){alert('Primero prepara un bosquejo antes de exportarlo.');return}$('printArea').innerHTML=printHTML(data());if(window.AndroidPrint&&typeof window.AndroidPrint.savePdf==='function'){let now=new Date(),pad=n=>String(n).padStart(2,'0'),stamp=`${now.getFullYear()}-${pad(now.getMonth()+1)}-${pad(now.getDate())}_${pad(now.getHours())}-${pad(now.getMinutes())}-${pad(now.getSeconds())}`,base=String($('topic').value||'Mensaje').trim().replace(/[^A-Za-zÁÉÍÓÚÜÑáéíóúüñ0-9 _-]+/g,'').replace(/\s+/g,' ').slice(0,55)||'Mensaje';window.AndroidPrint.savePdf( `${rdeNombrePDFActual||('RδE - '+base+' - '+stamp)}.pdf`, ($('printArea').innerText||'').trim() );return}const tituloAnterior=document.title;document.title=rdeNombrePDFActual||('RδE - Mensaje - '+Date.now());window.addEventListener('afterprint',()=>{document.title=tituloAnterior},{once:true});window.print()} let pulpitSlides=[],pulpitIndex=0,pulpitFont=0; function getPulpitSlides(){return [...document.querySelectorAll('.section')].map(s=>({title:s.querySelector('h3').childNodes[0].textContent.trim(),body:s.querySelector('textarea').value.trim()})).filter(x=>x.body)} // Cronómetro manual del Modo Púlpito. let rdeTiempoAcumulado=0; let rdeInicioTiempo=0; let rdeEstadoTiempo='detenido'; let rdeIntervaloTiempo=null; function rdeMilisegundos(){ return rdeTiempoAcumulado + (rdeEstadoTiempo==='activo' ? performance.now()-rdeInicioTiempo : 0); } function rdeMostrarTiempo(){ const total=Math.floor(rdeMilisegundos()/1000); const horas=String(Math.floor(total/3600)).padStart(2,'0'); const minutos=String(Math.floor((total%3600)/60)).padStart(2,'0'); const segundos=String(total%60).padStart(2,'0'); const elemento=document.getElementById('rdeTiempo'); if(elemento)elemento.textContent=horas+':'+minutos+':'+segundos; } function rdeIniciar(){ if(rdeEstadoTiempo==='activo')return; if(rdeEstadoTiempo==='finalizado')rdeTiempoAcumulado=0; rdeInicioTiempo=performance.now(); rdeEstadoTiempo='activo'; if(rdeIntervaloTiempo!==null)clearInterval(rdeIntervaloTiempo); rdeIntervaloTiempo=setInterval(rdeMostrarTiempo,250); rdeMostrarTiempo(); } function rdePausar(){ if(rdeEstadoTiempo!=='activo')return; rdeTiempoAcumulado=rdeMilisegundos(); rdeEstadoTiempo='pausado'; clearInterval(rdeIntervaloTiempo); rdeIntervaloTiempo=null; rdeMostrarTiempo(); } function rdeFinalizar(){ if(rdeEstadoTiempo==='activo') rdeTiempoAcumulado=rdeMilisegundos(); rdeEstadoTiempo='finalizado'; clearInterval(rdeIntervaloTiempo); rdeIntervaloTiempo=null; rdeMostrarTiempo(); } function rdeReiniciar(){ rdeTiempoAcumulado=0; rdeInicioTiempo=0; rdeEstadoTiempo='detenido'; clearInterval(rdeIntervaloTiempo); rdeIntervaloTiempo=null; rdeMostrarTiempo(); } function pulpit(){if($('pulpit').classList.contains('show'))closePulpit();else openPulpit()} function openPulpit(){if(!$('outline').innerHTML)build();pulpitSlides=getPulpitSlides();if(!pulpitSlides.length){alert('El bosquejo está vacío. Escribe al menos una sección antes de entrar al Modo Púlpito.');return}pulpitIndex=0;$('pulpitTitle').textContent=$('topic').value||'Mi mensaje';$('pulpit').classList.add('show');document.body.style.overflow='hidden';renderPulpit()} function closePulpit(){ $('pulpit').classList.remove('show');document.body.style.overflow='';if(document.fullscreenElement)document.exitFullscreen().catch(()=>{})} function renderPulpit(){let x=pulpitSlides[pulpitIndex];if(!x)return;$('pulpitHeading').textContent=x.title;$('pulpitBody').textContent=x.body;$('pulpitProgress').textContent=`${pulpitIndex+1} de ${pulpitSlides.length}`;$('pulpit').style.setProperty('--pulpit-size',`clamp(${24+pulpitFont*3}px,${3+pulpitFont*.25}vw,${44+pulpitFont*4}px)`);$('pulpitStage').scrollTop=0} function nextPulpit(){if(pulpitIndex0){pulpitIndex--;renderPulpit()}} function fontPulpit(n){pulpitFont=Math.max(-3,Math.min(5,pulpitFont+n));renderPulpit()} function fullPulpit(){let p=$('pulpit');if(!document.fullscreenElement&&p.requestFullscreen)p.requestFullscreen().catch(()=>{});else if(document.fullscreenElement)document.exitFullscreen().catch(()=>{})} let rpTopicStudyTimer=null;function rpSyncTopicToStudy(v){let q=(v||'').trim(),p=parseRef(q),valid=p&&p.book&&bibleItems(p).length;if(!valid)return false;let input=ensureStudyRef();if(!input)return false;input.value=q;clearTimeout(rpTopicStudyTimer);rpTopicStudyTimer=setTimeout(()=>{if($('topic').value.trim()===q&&($('studyRef')&&$('studyRef').value.trim()===q))study()},300);return true} document.addEventListener('keydown',e=>{if(!$('pulpit').classList.contains('show'))return;if(e.key==='ArrowRight'||e.key==='PageDown'){e.preventDefault();nextPulpit()}if(e.key==='ArrowLeft'||e.key==='PageUp'){e.preventDefault();prevPulpit()}if(e.key==='Escape'&&!document.fullscreenElement)closePulpit()}); // Mis notas de investigación: almacenamiento local persistente e independiente del borrador. const RDE_RESEARCH_NOTES_KEY='rde:research-notes:v1'; let rdeResearchNotesCache=null; function researchNotes(){ if(Array.isArray(rdeResearchNotesCache))return rdeResearchNotesCache.slice(); let all=[]; try{ let raw=localStorage.getItem(RDE_RESEARCH_NOTES_KEY); if(raw!==null){let parsed=JSON.parse(raw);if(Array.isArray(parsed))all=parsed} else {let legacy=rpRead('research-notes',[]);if(Array.isArray(legacy)&&legacy.length){all=legacy;localStorage.setItem(RDE_RESEARCH_NOTES_KEY,JSON.stringify(all))}} }catch(e){let legacy=rpRead('research-notes',[]);if(Array.isArray(legacy))all=legacy} rdeResearchNotesCache=all; return all.slice(); } function saveResearchNotes(x){ let clean=Array.isArray(x)?x:[]; localStorage.setItem(RDE_RESEARCH_NOTES_KEY,JSON.stringify(clean)); let verify=JSON.parse(localStorage.getItem(RDE_RESEARCH_NOTES_KEY)||'[]'); if(!Array.isArray(verify)||verify.length!==clean.length)throw new Error('No se pudo verificar el guardado de las notas'); rdeResearchNotesCache=verify; try{rpWrite('research-notes',verify)}catch(e){} return true; } function saveResearchNote(){ let box=$('notes'),text=(box?.value||'').trim(); if(!text){alert('Escribe una nota antes de guardarla.');return} let all=researchNotes(); all.unshift({id:rpMakeId(),text,createdAt:new Date().toISOString(),time:new Date().toLocaleString()}); try{ saveResearchNotes(all); }catch(e){ alert('No se pudo guardar la nota. Inténtalo de nuevo.'); return; } renderResearchNotes(); box.value=''; try{rpQueueDraft()}catch(e){} } function renderResearchNotes(){let host=$('researchNotesList');if(!host)return;let all=researchNotes();host.innerHTML=all.length?all.map((n,i)=>`
${esc(n.text||'')}
${esc(n.time||'')}
`).join(''):`

Aún no hay notas guardadas.

`} function toggleResearchNote(i){let el=$('research-note-'+i);if(el)el.classList.toggle('researchNoteOpen')} async function copyResearchNote(i,button){ const n=researchNotes()[i];if(!n)return; const value=n.text||''; let copied=false; try{if(navigator.clipboard&&navigator.clipboard.writeText){await navigator.clipboard.writeText(value);copied=true;}}catch(e){} if(!copied){ const ta=document.createElement('textarea');ta.value=value; ta.style.position='fixed';ta.style.left='-9999px';document.body.appendChild(ta); ta.focus();ta.select(); try{copied=document.execCommand('copy');}catch(e){}finally{ta.remove();} } if(button){ if(copied){button.textContent='✓ Copiado';button.setAttribute('aria-label','Nota copiada, lista para pegar');} else{button.textContent='No se pudo copiar';button.setAttribute('aria-label','No se pudo copiar la nota');} } } function deleteResearchNote(i){let all=researchNotes(),n=all[i];if(!n)return;if(!confirm('¿Eliminar esta nota?'))return;all.splice(i,1);saveResearchNotes(all);renderResearchNotes()} function researchNoteToOutline(i){let n=researchNotes()[i];if(!n)return;openMobileSection('prepare');setTimeout(()=>{$('outline')?.scrollIntoView({behavior:'smooth',block:'start'})},100)} function goToResearchNotes(){ // Abrir primero la sección correcta; no desplazar la página exterior. if(window.innerWidth>800 && typeof window.rde105Open==='function'){ window.rde105Open('reading'); const pane=document.getElementById('rde105Content'); const reading=document.getElementById('mobileReadingPanel'); if(reading){reading.style.display='block';reading.hidden=false;} if(pane)pane.scrollTop=0; const main=document.querySelector('.app>main');if(main)main.scrollTop=0; }else{ openMobileSection('reading'); const reading=document.getElementById('mobileReadingPanel'); if(reading){reading.hidden=false;reading.style.display='block';} } if(typeof renderResearchNotes==='function')renderResearchNotes(); } function setupMobileSections(){ if(window.innerWidth>800)return; const study=$('studySection');if(!study||$('mobileOriginalPanel'))return; const kids=[...study.children], original=document.createElement('div'), reading=document.createElement('div'), library=document.createElement('div'), guide=document.createElement('div'); original.id='mobileOriginalPanel';reading.id='mobileReadingPanel';library.id='mobileLibraryPanel';guide.id='mobileGuidePanel'; guide.innerHTML=guideHTML(''); study.append(original,reading,library,guide); let phase='original'; for(const el of kids){ if(el.id==='libraryHeading')phase='library'; else if(el.tagName==='LABEL'&&/Nota de investigación/i.test(el.textContent||''))phase='reading'; else if(el.querySelector&&el.querySelector("button[onclick='openBibleReader()']"))phase='reading'; (phase==='original'?original:phase==='reading'?reading:library).appendChild(el); } } let prepareToastTimer=null;function showPrepareToast(){let t=$('prepareToast');if(!t)return;clearTimeout(prepareToastTimer);t.classList.add('show');prepareToastTimer=setTimeout(()=>t.classList.remove('show'),5000)} function openMobileSection(name){ setupMobileSections();document.body.className=document.body.className.replace(/\bmobileFocus\b|\bmobile-(advice|description|prepare|original|reading|library|guide)\b/g,'').trim(); document.body.classList.add('mobileFocus','mobile-'+name);$('mobileBackBar')?.classList.add('show');window.scrollTo(0,0); if(name==='library')renderLib();if(name==='reading')renderResearchNotes();if(name==='prepare')showPrepareToast();if(name==='guide'){let g=$('mobileGuideStandalone');if(g)g.innerHTML=guideHTML('');}let bb=$('mobileBackBtn');if(bb)bb.textContent=name==='original'?'← Regresar al bosquejo':'← Regresar a pantalla principal'; } function goToLibrary(){ if(window.innerWidth<=800){openMobileSection('library');return;} renderLib();const el=$('libraryHeading')||$('library'); if(el)el.scrollIntoView({behavior:'smooth',block:'start'}); } function mobileBack(){if(document.body.classList.contains('mobile-original')){openMobileSection('prepare');return;}rdeGoToBubbles()} function mobileHome(){document.body.className=document.body.className.replace(/\bmobileFocus\b|\bmobile-(advice|description|prepare|original|reading|library|guide)\b/g,'').trim();$('mobileBackBar')?.classList.remove('show');window.scrollTo(0,0)} window.addEventListener('resize',()=>{if(window.innerWidth<=800)setupMobileSections()}); document.addEventListener('input',e=>{if(e.target.id==='topic'){let v=e.target.value,p=parseRef(v),isRef=p&&p.book&&bibleItems(p).length;syncOutlineTopic();if(!v.trim()){resetTopicState();if($('studyRef'))ensureStudyRef().value='';$('studyResult').innerHTML='';currentStudy=null;currentStudyRef='';currentPassage=null;}else if(isRef){rpSyncTopicToStudy(v);$('studyResult').innerHTML="

Referencia reconocida. Cargando el texto original…

"}else if(v.trim()){resetTopicState();$('topicResults').innerHTML="

Tema detectado. Pulsa Buscar texto para ver pasajes sugeridos.

"}}if(e.target.id==='studyRef'){let q=e.target.value.trim(),p=parseRef(q);if(!q){currentStudy=null;currentStudyRef='';currentPassage=null;$('studyResult').innerHTML="

Escribe una referencia para cargar el texto original.

"}else if(p&&p.book&&bibleItems(p).length){clearTimeout(rpTopicStudyTimer);rpTopicStudyTimer=setTimeout(()=>{if(($('studyRef')&&$('studyRef').value.trim()===q))study()},250)}}if(e.target.matches('input,textarea,select')){rpQueueDraft()}});document.addEventListener('change',e=>{if(e.target.matches('select')){build();rpQueueDraft()}});window.addEventListener('beforeunload',()=>{if(currentHasWork())rpSaveDraft()});/* Prueba de diagnóstico: no registrar Service Worker. No modifica datos personales. */build(true);rpInitWorkspace();$('bibleVersion').value=bibleVersion;renderLib();renderResearchNotes();rpRestoreDraft();setupMobileSections(); document.addEventListener('DOMContentLoaded',()=>{const watch=()=>{rpApplyBibleParchment()};let sr=$('studyResult'),rb=$('readerBody');if(sr)new MutationObserver(watch).observe(sr,{childList:true,subtree:true});if(rb)new MutationObserver(watch).observe(rb,{childList:true,subtree:true});watch()});