OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var appWindow = chrome.app.window.current(); | 5 var appWindow = chrome.app.window.current(); |
6 | 6 |
7 document.addEventListener('DOMContentLoaded', function() { | 7 document.addEventListener('DOMContentLoaded', function() { |
8 var flow = new Flow(); | 8 var flow = new Flow(); |
9 flow.startFlow(); | 9 flow.startFlow(); |
10 | 10 |
11 // Make the close buttons close the app window. | 11 // Make the close buttons close the app window. |
12 var closeButtons = document.getElementsByClassName('close'); | 12 var closeButtons = document.getElementsByClassName('close'); |
13 for (var i = 0; i < closeButtons.length; ++i) { | 13 for (var i = 0; i < closeButtons.length; ++i) { |
14 var closeButton = closeButtons[i]; | 14 var closeButton = closeButtons[i]; |
15 closeButton.addEventListener('click', function(e) { | 15 closeButton.addEventListener('click', function(e) { |
16 appWindow.close(); | 16 appWindow.close(); |
17 e.stopPropagation(); | 17 e.stopPropagation(); |
18 }); | 18 }); |
19 } | 19 } |
20 | 20 |
21 $('ah-cancel-button').addEventListener('click', function(e) { | 21 $('ah-cancel-button').addEventListener('click', function(e) { |
22 appWindow.close(); | 22 appWindow.close(); |
23 e.stopPropagation(); | 23 e.stopPropagation(); |
24 }); | 24 }); |
25 | 25 |
26 $('done-button').addEventListener('click', function(e) { | |
27 appWindow.close(); | |
28 e.stopPropagation(); | |
Dan Beam
2014/10/21 18:17:38
why are you stopping propagation? probably mean p
kcarattini
2014/10/22 03:47:27
Done.
| |
29 }); | |
30 | |
31 $('ho-cancel-button').addEventListener('click', function(e) { | |
32 appWindow.close(); | |
33 e.stopPropagation(); | |
34 }); | |
35 | |
26 $('hw-cancel-button').addEventListener('click', function(e) { | 36 $('hw-cancel-button').addEventListener('click', function(e) { |
27 appWindow.close(); | 37 appWindow.close(); |
28 e.stopPropagation(); | 38 e.stopPropagation(); |
29 }); | 39 }); |
30 | 40 |
31 $('st-cancel-button').addEventListener('click', function(e) { | 41 $('st-cancel-button').addEventListener('click', function(e) { |
32 appWindow.close(); | 42 appWindow.close(); |
33 e.stopPropagation(); | 43 e.stopPropagation(); |
34 }); | 44 }); |
35 | 45 |
36 $('ah-agree-button').addEventListener('click', function(e) { | 46 $('ah-agree-button').addEventListener('click', function(e) { |
37 // TODO(kcarattini): Set the Audio History setting. | 47 // TODO(kcarattini): Set the Audio History setting. |
38 appWindow.close(); | 48 appWindow.close(); |
39 e.stopPropagation(); | 49 e.stopPropagation(); |
40 }); | 50 }); |
41 | 51 |
42 $('hw-agree-button').addEventListener('click', function(e) { | 52 $('hw-agree-button').addEventListener('click', function(e) { |
43 flow.advanceStep(); | 53 flow.advanceStep(); |
44 e.stopPropagation(); | 54 e.stopPropagation(); |
45 }); | 55 }); |
46 | 56 |
47 // TODO(kcarattini): Remove this once speech training is implemented. The | 57 // TODO(kcarattini): Remove this once speech training is implemented. The |
48 // way to get to the next page will be to complete the speech training. | 58 // way to get to the next page will be to complete the speech training. |
49 $('training').addEventListener('click', function(e) { | 59 $('st-training').addEventListener('click', function(e) { |
50 if (chrome.hotwordPrivate.setAudioLoggingEnabled) | 60 if (chrome.hotwordPrivate.setAudioLoggingEnabled) |
51 chrome.hotwordPrivate.setAudioLoggingEnabled(true, function() {}); | 61 chrome.hotwordPrivate.setAudioLoggingEnabled(true, function() {}); |
52 | 62 |
53 if (chrome.hotwordPrivate.setHotwordAlwaysOnSearchEnabled) { | 63 if (chrome.hotwordPrivate.setHotwordAlwaysOnSearchEnabled) { |
54 chrome.hotwordPrivate.setHotwordAlwaysOnSearchEnabled(true, | 64 chrome.hotwordPrivate.setHotwordAlwaysOnSearchEnabled(true, |
55 flow.advanceStep.bind(flow)); | 65 flow.advanceStep.bind(flow)); |
56 } | 66 } |
57 e.stopPropagation(); | 67 e.stopPropagation(); |
58 }); | 68 }); |
59 | 69 |
60 $('try-now-button').addEventListener('click', function(e) { | 70 // TODO(kcarattini): Remove this once speech training is implemented. The |
61 // TODO(kcarattini): Figure out what happens when you click this button. | 71 // way to get to the next page will be to complete the speech training. |
62 appWindow.close(); | 72 $('ho-training').addEventListener('click', function(e) { |
73 if (chrome.hotwordPrivate.setAudioLoggingEnabled) | |
74 chrome.hotwordPrivate.setAudioLoggingEnabled(true, function() {}); | |
75 | |
76 if (chrome.hotwordPrivate.setHotwordAlwaysOnSearchEnabled) { | |
77 chrome.hotwordPrivate.setHotwordAlwaysOnSearchEnabled(true, | |
78 flow.advanceStep.bind(flow)); | |
79 } | |
63 e.stopPropagation(); | 80 e.stopPropagation(); |
64 }); | 81 }); |
65 }); | 82 }); |
OLD | NEW |