OLD | NEW |
1 /** | 1 /** |
2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 var text; | 7 var text; |
8 var ttsStatus; | 8 var ttsStatus; |
9 var ttsStatusBox; | 9 var ttsStatusBox; |
10 var lang; | 10 var lang; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 chrome.tts.isSpeaking(function(isSpeaking) { | 79 chrome.tts.isSpeaking(function(isSpeaking) { |
80 if (!isSpeaking) { | 80 if (!isSpeaking) { |
81 ttsStatus.innerHTML = 'Idle'; | 81 ttsStatus.innerHTML = 'Idle'; |
82 ttsStatusBox.style.background = '#fff'; | 82 ttsStatusBox.style.background = '#fff'; |
83 } | 83 } |
84 }); | 84 }); |
85 } | 85 } |
86 }; | 86 }; |
87 chrome.tts.speak( | 87 chrome.tts.speak( |
88 str, options, function() { | 88 str, options, function() { |
89 if (chrome.extension.lastError) { | 89 if (chrome.runtime.lastError) { |
90 console.log('TTS Error: ' + chrome.extension.lastError.message); | 90 console.log('TTS Error: ' + chrome.runtime.lastError.message); |
91 } | 91 } |
92 }); | 92 }); |
93 ttsStatus.innerHTML = 'Busy'; | 93 ttsStatus.innerHTML = 'Busy'; |
94 ttsStatusBox.style.background = '#ffc'; | 94 ttsStatusBox.style.background = '#ffc'; |
95 } | 95 } |
96 | 96 |
97 function stop() { | 97 function stop() { |
98 chrome.tts.stop(); | 98 chrome.tts.stop(); |
99 } | 99 } |
100 | 100 |
101 function speakUserText() { | 101 function speakUserText() { |
102 var options = {}; | 102 var options = {}; |
103 if (lang.value) { | 103 if (lang.value) { |
104 options.lang = lang.value; | 104 options.lang = lang.value; |
105 } | 105 } |
106 speak(text.value, options, true); | 106 speak(text.value, options, true); |
107 } | 107 } |
108 | 108 |
109 document.addEventListener('DOMContentLoaded', load); | 109 document.addEventListener('DOMContentLoaded', load); |
OLD | NEW |