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