| 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 chrome.hotwordPrivate.getLocalizedStrings(function(strings) { | 8 chrome.hotwordPrivate.getLocalizedStrings(function(strings) { |
| 9 loadTimeData.data = strings; | 9 loadTimeData.data = strings; |
| 10 i18nTemplate.process(document, loadTimeData); | 10 i18nTemplate.process(document, loadTimeData); |
| 11 | 11 |
| 12 var flow = new Flow(); | 12 var flow = new Flow(); |
| 13 flow.startFlow(); | 13 flow.startFlow(); |
| 14 | 14 |
| 15 var pressFunction = function(e) { | 15 var pressFunction = function(e) { |
| 16 // Only respond to 'Enter' key presses. | 16 // Only respond to 'Enter' key presses. |
| 17 if (e.type == 'keyup' && e.keyIdentifier != 'Enter') | 17 if (e.type == 'keyup' && e.key != 'Enter') |
| 18 return; | 18 return; |
| 19 | 19 |
| 20 var classes = e.target.classList; | 20 var classes = e.target.classList; |
| 21 if (classes.contains('close') || classes.contains('finish-button')) { | 21 if (classes.contains('close') || classes.contains('finish-button')) { |
| 22 flow.stopTraining(); | 22 flow.stopTraining(); |
| 23 appWindow.close(); | 23 appWindow.close(); |
| 24 e.preventDefault(); | 24 e.preventDefault(); |
| 25 } | 25 } |
| 26 if (classes.contains('retry-button')) { | 26 if (classes.contains('retry-button')) { |
| 27 flow.handleRetry(); | 27 flow.handleRetry(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 41 flow.advanceStep(); | 41 flow.advanceStep(); |
| 42 e.preventDefault(); | 42 e.preventDefault(); |
| 43 }); | 43 }); |
| 44 | 44 |
| 45 $('settings-link').addEventListener('click', function(e) { | 45 $('settings-link').addEventListener('click', function(e) { |
| 46 chrome.browser.openTab({'url': 'chrome://settings'}, function() {}); | 46 chrome.browser.openTab({'url': 'chrome://settings'}, function() {}); |
| 47 e.preventDefault(); | 47 e.preventDefault(); |
| 48 }); | 48 }); |
| 49 }); | 49 }); |
| 50 }); | 50 }); |
| OLD | NEW |