charger_voix
This commit is contained in:
@@ -125,16 +125,17 @@ body > main {
|
|||||||
const langue = document.documentElement.lang;
|
const langue = document.documentElement.lang;
|
||||||
|
|
||||||
let voix = null;
|
let voix = null;
|
||||||
if ('speechSynthesis' in window) {
|
function charger_voix() {
|
||||||
speechSynthesis.onvoiceschanged = function() {
|
|
||||||
let liste_voix = speechSynthesis.getVoices().filter(voice => voice.lang.startsWith(langue));
|
let liste_voix = speechSynthesis.getVoices().filter(voice => voice.lang.startsWith(langue));
|
||||||
select_voix.innerHTML = aphone;
|
select_voix.innerHTML = aphone;
|
||||||
|
|
||||||
if (!liste_voix.length) {
|
if (!liste_voix.length) {
|
||||||
bouton_synthese_vocale.style.display = 'none';
|
bouton_synthese_vocale.style.display = 'none';
|
||||||
|
speechSynthesis.addEventListener('voiceschanged', charger_voix);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
speechSynthesis.removeEventListener('voiceschanged', charger_voix);
|
||||||
liste_voix.forEach((v, i) => {
|
liste_voix.forEach((v, i) => {
|
||||||
const option = document.createElement('option');
|
const option = document.createElement('option');
|
||||||
option.value = i;
|
option.value = i;
|
||||||
@@ -171,9 +172,7 @@ body > main {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if ('speechSynthesis' in window) charger_voix();
|
||||||
speechSynthesis.onvoiceschanged()
|
|
||||||
}
|
|
||||||
|
|
||||||
question.addEventListener('keydown', e => {
|
question.addEventListener('keydown', e => {
|
||||||
if (e.key === 'Enter' && !e.ctrlKey && !e.shiftKey) {
|
if (e.key === 'Enter' && !e.ctrlKey && !e.shiftKey) {
|
||||||
|
|||||||
Reference in New Issue
Block a user