Carregando devocional…
PUBLICIDADE
Anúncio não disponível
Data: ${dateStr}
${this.escapeHTML(dev.titulo)}
📖 Versículo: ${this.escapeHTML(dev.versiculo)}
${dev.texto.map(item => `• ${this.escapeHTML(item)}
`).join("")}🙏 Oração: ${this.escapeHTML(dev.oracao)}
`; textDiv.classList.remove("fade"); if (!this.devocionais[key]) { this.showNotification("Devocional não disponível para esta data."); } }, 300); }, escapeHTML(str) { const div = document.createElement("div"); div.textContent = str; return div.innerHTML; }, loadAds() { const adScript = document.createElement("script"); adScript.async = true; adScript.src = "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4677691792797384"; adScript.crossOrigin = "anonymous"; adScript.onerror = () => { this.adContainer.querySelector("p").style.display = "none"; this.adContainer.querySelector(".ad-fallback").style.display = "block"; }; this.adContainer.appendChild(adScript); const ins = document.createElement("ins"); ins.className = "adsbygoogle"; ins.style.display = "block"; ins.style.textAlign = "center"; ins.setAttribute("data-ad-layout", "in-article"); ins.setAttribute("data-ad-format", "fluid"); ins.setAttribute("data-ad-client", "ca-pub-4677691792797384"); ins.setAttribute("data-ad-slot", "1136570771"); this.adContainer.appendChild(ins); (adsbygoogle = window.adsbygoogle || []).push({}); }, showNotification(message) { const notification = document.createElement("div"); notification.style.cssText = ` position: fixed; top: 10px; left: 50%; transform: translateX(-50%); background: #00a2ff; color: #fff; padding: 10px 20px; border-radius: 5px; z-index: 10000; transition: opacity 0.5s; `; notification.textContent = message; document.body.appendChild(notification); setTimeout(() => { notification.style.opacity = "0"; setTimeout(() => notification.remove(), 500); }, 3000); }, debounce(func, wait) { let timeout; return function (...args) { clearTimeout(timeout); timeout = setTimeout(() => func.apply(this, args), wait); }; }, setupEventListeners() { // Fechar ao clicar no fundo this.popup.addEventListener("click", (e) => { if (e.target === this.popup) { this.closePopup(); } }); // Fechar com tecla Esc document.addEventListener("keydown", (e) => { if (e.key === "Escape" && this.popup.classList.contains("show")) { this.closePopup(); } }); document.getElementById("prev-btn").onclick = this.debounce(() => { this.hoje.setDate(this.hoje.getDate() - 1); this.showDevocional(this.getKey(this.hoje)); }, config.debounceDelay); document.getElementById("next-btn").onclick = this.debounce(() => { this.hoje.setDate(this.hoje.getDate() + 1); this.showDevocional(this.getKey(this.hoje)); }, config.debounceDelay); document.getElementById("copy-btn").onclick = () => { if (!navigator.clipboard) { this.showNotification("Copiar não suportado neste navegador."); return; } const dev = this.devocionais[this.getKey(this.hoje)] || config.defaultDevocional; navigator.clipboard.writeText(dev.versiculo).then(() => this.showNotification("Versículo copiado!")); }; document.getElementById("share-btn").onclick = () => { const dev = this.devocionais[this.getKey(this.hoje)] || config.defaultDevocional; const shareText = `${dev.titulo}\n${dev.versiculo}\n${dev.texto.join("\n")}\n${dev.oracao}\nLeia mais: ${window.location.href}`; if (navigator.share) { navigator.share({ title: dev.titulo, text: shareText }).catch(err => console.error(err)); } else if (navigator.clipboard) { navigator.clipboard.writeText(shareText).then(() => this.showNotification("Conteúdo copiado! Compartilhe manualmente.")); } else { this.showNotification("Compartilhamento não suportado neste navegador."); } }; document.getElementById("theme-btn").onclick = () => { const isLight = this.content.classList.toggle("light-theme"); this.content.classList.toggle("dark-theme", !isLight); this.adContainer.classList.toggle("light-theme", isLight); this.adContainer.classList.toggle("dark-theme", !isLight); localStorage.setItem("theme", isLight ? "light" : "dark"); }; document.querySelectorAll("#devocional-buttons button").forEach(button => { button.addEventListener("keydown", (e) => { if (e.key === "Enter" || e.key === "Space") { e.preventDefault(); button.click(); } }); }); } }; Devocional.init();