2024-03-05 13:46:24 -06:00
|
|
|
let codingMode = true; // Set to true for coding mode (no api calls to bible passage)
|
|
|
|
|
|
|
|
//https://labs.bible.org/api/?passage=random&formatting=plain&type=text
|
|
|
|
async function fetchBiblePassage() {
|
|
|
|
try {
|
|
|
|
let textData;
|
|
|
|
if (codingMode == true) {
|
2024-03-05 13:52:02 -06:00
|
|
|
textData = 'Samuel 16:9 “And he said, "I now know de wae" in zimbabwe.';
|
2024-03-05 13:46:24 -06:00
|
|
|
} else {
|
|
|
|
const response = await fetch('https://labs.bible.org/api/?passage=random&formatting=plain&type=text');
|
|
|
|
textData = await response.text();
|
|
|
|
}
|
2024-03-05 13:52:02 -06:00
|
|
|
document.getElementById('biblepassage').textContent = `${textData}“`;
|
2024-03-05 13:46:24 -06:00
|
|
|
} catch (error) {
|
|
|
|
console.error('Error fetching Bible passage:', error);
|
|
|
|
// Handle the error gracefully, e.g., display an error message to the user
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fetchBiblePassage();
|
|
|
|
|
|
|
|
const searchButton = document.getElementById('search-button');
|
|
|
|
const searchInput = document.getElementById('search-input');
|
|
|
|
|
|
|
|
searchButton.addEventListener('click', () => {
|
|
|
|
const searchTerm = searchInput.value;
|
|
|
|
if (searchTerm) {
|
|
|
|
window.location.href = `https://search.sparksammy.com/search.php?q=${searchTerm}&p=0&t=0`;
|
|
|
|
} else {
|
|
|
|
alert('Please enter a search term.');
|
|
|
|
}
|
|
|
|
});
|