Skip to content

Commit

Permalink
switched tts api for firefox support
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonhellman committed Dec 31, 2017
1 parent 959dc58 commit d084bdd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
11 changes: 6 additions & 5 deletions hit_catcher/hit_catcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -675,11 +675,12 @@ function catcherCaptchaFound() {
}
}

function textToSpeech(phrase, options) {
chrome.tts.speak(phrase, {
enqueue: true,
voiceName: `Google US English`
});
speechSynthesis.getVoices();

function textToSpeech(phrase) {
const message = new SpeechSynthesisUtterance(phrase);
message.voice = speechSynthesis.getVoices().filter((voice) => voice.name == `Google US English`)[0];
window.speechSynthesis.speak(message);
}

document.getElementById(`pause`).addEventListener(`click`, catcherPauseToggle);
Expand Down
6 changes: 5 additions & 1 deletion hit_finder/hit_finder.js
Original file line number Diff line number Diff line change
Expand Up @@ -1288,8 +1288,12 @@ function reviewModal(requesterId) {
$(modal).modal(`show`);
}

speechSynthesis.getVoices();

function textToSpeech(phrase) {
chrome.tts.speak(phrase, { enqueue: true, voiceName: `Google US English` });
const message = new SpeechSynthesisUtterance(phrase);
message.voice = speechSynthesis.getVoices().filter((voice) => voice.name == `Google US English`)[0];
window.speechSynthesis.speak(message);
}

function timeNow() {
Expand Down
14 changes: 9 additions & 5 deletions hit_tracker/hit_tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,11 +520,7 @@ function sycningEnded() {
}

function loggedOut() {
chrome.tts.speak(`Attention, you are logged out of MTurk.`, {
enqueue: true,
voiceName: `Google US English`
});

textToSpeech(`Attention, you are logged out of MTurk.`);
sycningEnded();
}

Expand Down Expand Up @@ -715,6 +711,14 @@ document.getElementById(`sync-last-45-days`).addEventListener(`click`, async (e)
});
})();

speechSynthesis.getVoices();

function textToSpeech(phrase) {
const message = new SpeechSynthesisUtterance(phrase);
message.voice = speechSynthesis.getVoices().filter((voice) => voice.name == `Google US English`)[0];
window.speechSynthesis.speak(message);
}




Expand Down
3 changes: 0 additions & 3 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
"persistent": true
},

"incognito": "split",

"minimum_chrome_version": "61",

"offline_enabled": true,
Expand All @@ -38,7 +36,6 @@
"options_page": "options/options.html",

"permissions": [
"tts",
"tabs",
"activeTab",
"storage",
Expand Down

0 comments on commit d084bdd

Please sign in to comment.