| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // TODO(kochi): Generalize the notification as a component and put it | 5 // TODO(kochi): Generalize the notification as a component and put it |
| 6 // in js/cr/ui/notification.js . | 6 // in js/cr/ui/notification.js . |
| 7 | 7 |
| 8 cr.define('options', function() { | 8 cr.define('options', function() { |
| 9 /** @const */ var OptionsPage = options.OptionsPage; | 9 /** @const */ var OptionsPage = options.OptionsPage; |
| 10 /** @const */ var LanguageList = options.LanguageList; | 10 /** @const */ var LanguageList = options.LanguageList; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // the URL hash (ex. lang_add=ja). Used for automated testing. | 83 // the URL hash (ex. lang_add=ja). Used for automated testing. |
| 84 var match = document.location.hash.match(/\blang_add=([\w-]+)/); | 84 var match = document.location.hash.match(/\blang_add=([\w-]+)/); |
| 85 if (match) { | 85 if (match) { |
| 86 var addLanguageCode = match[1]; | 86 var addLanguageCode = match[1]; |
| 87 $('language-options-list').addLanguage(addLanguageCode); | 87 $('language-options-list').addLanguage(addLanguageCode); |
| 88 } else { | 88 } else { |
| 89 OptionsPage.navigateToPage('addLanguage'); | 89 OptionsPage.navigateToPage('addLanguage'); |
| 90 } | 90 } |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 // Set up the button for editing custom spelling dictionary. |
| 94 var editDictionaryButton = $('edit-dictionary'); |
| 95 if (editDictionaryButton) { |
| 96 editDictionaryButton.onclick = function(e) { |
| 97 OptionsPage.navigateToPage('dictionary'); |
| 98 }; |
| 99 } |
| 100 |
| 93 if (cr.isChromeOS) { | 101 if (cr.isChromeOS) { |
| 94 // Listen to user clicks on the add language list. | 102 // Listen to user clicks on the add language list. |
| 95 var addLanguageList = $('add-language-overlay-language-list'); | 103 var addLanguageList = $('add-language-overlay-language-list'); |
| 96 addLanguageList.addEventListener( | 104 addLanguageList.addEventListener( |
| 97 'click', | 105 'click', |
| 98 this.handleAddLanguageListClick_.bind(this)); | 106 this.handleAddLanguageListClick_.bind(this)); |
| 99 $('language-options-extension-ime-button').addEventListener( | 107 $('language-options-extension-ime-button').addEventListener( |
| 100 'click', | 108 'click', |
| 101 this.handleExtensionImeButtonClick_.bind(this)); | 109 this.handleExtensionImeButtonClick_.bind(this)); |
| 102 } else { | 110 } else { |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 | 694 |
| 687 /** | 695 /** |
| 688 * Handles browse.enable_spellchecking change. | 696 * Handles browse.enable_spellchecking change. |
| 689 * @param {Event} e Change event. | 697 * @param {Event} e Change event. |
| 690 * @private | 698 * @private |
| 691 */ | 699 */ |
| 692 updateEnableSpellCheck_: function() { | 700 updateEnableSpellCheck_: function() { |
| 693 var value = !$('enable-spell-check').checked; | 701 var value = !$('enable-spell-check').checked; |
| 694 | 702 |
| 695 $('language-options-spell-check-language-button').disabled = value; | 703 $('language-options-spell-check-language-button').disabled = value; |
| 704 $('edit-dictionary').hidden = value; |
| 696 }, | 705 }, |
| 697 | 706 |
| 698 /** | 707 /** |
| 699 * Handles spellCheckDictionaryPref change. | 708 * Handles spellCheckDictionaryPref change. |
| 700 * @param {Event} e Change event. | 709 * @param {Event} e Change event. |
| 701 * @private | 710 * @private |
| 702 */ | 711 */ |
| 703 handleSpellCheckDictionaryPrefChange_: function(e) { | 712 handleSpellCheckDictionaryPrefChange_: function(e) { |
| 704 var languageCode = e.value.value; | 713 var languageCode = e.value.value; |
| 705 this.spellCheckDictionary_ = languageCode; | 714 this.spellCheckDictionary_ = languageCode; |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 // only take effect after restart. | 996 // only take effect after restart. |
| 988 showMutuallyExclusiveNodes([$('language-options-ui-language-button'), | 997 showMutuallyExclusiveNodes([$('language-options-ui-language-button'), |
| 989 $('language-options-ui-notification-bar')], 1); | 998 $('language-options-ui-notification-bar')], 1); |
| 990 }; | 999 }; |
| 991 | 1000 |
| 992 // Export | 1001 // Export |
| 993 return { | 1002 return { |
| 994 LanguageOptions: LanguageOptions | 1003 LanguageOptions: LanguageOptions |
| 995 }; | 1004 }; |
| 996 }); | 1005 }); |
| OLD | NEW |