Skip to content

Commit

Permalink
hide pitch setting from Microsoft Online voices
Browse files Browse the repository at this point in the history
  • Loading branch information
Falcosc committed Jun 15, 2024
1 parent 4c82d17 commit 1defaa2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ function loadSettings() {
validateAccessToken(localStorage.getItem('accessToken'));
}

document.querySelectorAll('select[name=voice]').forEach((select) => select.addEventListener('change', onVoiceSelectChange));

if(localStorage.getItem('lastGetVoiceListBugAgent') == navigator.userAgent) {
const androidEdgeHack = document.querySelector('#androidEdgeHack');
androidEdgeHack.removeAttribute('hidden');
Expand Down Expand Up @@ -58,6 +60,12 @@ function loadSettings() {
});
}

function onVoiceSelectChange(e) {
//online Microsoft Voices don't have support for pitch
const hasNoPitchSupport = e.target.value.includes('Microsoft') && e.target.value.includes('Online');
e.target.form.querySelector('input[name=pitch]').parentElement.hidden = hasNoPitchSupport;
}

function pageLifecycleChange() {
if(client?.ws) requestWakeLock()
}
Expand Down Expand Up @@ -107,6 +115,7 @@ function populateVoicesSelects() {
document.querySelector('#statusVoice [name=voice]').value=voices?.find(v => v.lang.includes('en'))?.name;
document.querySelector('form[name=chatVoice] [name=voice]').value=voices?.find(v => v.lang.includes(navigator.language))?.name;
//[...document.querySelector('#statusVoice [name=voice]').options].map(o => o.value).includes(voiceFromSettings)
document.querySelectorAll('select[name=voice]').forEach((e) => e.dispatchEvent(new Event('change')));
}

async function getVoiceOrder() {
Expand Down

0 comments on commit 1defaa2

Please sign in to comment.