diff --git a/kjvstudy_org/templates/biblical_prophets.html b/kjvstudy_org/templates/biblical_prophets.html
index 2fab080..9a4b68d 100644
--- a/kjvstudy_org/templates/biblical_prophets.html
+++ b/kjvstudy_org/templates/biblical_prophets.html
@@ -295,14 +295,23 @@ document.body.dataset.resourceReader = 'true';
document.addEventListener('DOMContentLoaded', function() {
// Listen button handler
var listenBtn = document.getElementById('listen-btn');
+ var isListening = false;
if (listenBtn) {
listenBtn.addEventListener('click', function() {
+ if (isListening) {
+ if (window.KJVSpeech) window.KJVSpeech.stop();
+ listenBtn.innerHTML = ' Listen';
+ isListening = false;
+ return;
+ }
var paragraphs = document.querySelectorAll('.intro-text, .prophet-description p, .verse-text');
var text = Array.from(paragraphs).map(function(p) {
return p.textContent.trim();
}).join(' ');
if (window.KJVSpeech && text) {
window.KJVSpeech.speak(text);
+ listenBtn.innerHTML = ' Stop';
+ isListening = true;
}
});
}
diff --git a/kjvstudy_org/templates/fruits_of_spirit.html b/kjvstudy_org/templates/fruits_of_spirit.html
index 7e10c5b..de563df 100644
--- a/kjvstudy_org/templates/fruits_of_spirit.html
+++ b/kjvstudy_org/templates/fruits_of_spirit.html
@@ -295,14 +295,23 @@ document.body.dataset.resourceReader = 'true';
document.addEventListener('DOMContentLoaded', function() {
// Listen button handler
var listenBtn = document.getElementById('listen-btn');
+ var isListening = false;
if (listenBtn) {
listenBtn.addEventListener('click', function() {
+ if (isListening) {
+ if (window.KJVSpeech) window.KJVSpeech.stop();
+ listenBtn.innerHTML = ' Listen';
+ isListening = false;
+ return;
+ }
var paragraphs = document.querySelectorAll('.intro-text, .fruit-description p, .verse-text');
var text = Array.from(paragraphs).map(function(p) {
return p.textContent.trim();
}).join(' ');
if (window.KJVSpeech && text) {
window.KJVSpeech.speak(text);
+ listenBtn.innerHTML = ' Stop';
+ isListening = true;
}
});
}
diff --git a/kjvstudy_org/templates/names_of_god.html b/kjvstudy_org/templates/names_of_god.html
index f8dad16..f2a4320 100644
--- a/kjvstudy_org/templates/names_of_god.html
+++ b/kjvstudy_org/templates/names_of_god.html
@@ -291,14 +291,23 @@
document.addEventListener('DOMContentLoaded', function() {
// Listen button handler
var listenBtn = document.getElementById('listen-btn');
+ var isListening = false;
if (listenBtn) {
listenBtn.addEventListener('click', function() {
+ if (isListening) {
+ if (window.KJVSpeech) window.KJVSpeech.stop();
+ listenBtn.innerHTML = ' Listen';
+ isListening = false;
+ return;
+ }
var paragraphs = document.querySelectorAll('.intro-text, .name-description p, .verse-text');
var text = Array.from(paragraphs).map(function(p) {
return p.textContent.trim();
}).join(' ');
if (window.KJVSpeech && text) {
window.KJVSpeech.speak(text);
+ listenBtn.innerHTML = ' Stop';
+ isListening = true;
}
});
}
diff --git a/kjvstudy_org/templates/parables.html b/kjvstudy_org/templates/parables.html
index 722cbfd..0da8c2a 100644
--- a/kjvstudy_org/templates/parables.html
+++ b/kjvstudy_org/templates/parables.html
@@ -309,14 +309,23 @@ document.body.dataset.resourceReader = 'true';
document.addEventListener('DOMContentLoaded', function() {
// Listen button handler
var listenBtn = document.getElementById('listen-btn');
+ var isListening = false;
if (listenBtn) {
listenBtn.addEventListener('click', function() {
+ if (isListening) {
+ if (window.KJVSpeech) window.KJVSpeech.stop();
+ listenBtn.innerHTML = ' Listen';
+ isListening = false;
+ return;
+ }
var paragraphs = document.querySelectorAll('.intro-text, .parable-description p, .verse-text');
var text = Array.from(paragraphs).map(function(p) {
return p.textContent.trim();
}).join(' ');
if (window.KJVSpeech && text) {
window.KJVSpeech.speak(text);
+ listenBtn.innerHTML = ' Stop';
+ isListening = true;
}
});
}
diff --git a/kjvstudy_org/templates/resource_detail.html b/kjvstudy_org/templates/resource_detail.html
index eb4f976..28a11a6 100644
--- a/kjvstudy_org/templates/resource_detail.html
+++ b/kjvstudy_org/templates/resource_detail.html
@@ -198,14 +198,23 @@ document.body.dataset.resourceReader = 'true';
(function() {
// Listen button handler
var listenBtn = document.getElementById('listen-btn');
+ var isListening = false;
if (listenBtn) {
listenBtn.addEventListener('click', function() {
+ if (isListening) {
+ if (window.KJVSpeech) window.KJVSpeech.stop();
+ listenBtn.innerHTML = ' Listen';
+ isListening = false;
+ return;
+ }
var paragraphs = document.querySelectorAll('.resource-description p, .verse-text');
var text = Array.from(paragraphs).map(function(p) {
return p.textContent.trim();
}).join(' ');
if (window.KJVSpeech && text) {
window.KJVSpeech.speak(text);
+ listenBtn.innerHTML = ' Stop';
+ isListening = true;
}
});
}
diff --git a/kjvstudy_org/templates/resource_index.html b/kjvstudy_org/templates/resource_index.html
index ac393a4..0e9ee65 100644
--- a/kjvstudy_org/templates/resource_index.html
+++ b/kjvstudy_org/templates/resource_index.html
@@ -318,14 +318,23 @@ document.body.dataset.resourceReader = 'true';
document.addEventListener('DOMContentLoaded', function() {
// Listen button handler
var listenBtn = document.getElementById('listen-btn');
+ var isListening = false;
if (listenBtn) {
listenBtn.addEventListener('click', function() {
+ if (isListening) {
+ if (window.KJVSpeech) window.KJVSpeech.stop();
+ listenBtn.innerHTML = ' Listen';
+ isListening = false;
+ return;
+ }
var paragraphs = document.querySelectorAll('.intro-text, .resource-item-description p, .verse-text');
var text = Array.from(paragraphs).map(function(p) {
return p.textContent.trim();
}).join(' ');
if (window.KJVSpeech && text) {
window.KJVSpeech.speak(text);
+ listenBtn.innerHTML = ' Stop';
+ isListening = true;
}
});
}
diff --git a/kjvstudy_org/templates/story_kids.html b/kjvstudy_org/templates/story_kids.html
index 94968b5..fef6bcb 100644
--- a/kjvstudy_org/templates/story_kids.html
+++ b/kjvstudy_org/templates/story_kids.html
@@ -388,14 +388,23 @@ hr.story-divider::before {
(function() {
// Listen button handler
var listenBtn = document.getElementById('story-listen-btn');
+ var isListening = false;
if (listenBtn) {
listenBtn.addEventListener('click', function() {
+ if (isListening) {
+ if (window.KJVSpeech) window.KJVSpeech.stop();
+ listenBtn.innerHTML = ' Listen';
+ isListening = false;
+ return;
+ }
var paragraphs = document.querySelectorAll('article section p');
var text = Array.from(paragraphs).map(function(p) {
return p.textContent.trim();
}).join(' ');
if (window.KJVSpeech && text) {
window.KJVSpeech.speak(text);
+ listenBtn.innerHTML = ' Stop';
+ isListening = true;
}
});
}
diff --git a/kjvstudy_org/templates/topic_detail.html b/kjvstudy_org/templates/topic_detail.html
index b601569..2fd29cb 100644
--- a/kjvstudy_org/templates/topic_detail.html
+++ b/kjvstudy_org/templates/topic_detail.html
@@ -233,14 +233,23 @@
(function() {
// Listen button handler
var listenBtn = document.getElementById('listen-btn');
+ var isListening = false;
if (listenBtn) {
listenBtn.addEventListener('click', function() {
+ if (isListening) {
+ if (window.KJVSpeech) window.KJVSpeech.stop();
+ listenBtn.innerHTML = ' Listen';
+ isListening = false;
+ return;
+ }
var paragraphs = document.querySelectorAll('.topic-overview, .intro-text, .subtopic-description, .verse-note');
var text = Array.from(paragraphs).map(function(p) {
return p.textContent.trim();
}).join(' ');
if (window.KJVSpeech && text) {
window.KJVSpeech.speak(text);
+ listenBtn.innerHTML = ' Stop';
+ isListening = true;
}
});
}
diff --git a/kjvstudy_org/templates/twelve_apostles.html b/kjvstudy_org/templates/twelve_apostles.html
index 1c1006c..b0f97a7 100644
--- a/kjvstudy_org/templates/twelve_apostles.html
+++ b/kjvstudy_org/templates/twelve_apostles.html
@@ -297,14 +297,23 @@
document.addEventListener('DOMContentLoaded', function() {
// Listen button handler
var listenBtn = document.getElementById('listen-btn');
+ var isListening = false;
if (listenBtn) {
listenBtn.addEventListener('click', function() {
+ if (isListening) {
+ if (window.KJVSpeech) window.KJVSpeech.stop();
+ listenBtn.innerHTML = ' Listen';
+ isListening = false;
+ return;
+ }
var paragraphs = document.querySelectorAll('.intro-text, .apostle-description p, .verse-text');
var text = Array.from(paragraphs).map(function(p) {
return p.textContent.trim();
}).join(' ');
if (window.KJVSpeech && text) {
window.KJVSpeech.speak(text);
+ listenBtn.innerHTML = ' Stop';
+ isListening = true;
}
});
}
diff --git a/kjvstudy_org/templates/women_of_the_bible.html b/kjvstudy_org/templates/women_of_the_bible.html
index 1d98012..469d409 100644
--- a/kjvstudy_org/templates/women_of_the_bible.html
+++ b/kjvstudy_org/templates/women_of_the_bible.html
@@ -291,14 +291,23 @@ document.body.dataset.resourceReader = 'true';
document.addEventListener('DOMContentLoaded', function() {
// Listen button handler
var listenBtn = document.getElementById('listen-btn');
+ var isListening = false;
if (listenBtn) {
listenBtn.addEventListener('click', function() {
+ if (isListening) {
+ if (window.KJVSpeech) window.KJVSpeech.stop();
+ listenBtn.innerHTML = ' Listen';
+ isListening = false;
+ return;
+ }
var paragraphs = document.querySelectorAll('.intro-text, .woman-description p, .verse-text');
var text = Array.from(paragraphs).map(function(p) {
return p.textContent.trim();
}).join(' ');
if (window.KJVSpeech && text) {
window.KJVSpeech.speak(text);
+ listenBtn.innerHTML = ' Stop';
+ isListening = true;
}
});
}